Example #1
0
    private void UpdateDisplay()
    {
        if (!hasAuthority)
        {
            for (int i = 0; i < Room.roomPlayers.Count; i++)
            {
                if (Room.roomPlayers[i].hasAuthority)
                {
                    Room.roomPlayers[i].UpdateDisplay();
                    break;
                }
            }

            return;
        }

        for (int i = 0; i < _playerNameTexts.Length; i++)
        {
            _playerNameTexts[i].text         = "Waiting for player...";
            _playerReadyTexts[i].text        = string.Empty;
            _playerCharacterImages[i].sprite = null;
        }

        for (int i = 0; i < Room.roomPlayers.Count; i++)
        {
            _playerNameTexts[i].text  = Room.roomPlayers[i].displayName;
            _playerReadyTexts[i].text = Room.roomPlayers[i].isReady ?
                                        "<color=green>Ready</color>" :
                                        "<color=red>Not Ready</color>";
            if (Room.roomPlayers[i].characterIndex > -1)
            {
                Image charImage = _characterSelection.GetCharacterOptions()[Room.roomPlayers[i].characterIndex].transform.GetChild(0).GetComponent <Image>();
                _playerCharacterImages[i].sprite = charImage.sprite;
            }
        }
    }