29 lines
622 B
C#
29 lines
622 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class PlayersSlider : MonoBehaviour
|
|
{
|
|
public Text text;
|
|
|
|
private Slider slider;
|
|
|
|
private void OnEnable()
|
|
{
|
|
slider = GetComponent<Slider>();
|
|
UpdateValue();
|
|
}
|
|
|
|
public void UpdateValue()
|
|
{
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
GlobalSettings.Instance.tournamentDefinition.nrOfPlayers = (int)slider.value;
|
|
}
|
|
if ((bool)text)
|
|
{
|
|
text.text = Utilities.GetTranslation("GUI/TOURNAMENTS_PLAYERS") + ": " + slider.value;
|
|
}
|
|
text.color = new Color(text.color.r, text.color.g, text.color.b, (!slider.interactable) ? slider.colors.disabledColor.a : 1f);
|
|
}
|
|
}
|