31 lines
735 B
C#
31 lines
735 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class MultiplayerToggle : MonoBehaviour
|
|
{
|
|
private Toggle toggle;
|
|
|
|
public Text text;
|
|
|
|
public Toggle createTournamentToggle;
|
|
|
|
public GameObject tournamentSettings;
|
|
|
|
private void OnEnable()
|
|
{
|
|
toggle = GetComponent<Toggle>();
|
|
UpdateValue();
|
|
}
|
|
|
|
public void UpdateValue()
|
|
{
|
|
if ((bool)GlobalSettings.Instance && (bool)GlobalSettings.Instance.levelsManager)
|
|
{
|
|
tournamentSettings.SetActive(!toggle.isOn);
|
|
createTournamentToggle.gameObject.SetActive(toggle.isOn);
|
|
GlobalSettings.Instance.levelsManager.isMultiplayer = toggle.isOn;
|
|
text.color = new Color(text.color.r, text.color.g, text.color.b, (!toggle.interactable) ? toggle.colors.disabledColor.a : 1f);
|
|
}
|
|
}
|
|
}
|