void Update() { if (hostController != null) { hostController.Run(); } if (isGameStart == false) { maxPlayer = hostController.GetMaxUser(); for (int i = 0; i < 6; i++) { if (i < playerCount) { if (playerNumber[i].activeSelf == false) { playerNumber[i].SetActive(true); Camera.main.GetComponent <AudioSource>().PlayOneShot(numberSound); } UXUserController userController = UXUserController.Instance; UXUser user = (UXUser)userController.GetAt(i); if (user.GetLobbyState() == UXUser.LobbyState.Ready) { playerNumber[i].GetComponentInChildren <SpriteRenderer>().sprite = playerNumberOn[i]; connectedUser[i] = true; } else { playerNumber[i].GetComponentInChildren <SpriteRenderer>().sprite = playerNumberOff[i]; connectedUser[i] = false; } } else { playerNumber[i].SetActive(false); } } } if (Input.GetKeyDown(KeyCode.Escape) == true) { // PopupManager.Instance().OpenPopup(POPUP_TYPE.POPUP_EXITCONFIRM); } /* * if(freeLabel != null) { * if (UXHostController.room.IsPremium) { * freeLabel.SetActive (false); * } else { * freeLabel.SetActive (true); * } * } */ }
void Start() { if (Screen.orientation == ScreenOrientation.LandscapeRight) { Screen.orientation = ScreenOrientation.LandscapeRight; } else { Screen.orientation = ScreenOrientation.Landscape; } Screen.SetResolution(1920, 1080, true); Debug.Log("LobbyHost Start : " + BS_LogoViewer.BuildType.ToString()); screenLog(BS_LogoViewer.BuildType.ToString()); hostController = UXHostController.Instance; screenLog("IsConnect : " + hostController.IsConnected()); if (hostController.IsConnected() == true) { if (UXHostController.GetRoomNumber() != -1) { UXHostController.SetRoomNumber(-1); } hostController.Clear(); } int launcherCode = -1; bool result = hostController.SetCode(launcherCode); if (result == false) { hostController.CreateRoom(GAME_PACKAGE_NAME, hostController.GetMaxUser()); Debug.Log("Room NUM : " + UXHostController.GetRoomNumberString()); roomNumberTxt.text = UXHostController.GetRoomNumberString() + ""; screenLog("ROOM INFO : " + UXConnectController.ROOM_SERVER_IP + ", " + UXConnectController.ROOM_SERVER_PORT); screenLog(UXHostController.GetRoomNumberString()); } else { #if UNITY_ANDROID && !UNITY_EDITOR int country = androidManager.GetCountryCode(); PlayerPrefs.SetInt("ServerList", country); #endif roomNumberTxt.text = UXHostController.GetRoomNumberString() + ""; } hostController.OnConnected += OnConnected; hostController.OnConnectFailed += OnConnected; hostController.OnJoinFailed += OnJoinFailed; hostController.OnJoinSucceeded += OnJoinSucceeded; hostController.OnDisconnected += OnDisconnected; hostController.OnUserAdded += OnUserAdded; hostController.OnUserRemoved += OnUserRemoved; hostController.OnNetworkReported += OnNetworkReported; hostController.OnUserNetworkReported += OnUserNetworkReported; hostController.OnUserLobbyStateChanged += OnUserLobbyStateChanged; hostController.OnAutoCountChanged += OnAutoCountChanged; hostController.OnUpdateReadyCount += OnUpdateReadyCount; hostController.OnUserLeavedInGame += OnUserLeaved; hostController.OnGameStart += OnGameStart; hostController.OnGameRestart += OnGameRestart; hostController.OnGameResult += OnGameResult; hostController.OnIndexChanged += OnIndexChanged; hostController.OnUserListReceived += OnUserListReceived; hostController.OnGameEnd += OnGameEnd; hostController.OnExit += OnExit; hostController.OnAckFailed += OnAckFailed; //========================================== hostController.OnHostJoined += OnHostJoined; hostController.OnError += OnError; hostController.OnReceived += OnReceived; //========================================== hostController.OnHostDisconnected += hostController_OnHostDisconnected; hostController.OnJoinPremiumUser += OnJoinPremiumUser; hostController.OnLeavePremiumUser += OnLeavePremiumUser; hostController.SetAutoStart(2, 1); if (result == false) { hostController.SetMaxUser(2); // for GOOGLE freeLabel.SetActive(true); } else { hostController.SetMaxUser(2); // for GOOGLE freeLabel.SetActive(true); } PopupManager_RaS.IsFreeSetter(true); hostController.Connect(); maxPlayer = hostController.GetMaxUser(); Debug.Log("Max Player : " + maxPlayer); for (int i = 0; i < playerNumber.Length; i++) { playerNumber[i].SetActive(false); } Debug.Log("LobbyHost :: " + selectedPlayerCharacter.Length); for (int i = 0; i < selectedPlayerCharacter.Length; i++) { selectedPlayerCharacter[i] = (int)CHARACTER_TYPE.CHARACTER_NONE; } #if UNITY_ANDROID && !UNITY_EDITOR StartCoroutine(PlayIntroVideo()); #endif // blackOut.SetActive(false); iTween.MoveTo(Camera.main.gameObject, new Vector3(0, 0, -10), 4.0f); }