public override void OnCreatedRoom() { Debug.Log("Created room successfully"); CreateRoomMenu.SetActive(false); JoiningRoomMenu.SetActive(true); BeginGameButton.SetActive(true); _currentRoomName.text = $"Current room: {PhotonNetwork.CurrentRoom.Name}"; }
void DrawActiveTab() { switch (m_ActiveTab) { case TabCategories.Matchmaking: MatchmakingMenu.Draw(); break; case TabCategories.RoomBrowser: RoomBrowserMenu.Draw(); break; case TabCategories.CreateRoom: CreateRoomMenu.Draw(); break; } }
public void onCreateRoomDone(RoomEvent eventObj) { CreateRoomMenu.Hide(); LoadingScreen.Hide(); if (eventObj.getResult() == 0) { WarpClient.GetInstance().SubscribeRoom(eventObj.getData().getId()); JoinRoomResultScreen.JoinResult = -2; JoinRoomResultScreen.Show(); JoinRoomResultScreen.TryAgain(eventObj.getData().getId()); CreateRoomResultMenu.Hide(); } else { CreateRoomResultMenu.Show(); CreateRoomResultMenu.CreateResult = 5; } Log("onCreateRoomDone : " + eventObj.getResult()); }
public override void OnJoinedRoom() { CreateRoomMenu.SetActive(false); JoiningRoomMenu.SetActive(true); _currentRoomName.text = $"Current room: {PhotonNetwork.CurrentRoom.Name}"; }
void OnGUI() { GUI.depth = 0; GUI.skin = RoomSelectionGUISkin; GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), Background); if (GUI.Button(new Rect(Screen.width / 25, Screen.height / 25, Properties.BackButtonSize, Properties.BackButtonSize), Properties.BackButton)) { Hide(); WarpClient.GetInstance().Disconnect(); LoginScreen.Show(); } scrollPosition = GUI.BeginScrollView(scrollViewPosition, scrollPosition, scrollViewInnerPosition); float offsetX = roomBoxPosition.x; float offsetY = roomBoxPosition.y; for (int i = 0; i < ActiveRooms.Count; i++) { LiveRoomInfoEvent currentRoom = ActiveRooms[i]; string[] joinedUsers = currentRoom.getJoinedUsers(); string roomId = currentRoom.getData().getId(); object type = string.Empty; object goal = string.Empty; object pw = string.Empty; selectedRoomProperties = currentRoom.getProperties(); selectedRoomProperties.TryGetValue("PW", out pw); if (selectedRoomProperties.TryGetValue("TYPE", out type) && selectedRoomProperties.TryGetValue("GOAL", out goal)) { string playersText = string.Empty; for (int j = 0; j < 4; j++) { if (j == 0 && joinedUsers != null) { playersText = joinedUsers[j]; } else if (j == 0) { playersText = "-"; } else if (joinedUsers != null && j < joinedUsers.Length) { playersText += "\n" + joinedUsers[j]; } else { playersText += "\n-"; } } if (selectedRoomId == roomId) { GUI.DrawTexture(new Rect(offsetX, offsetY, roomBoxPosition.width, roomBoxPosition.height), SelectedRoomBoxBackground); } else if (GUI.Button(new Rect(offsetX, offsetY, roomBoxPosition.width, roomBoxPosition.height), "")) { selectedRoomId = roomId; selectedRoomPw = pw == null ? null : pw.ToString(); } GUI.BeginGroup(new Rect(offsetX, offsetY, roomBoxPosition.width, roomBoxPosition.height)); DrawRoomBox(currentRoom.getData().getName(), type.ToString(), goal.ToString(), playersText, joinedUsers == null ? 0 : joinedUsers.Length, pw == null? null : pw.ToString()); GUI.EndGroup(); offsetX += offsetWidth / 2 + roomBoxPosition.width; if (i % 2 == 1) { offsetY += offsetHeight + roomBoxPosition.height; offsetX = roomBoxPosition.x; } } } GUI.EndScrollView(); if (GUI.Button(createRoomButtonPos, LanguageManager.getString("CRTROOM"))) { Hide(); CreateRoomMenu.Show(); } if (!string.IsNullOrEmpty(selectedRoomId) && GUI.Button(joinRoomButtonPos, LanguageManager.getString("JOINROOM"))) { if (selectedRoomPw != null && !string.IsNullOrEmpty(selectedRoomPw.ToString())) { PasswordEnterMenu.Show(selectedRoomPw.ToString(), selectedRoomId); Hide(); } else { StartCoroutine(JoinRoom(selectedRoomId)); } } if (GUI.Button(renewButtonPos, LanguageManager.getString("RENEW"))) { Renew(); } }