using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using Networking.Server;
|
|
|
|
public class LeadPlayerUI : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private ClientList Clients;
|
|
|
|
[SerializeField]
|
|
private TMPro.TextMeshProUGUI ScoreText;
|
|
|
|
[SerializeField]
|
|
private Image ColorImage;
|
|
|
|
private void Awake()
|
|
{
|
|
UpdateScore();
|
|
}
|
|
|
|
public void UpdateScore()
|
|
{
|
|
if (Clients.Count() == 0)
|
|
{
|
|
ScoreText.gameObject.SetActive(false);
|
|
ColorImage.gameObject.SetActive(false);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
ScoreText.gameObject.SetActive(true);
|
|
ColorImage.gameObject.SetActive(true);
|
|
}
|
|
|
|
ClientData lead = Clients.maxBy(p => p.SceneScore);
|
|
ScoreText.text = lead.SceneScore.ToString();
|
|
ColorImage.color = lead.Color;
|
|
}
|
|
|
|
|
|
|
|
}
|