//解析玩家列表 public void DeserializePlayerList(DataStream reader) { byte playerCount = reader.ReadByte(); NetTools.Log("DeserializePlayerList player count : " + playerCount); for (int i = 0; i < playerCount; i++) { InRoomPlayerManager pm = new InRoomPlayerManager(); pm.Deserialize(reader); playerList.Add(pm); } }
public override void Deserialize(DataStream reader) { base.Deserialize(reader); type = reader.ReadSInt32(); NetTools.Log("RoomResp : " + type); switch (type) { case NetProtocols.ROOM_IN: rd = new RoomData(); rd.Deserialize(reader); DeserializePlayerList(reader); break; case NetProtocols.ROOM_LEAVE: break; case NetProtocols.ROOM_INPLAYER: // uid = reader.ReadSInt64(); // uname = reader.ReadString16(); pm = new InRoomPlayerManager(); pm.Deserialize(reader); break; case NetProtocols.ROOM_OUTPLAYER: uid = reader.ReadSInt64(); break; case NetProtocols.ROOM_SEL_MODE: uid = reader.ReadSInt64(); modeid = reader.ReadSInt32(); break; case NetProtocols.ROOM_READY: time = reader.ReadSInt64(); levelid = reader.ReadSInt32(); break; case NetProtocols.ROOM_HIDE: time = reader.ReadSInt64(); DeserializePlayerList(reader); break; case NetProtocols.ROOM_FIND: time = reader.ReadSInt64(); break; case NetProtocols.ROOM_OVER: time = reader.ReadSInt64(); wintype = reader.ReadByte(); int rewardcount = reader.ReadSInt32(); for (int i = 0; i < rewardcount; i++) { rewardList.Add(reader.ReadSInt32()); } break; case NetProtocols.ROOM_RESULT: time = reader.ReadSInt64(); break; case NetProtocols.ROOM_WAIT: time = reader.ReadSInt64(); break; case NetProtocols.ROOM_PLAYER_DIE: sourceid = reader.ReadSInt64(); targetid = reader.ReadSInt64(); break; case NetProtocols.ROOM_SHOW_RAND_ITEM: item = InGameItem.Deserialize(reader); break; case NetProtocols.ROOM_GET_RAND_ITEM: item = InGameItem.Deserialize(reader); break; case NetProtocols.ROOM_USE_ITEM: item = InGameItem.Deserialize(reader); targetid = reader.ReadSInt64(); break; case NetProtocols.ROOM_PLAYER_LIFE: uid = reader.ReadSInt64(); life = reader.ReadSInt32(); break; } }