private void LoadImage(int childNumber, EAccept opinion) { Image image = _waitingForOtherPlayer.transform.GetChild(childNumber).GetComponent <Image>(); switch (opinion) { case EAccept._waiting: image.sprite = Resources.Load <Sprite>("PortalAccept_wait") as Sprite; break; case EAccept._accept: image.sprite = Resources.Load <Sprite>("T_12_ok_") as Sprite; break; case EAccept._cancle: image.sprite = Resources.Load <Sprite>("T_11_no_") as Sprite; break; } }
public void SetPortalUseSelect(int playerNumber, EAccept opinion) { if (opinion != EAccept._waiting && _playerAccepts[playerNumber] != EAccept._waiting) { return; } _playerAccepts[playerNumber] = opinion; LoadImage(playerNumber, opinion); if (opinion == EAccept._accept) { _acceptCount++; if (Network.CTcpClient.instance != null) { var packet = Network.CPacketFactory.CreatePortalVote(0); Network.CTcpClient.instance.Send(packet.data); } // 싱글 / 멀티 플레이용 확인 if (CPlayerCommand.instance.activePlayersCount <= _acceptCount) { Debug.Log("Go Next Room"); CPortalManager portalManager = GameObject.Find("PortalManager").GetComponent <CPortalManager>(); SetActivePortalPopup(false); portalManager.MoveToNextRoom(); ResetPortalUseSelect(); } } else if (opinion == EAccept._cancle) { // 취소 처리하고 몇 초 있다가 복구 Invoke("CancelPortal", 3.0f); if (Network.CTcpClient.instance != null) { var packet = Network.CPacketFactory.CreatePortalVote(1); Network.CTcpClient.instance.Send(packet.data); } } }