public static void Write(Nettention.Proud.Message msg, ScoreBoardArray data) { if (data == null) { return; } msg.Write(data.Count); for (int i = 0; i < data.Count; i++) { GameScoreBoard temp = data[i]; msg.Write(temp.ShipUID); msg.Write(temp.PlayerUID); msg.Write(temp.NickName); msg.Write(temp.Life); msg.Write(temp.PlayMoney); msg.Write(temp.CardBag.C_Card); msg.Write(temp.CardBag.G_Card); msg.Write(temp.CardBag.P_Card); msg.Write(temp.Win); msg.Write(temp.Lose); msg.Write(temp.Draw); msg.Write(temp.Reason); msg.Write(temp.Reward); msg.Write(temp.Ranking); } }
public static void Read(Nettention.Proud.Message msg, out ScoreBoardArray data) { int count = 0; msg.Read(out count); if (count > 0) { GameScoreBoard[] worldData = new GameScoreBoard[count]; for (int i = 0; i < count; i++) { GameScoreBoard temp = new GameScoreBoard(); msg.Read(out temp.ShipUID); msg.Read(out temp.PlayerUID); msg.Read(out temp.NickName); msg.Read(out temp.Life); msg.Read(out temp.PlayMoney); msg.Read(out temp.CardBag.C_Card); msg.Read(out temp.CardBag.G_Card); msg.Read(out temp.CardBag.P_Card); msg.Read(out temp.Win); msg.Read(out temp.Lose); msg.Read(out temp.Draw); msg.Read(out temp.Reason); msg.Read(out temp.Reward); msg.Read(out temp.Ranking); worldData[i] = temp; } data = new ScoreBoardArray(worldData); } else { data = new ScoreBoardArray(); } }