public static void Write(Nettention.Proud.Message msg, GeniusTake.Model.Player data) { msg.Write(data.RemoteID); msg.Write(data.UID); msg.Write(data.CharacterIndex); msg.Write(data.Nickname); msg.Write((byte)data.Side); msg.Write(data.IsReady); msg.Write(data.IsDead); msg.Write(data.Order); msg.Write(data.Hp); msg.Write(data.Power); msg.Write(data.Speed); msg.Write(data.MaxPower); msg.Write(data.Pain); msg.Write(data.Patience); msg.Write(data.Deck.BallList.Count); foreach (var a in data.Deck.BallList) { msg.Write(a.Key); msg.Write(a.Value); } }
public static void Read(Nettention.Proud.Message msg, out GeniusTake.Model.Player data) { data = new GeniusTake.Model.Player(); msg.Read(out data.RemoteID); msg.Read(out data.UID); msg.Read(out data.CharacterIndex); msg.Read(out data.Nickname); byte side; msg.Read(out side); data.Side = (GeniusTake.Model.SIDE)side; msg.Read(out data.IsReady); msg.Read(out data.IsDead); msg.Read(out data.Order); msg.Read(out data.Hp); msg.Read(out data.Power); msg.Read(out data.Speed); msg.Read(out data.MaxPower); msg.Read(out data.Pain); msg.Read(out data.Patience); int count; msg.Read(out count); while (count > 0) { long key; int containValue; msg.Read(out key); msg.Read(out containValue); data.AddDeckItem(key, containValue); count--; } }