summaryrefslogtreecommitdiff
path: root/ROUNDS/DisplayMatchPlayerNames.cs
blob: 10e3cf59263bc355476934b95cd5659b1d5b83ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Collections.Generic;
using System.Linq;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;

public class DisplayMatchPlayerNames : MonoBehaviour
{
	public TextMeshProUGUI local;

	public TextMeshProUGUI other;

	public void ShowNames()
	{
		List<Photon.Realtime.Player> list = PhotonNetwork.CurrentRoom.Players.Select((KeyValuePair<int, Photon.Realtime.Player> p) => p.Value).ToList();
		bool flag = false;
		flag = PhotonNetwork.CurrentRoom.CustomProperties.ContainsKey(NetworkConnectionHandler.TWITCH_ROOM_AUDIENCE_RATING_KEY);
		for (int i = 0; i < list.Count; i++)
		{
			string text = (flag ? (" (" + list[i].CustomProperties[NetworkConnectionHandler.TWITCH_PLAYER_SCORE_KEY].ToString() + ")") : string.Empty);
			if (i == 0)
			{
				local.text = list[i].NickName + text;
			}
			else
			{
				other.text = list[i].NickName + text;
			}
		}
	}
}