using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class PageIndex : MonoBehaviour { public int index; public Toggle toggle; public Text text; // Use this for initialization void Awake () { toggle = GetComponent(); toggle.group = transform.parent.GetComponent(); toggle.onValueChanged.AddListener(PageSelected); text = GetComponent(); } public void OnThisPage() { text.fontSize = 24; text.color = Color.cyan; } public int Index { set { index = value; text.text = value.ToString(); } get { return index; } } void PageSelected(bool isOn) { if (isOn) { PagesController.Instance.ApplyForPage(this.index); text.fontSize = 24; text.color = Color.cyan; } else { text.fontSize = 20; text.color = Color.white; } } }