You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

45 lines
938 B

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;
}
}