public void RESPONSE_LEAVE_LOBBY_OTHER_PLAYER(TcpPacket packet) { if (packet.header.extra == (int)EXTRA.FOR_LOGOUT) { SERVERtoCLIENT_LeaveLobbyOtherPlayerPacketData recvData = new SERVERtoCLIENT_LeaveLobbyOtherPlayerPacketData(); recvData.Deserialize(packet); GameObject chatText = Resources.Load("Prefabs/Chatting Text") as GameObject; Text createdChatText = Instantiate(chatText).GetComponent <Text>(); createdChatText.text = "[Server] : " + recvData.playerName + "님이 로그아웃하였습니다."; createdChatText.color = Color.blue; RectTransform chatPanel = GameObject.Find("Content").GetComponent <RectTransform>(); createdChatText.GetComponent <RectTransform>().SetParent(chatPanel); chatPanel.sizeDelta = new Vector2(0, chatPanel.sizeDelta.y + 30); chatPanel.anchoredPosition = new Vector2(0, chatPanel.anchoredPosition.y + 30); LobbyManager.Instance.RemoveLobbyPlayer(recvData.playerName); } else if (packet.header.extra == (int)EXTRA.FOR_JOIN_ROOM) { SERVERtoCLIENT_JoinRoomOtherPlayerPacketData recvData = new SERVERtoCLIENT_JoinRoomOtherPlayerPacketData(); recvData.Deserialize(packet); LobbyManager.Instance.RemoveLobbyPlayer(recvData.playerID); } }
public void RESPONSE_JOIN_ROOM_OTHER_PLAYER(TcpPacket packet) { if (packet.header.extra == (int)EXTRA.SUCCESS) { SERVERtoCLIENT_JoinRoomOtherPlayerPacketData recvData = new SERVERtoCLIENT_JoinRoomOtherPlayerPacketData(); recvData.Deserialize(packet); if (GameFramework.Instance.MyPlayer.State == PLAYER_STATE.LOBBY) { //내가 Lobby에 있을때 다른사람이 Room으로 들어갔으므로 오른쪽 유저 리스트에 해당 유저를 지워야 함 LobbyManager.Instance.RemoveLobbyPlayer(recvData.playerID); //해당 방에 사람이 들어갔으므로 방 참여자수 1 증가 RoomButton roomButton = RoomManager.Instance.GetRoomButton(recvData.roomKey); if (roomButton != null) { roomButton.IncreaseRoomJoinCount(); } } else if (GameFramework.Instance.MyPlayer.State == PLAYER_STATE.IN_ROOM) { //내가 Room에 있을때 다른사람이 Room에서 들어왔으므로 방에 해당 유저를 추가해야 함 string chatMessage = "[Server] : " + recvData.playerID + "님이 방에 입장하였습니다."; RoomGUI.Instance.ShowChatMessage(chatMessage, Color.red); Player player = new OtherPlayer(); player.Initialize(); player.PlayerID = recvData.playerID; RoomPlayer roomPlayer = RoomManager.Instance.CreateRoomPlayer(player); roomPlayer.readyState = false; roomPlayer.isLeader = false; RoomManager.Instance.EnteredRoom.PushRoomPlayer(roomPlayer); RoomGUI.Instance.UpdateRoomPlayerUIElement(RoomManager.Instance.EnteredRoom); } } }