public void SetData(UIPhotonWaitingRoom room, Player player) { Room = room; Player = player; PlayerState state = (PlayerState)SimplePhotonNetworkManager.Singleton.GetRoomPlayerProperty(SimplePhotonNetworkManager.CUSTOM_PLAYER_STATE, player, (byte)PlayerState.NotReady); if (textPlayerName != null) { textPlayerName.text = player.NickName; } if (textPlayerState != null) { switch (state) { case PlayerState.Ready: textPlayerState.text = playerStateReady; break; case PlayerState.NotReady: textPlayerState.text = playerStateNotReady; break; } } foreach (var hostObject in hostObjects) { hostObject.SetActive(room.HostPlayerID == player.UserId); } foreach (var owningObject in owningObjects) { owningObject.SetActive(PhotonNetwork.LocalPlayer.UserId == player.UserId); } }
public void SetData(UIPhotonWaitingRoom room, PhotonPlayer data) { Room = room; Data = data; PlayerState state = PlayerState.NotReady; if (data.CustomProperties.ContainsKey(SimplePhotonNetworkManager.CUSTOM_PLAYER_STATE)) { state = (PlayerState)(byte)data.CustomProperties[SimplePhotonNetworkManager.CUSTOM_PLAYER_STATE]; } if (textPlayerName != null) { textPlayerName.text = data.NickName; } if (textPlayerState != null) { switch (state) { case PlayerState.Ready: textPlayerState.text = playerStateReady; break; case PlayerState.NotReady: textPlayerState.text = playerStateNotReady; break; } } foreach (var hostObject in hostObjects) { hostObject.SetActive(room.HostPlayerID.Equals(data.UserId)); } foreach (var owningObject in owningObjects) { owningObject.SetActive(PhotonNetwork.player.UserId.Equals(data.UserId)); } }