//处理更新房间信息 public void DealUpdateRoomListRS(SockGetRoomListResponse resp) { SockRoomInfo[] rooms = resp.data.rooms; switch (resp.data.type) { case 3: //删除 for (int i = 0; i < rooms.Length; i++) { m_roomListUI.DelRoom(rooms [i]); } break; case 2: //更新 for (int i = 0; i < resp.data.rooms.Length; i++) { m_roomListUI.UpdateRoom(rooms [i]); } break; case 1: //添加 for (int i = 0; i < resp.data.rooms.Length; i++) { m_roomListUI.AddRoom(rooms [i]); } break; } }
//处理更新房间信息 public void DealUpdateRoomListRS(SockGetRoomListResponse resp) { SockRoomInfo[] rooms = resp.data.rooms; switch (resp.data.type) { case 3: //删除 for (int i = 0; i < rooms.Length; i++) { if (m_dicRoomList.ContainsKey(rooms [i].roomId)) { m_dicRoomList.Remove(rooms [i].roomId); } } break; case 2: //更新 for (int i = 0; i < resp.data.rooms.Length; i++) { if (m_dicRoomList.ContainsKey(rooms [i].roomId)) { m_dicRoomList [rooms [i].roomId] = rooms [i]; } else { m_dicRoomList.Add(rooms [i].roomId, rooms [i]); } } break; case 1: //添加 for (int i = 0; i < resp.data.rooms.Length; i++) { if (!m_dicRoomList.ContainsKey(rooms [i].roomId)) { m_dicRoomList.Add(rooms [i].roomId, rooms [i]); } else { m_dicRoomList [rooms [i].roomId] = rooms [i]; } } break; } }