void UpdateTeamUi() { RoomInfo roomInfo = PhotonNetwork.CurrentRoom; CustomGameRoomData gameRoomData = CustomGameRoomData.GetCustomGameRoomData(roomInfo); if (gameRoomData._multiPlayMode == MultiPlayMode.Free) { _teamUi.SetActive(false); } else { _teamUi.SetActive(true); } }
public void UpdateContents(int index, RoomInfo roomInfo) { CustomGameRoomData gameRoomData = CustomGameRoomData.GetCustomGameRoomData(roomInfo); _index.text = (index + 1).ToString(); _mode.text = gameRoomData._multiPlayMode.ToString(); _roomName.text = roomInfo.Name; _creator.text = gameRoomData._roomCreator; _playersNumber.text = roomInfo.PlayerCount + "/" + roomInfo.MaxPlayers; _gameState.text = gameRoomData._roomState.ToString(); _lockUI.SetActive(gameRoomData._privateRoom); _curRoomInfo = roomInfo; }
public void UpdateRoomInfo(RoomInfo roomInfo, int playerCount) { _selectRoomUi.SetActive(true); _roomName.text = roomInfo.Name; CustomGameRoomData gameRoomData = CustomGameRoomData.GetCustomGameRoomData(roomInfo); _gameMode.text = gameRoomData._multiPlayMode.ToString(); _playerCount.text = playerCount + "/" + roomInfo.MaxPlayers; _togglePrivate.isOn = gameRoomData._privateRoom; _passwordWindow.SetActive(_togglePrivate.isOn); _targetPassword = gameRoomData._password; _uiCreatorName.text = gameRoomData._roomCreator; _roomState.text = gameRoomData._roomState.ToString(); _sceneName.text = gameRoomData._sceneName; }
public static CustomGameRoomData GetCustomGameRoomData(RoomInfo roomInfo) { var data = new CustomGameRoomData(); if (roomInfo == null) { return(data); } data._multiPlayMode = (MultiPlayMode)((int)roomInfo.CustomProperties[PropertyKey.GameMode]); data._maxPlayerCount = (int)((byte)roomInfo.CustomProperties[PropertyKey.MaxExpectedPlayer]); data._privateRoom = ((bool)roomInfo.CustomProperties[PropertyKey.IsPrivateRoom]); data._password = ((string)roomInfo.CustomProperties[PropertyKey.Password]); data._roomCreator = ((string)roomInfo.CustomProperties[PropertyKey.RoomCreator]); data._sceneName = ((string)roomInfo.CustomProperties[PropertyKey.SceneName]); data._roomState = (RoomState)((int)roomInfo.CustomProperties[PropertyKey.RoomState]); return(data); }
void UpdatePlayersInfo() { for (int i = 0; i < playerList.Count; ++i) { playerList[i].GetComponent <PlayerHP>().UpdateHp(); } var gameRoomInfo = CustomGameRoomData.GetCustomGameRoomData(PhotonNetwork.CurrentRoom); for (int i = 0; i < playerList.Count; ++i) { if (playerList[i]._photonView.Owner == PhotonNetwork.LocalPlayer) { playerList[i].gameObject.layer = LayerMask.NameToLayer("TeamPlayer"); } else { if (gameRoomInfo._multiPlayMode == MultiPlayMode.Team) { if (playerList[i]._photonView.Owner.GetTeam() == PhotonNetwork.LocalPlayer.GetTeam()) { playerList[i].gameObject.layer = LayerMask.NameToLayer("TeamPlayer"); } else { playerList[i].gameObject.layer = LayerMask.NameToLayer("EnemyPlayer"); } } else { playerList[i].gameObject.layer = LayerMask.NameToLayer("EnemyPlayer"); } } } }
public bool IsSameScene() { var gameRoomInfo = CustomGameRoomData.GetCustomGameRoomData(PhotonNetwork.CurrentRoom); return(SceneManager.GetActiveScene().name == gameRoomInfo._sceneName); }