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.
36 lines
780 B
36 lines
780 B
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.UI;
|
||
|
public class QuestionPageMessage : MonoBehaviour {
|
||
|
|
||
|
// Use this for initialization
|
||
|
public int page;
|
||
|
void Start()
|
||
|
{
|
||
|
GetComponent<Toggle>().onValueChanged.AddListener(selectPage);
|
||
|
}
|
||
|
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
GetComponent<Toggle>().onValueChanged.RemoveListener(selectPage);
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public void setPage(int page)
|
||
|
{
|
||
|
this.page = page;
|
||
|
transform.Find("Label").GetComponent<Text>().text = page.ToString();
|
||
|
}
|
||
|
private void selectPage(bool isOn)
|
||
|
{
|
||
|
if (isOn)
|
||
|
{
|
||
|
transform.parent.GetComponent<QuestionPageControl>().selectPage(page);
|
||
|
}
|
||
|
}
|
||
|
}
|