private void OnPlayerNumberingChanged() { if (_player != null) { // we might be called before player is setup this.builtInPropsCellList["Player Number"].UpdateInfo("#" + _player.GetPlayerNumber().ToString("00")); } }
public void SetPlayerTarget(Realtime.Player player) { //Debug.Log("SetPlayerTarget " + player); this._player = player; ContentPanel.SetActive(true); NotInRoomLabel.SetActive(false); this.ResetList(); foreach (DictionaryEntry item in this.GetAllPlayerBuiltIntProperties()) { this.AddProperty(ParseKey(item.Key), item.Value.ToString(), this.BuiltInPropertiesPanel); } // PlayerNumbering extension this.AddProperty("Player Number", "#" + player.GetPlayerNumber().ToString("00"), this.PlayerNumberingExtensionPanel); // Score extension this.AddProperty(PunPlayerScores.PlayerScoreProp, player.GetScore().ToString(), this.ScoreExtensionPanel); foreach (DictionaryEntry item in _player.CustomProperties) { this.AddProperty(ParseKey(item.Key), item.Value.ToString(), this.CustomPropertiesPanel); } MasterClientToolBar.SetActive(PhotonNetwork.CurrentRoom.PlayerCount > 1 && PhotonNetwork.LocalPlayer.IsMasterClient); }
void UpdateInfo() { if (string.IsNullOrEmpty(_player.NickName)) { NameText.text = _player.ActorNumber.ToString(); } int _index = _player.GetPlayerNumber(); NumberText.text = "#" + _index.ToString("00"); // if this function was not called on every update, we would need to listen to the PlayerNumbering delegate NameText.text = _player.NickName; ActiveFlag.color = _player.IsInactive ? InactiveColor : ActiveColor; isLocalText.gameObject.SetActive(_player.IsLocal); isMasterFlag.gameObject.SetActive(_player.IsMasterClient); // reorder the list to match player number if (_index >= 0 && this.transform.GetSiblingIndex() != _index) { this.transform.SetSiblingIndex(_index + 1); } }