public void RESPONSE_LOGIN(TcpPacket packet) { if (packet.header.extra == (int)EXTRA.SUCCESS) { SERVERtoCLIENT_LoginPacketData recvData = new SERVERtoCLIENT_LoginPacketData(); recvData.Deserialize(packet); GameFramework.Instance.MyPlayer.Login(recvData.playerID, recvData.playerKey); GameFramework.Instance.MyPlayer.State = PLAYER_STATE.LOBBY; SceneManager.LoadScene("Lobby"); } else if (packet.header.extra == (int)EXTRA.FAIL) { Debug.Log("INVALID ID & PASSWORD"); MessageBox messageBox = UIFactory.Instance.Create(UI_ELEMENT.MESSAGE_BOX).GetComponent <MessageBox>(); messageBox.Initialize(); messageBox.AttachUIElement(new Vector2(0, 50), LoginSceneGUI.Instance.loginGUI); messageBox.SetTitle("잘못된 ID, 또는 Password 입니다."); messageBox.AddConfirmEventFunc(LoginGUI.Instance.Release); } else if (packet.header.extra == (int)EXTRA.OVERLAPED_LOGIN) { Debug.Log("OVERLAPED LOGIN"); MessageBox messageBox = UIFactory.Instance.Create(UI_ELEMENT.MESSAGE_BOX).GetComponent <MessageBox>(); messageBox.Initialize(); messageBox.AttachUIElement(new Vector2(0, 50), LoginSceneGUI.Instance.loginGUI); messageBox.SetTitle("이미 접속되어 있습니다."); messageBox.AddConfirmEventFunc(LoginGUI.Instance.Release); } }
public void RESPONSE_CREATE_ROOM(TcpPacket packet) { if (packet.header.extra == (int)EXTRA.SUCCESS) { SERVERtoCLIENT_CreateRoomPacketData recvData = new SERVERtoCLIENT_CreateRoomPacketData(); recvData.Deserialize(packet); //LobbyManager.Instance.Release(); LobbySceneGUI.Instance.ChangeLobbyToRoom(); RoomPlayer roomPlayer = RoomManager.Instance.CreateRoomPlayer(GameFramework.Instance.MyPlayer); roomPlayer.isLeader = true; Room room = RoomManager.Instance.CreateRoom(recvData.roomName, recvData.roomKey, 1); room.PushRoomPlayer(new RoomPlayer[] { roomPlayer }); room.Enter(); RoomGUI.Instance.Initialize(room); RoomGUI.Instance.ChangeReadyToStartButton(); } else if (packet.header.extra == (int)EXTRA.FAIL) { Debug.Log("OVERLAPED ROOM NAME..."); MessageBox messageBox = UIFactory.Instance.Create(UI_ELEMENT.MESSAGE_BOX).GetComponent <MessageBox>(); messageBox.Initialize(); messageBox.AttachUIElement(new Vector2(0, 50), LobbySceneGUI.Instance.lobbyGUI); messageBox.SetTitle("중복된 방 이름입니다."); } }
public void ShowGameOver() { MessageBox messageBox = UIFactory.Instance.Create(UI_ELEMENT.MESSAGE_BOX).GetComponent <MessageBox>(); messageBox.Initialize(); messageBox.AttachUIElement(new Vector2(0, 50), gameObject); messageBox.SetTitle("Game Over!", "모든 사용자의 게임이 끝날때까지 기다리십시오."); }
public void RESPONSE_ROOM_START(TcpPacket packet) { if (packet.header.extra == (int)EXTRA.SUCCESS) { SERVERtoCLIENT_RoomStartPacketData recvData = new SERVERtoCLIENT_RoomStartPacketData(); recvData.Deserialize(packet); RoomManager.Instance.EnteredRoom.IsStartGame = true; GameFramework.Instance.EnterGameScene(recvData.gameKey); } else if (packet.header.extra == (int)EXTRA.FAIL) { MessageBox messageBox = UIFactory.Instance.Create(UI_ELEMENT.MESSAGE_BOX).GetComponent <MessageBox>(); messageBox.Initialize(); messageBox.AttachUIElement(new Vector2(0, 50), LobbySceneGUI.Instance.roomGUI); messageBox.SetTitle("모든 인원이 준비하지 않았습니다."); } }
public void RESPONSE_REGISTER_USER(TcpPacket packet) { if (packet.header.extra == (int)EXTRA.SUCCESS) { Debug.Log("SUCCESS REGISTER USER"); LoginSceneGUI.Instance.ChangeRegisterToLogin(); } else if (packet.header.extra == (int)EXTRA.FAIL) { Debug.Log("FAIL REGISTER USER"); MessageBox messageBox = UIFactory.Instance.Create(UI_ELEMENT.MESSAGE_BOX).GetComponent <MessageBox>(); messageBox.Initialize(); messageBox.AttachUIElement(new Vector2(0, 50), LoginSceneGUI.Instance.loginGUI); messageBox.SetTitle("중복된 ID입니다. 다시입력하세요."); messageBox.AddConfirmEventFunc(RegisterGUI.Instance.Release); } }
public void OnEnterRoom() { // if(room.isStart) 이런 식으로 해야 할것 같은데... if (waitingUIText.text == "게임 중 ...") //굉장히... 안좋아보임 { MessageBox messageBox = UIFactory.Instance.Create(UI_ELEMENT.MESSAGE_BOX).GetComponent <MessageBox>(); messageBox.Initialize(); messageBox.AttachUIElement(new Vector2(0, 50), LobbySceneGUI.Instance.lobbyGUI); messageBox.SetTitle("이미 게임중인 방입니다."); return; } CLIENTtoSERVER_JoinRoomPacketData data = new CLIENTtoSERVER_JoinRoomPacketData(); data.playerKey = GameFramework.Instance.MyPlayer.PlayerKey; data.roomKey = roomKey; NetworkManager.Instance.SendCommand((int)PROTOCOL.JOIN_ROOM, (int)EXTRA.REQUEST, data); }
public void OnLeaveRoom() { SoundManager.Instance.PlayUIButtonClick(); if (!RoomManager.Instance.MyPlayer.readyState) { CLIENTtoSERVER_LeaveRoomPacketData data = new CLIENTtoSERVER_LeaveRoomPacketData { playerKey = GameFramework.Instance.MyPlayer.PlayerKey, roomKey = RoomManager.Instance.EnteredRoom.RoomKey }; NetworkManager.Instance.SendCommand((int)PROTOCOL.LEAVE_ROOM, (int)EXTRA.REQUEST, data); } else { MessageBox messageBox = UIFactory.Instance.Create(UI_ELEMENT.MESSAGE_BOX).GetComponent <MessageBox>(); messageBox.Initialize(); messageBox.AttachUIElement(new Vector2(0, 50), LobbySceneGUI.Instance.roomGUI); messageBox.SetTitle("Ready를 해제하고 나가십시오."); } }