// 방 목록 갱신 private void InterpretRenewRoomList(Network.CPacket packet, int payloadSize) { Debug.Log("Renew Room"); DeleteAllRoomToListView(); rooms.Clear(); int roomCount = payloadSize / 24; if (payloadSize % 24 != 0) { Debug.Log("Room Renew Error!"); } Debug.LogFormat("Room Count : {0}", roomCount); for (int i = 0; i < roomCount; i++) { int rid = packet.ReadInt32(); int ucount = packet.ReadInt32(); string hname = packet.ReadString(16); Debug.Log("Room id = " + rid + " " + hname); rooms.Add(new Room(rid, ucount, hname)); } RenewRoomListView(); }
// 방 정보를 얻음 public static JoinRoom GetRoomInfo(int rid, Network.CPacket packet, int payloadSize) { int myslot = packet.ReadInt32(); int ucnt = packet.ReadInt32(); Debug.LogFormat("ucnt : ", ucnt); List <User> others = new List <User>(); int[] slots = new int[4]; int slot; int userCount = payloadSize / 24; for (int i = 0; i < userCount; i++) { string id = packet.ReadString(16); slot = packet.ReadInt32(); int clear = packet.ReadInt32(); others.Add(new User(id, clear, slot)); Debug.Log("CClientInfo - JoinRoom : A Slot is " + slot + " and id " + id); } ThisUser.Slot = myslot; return(new JoinRoom(rid, slots, others, false)); }
// 인원이 추가된 경우 private void InterpretAddGuest(Network.CPacket packet) { string id = packet.ReadString(16); int slot = packet.ReadInt32(); int clear = packet.ReadInt32(); AddGuest(id, slot, clear); }
private void InterpretRegisterSuccess(Network.CPacket packet) { int uid = packet.ReadInt32(); string id = packet.ReadString(16); int clear = packet.ReadInt32(); CClientInfo.ThisUser = new CClientInfo.User(uid, id, clear); var message = Network.CPacketFactory.CreateLobbyRequest(); _tcpManager.Send(message.data); }