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.
48 lines
1.1 KiB
48 lines
1.1 KiB
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>(); |
|
toggle.group = transform.parent.GetComponent<ToggleGroup>(); |
|
toggle.onValueChanged.AddListener(PageSelected); |
|
text = GetComponent<Text>(); |
|
} |
|
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; |
|
} |
|
} |
|
}
|
|
|