天津23维预案
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.
 
 
 
 
 
 

46 lines
1.0 KiB

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class DayMessage : MonoBehaviour {
// Use this for initialization
public int day;
public GameObject background;
public GameObject Lable;
private Text dayName;
void Awake ()
{
dayName = transform.Find("Label").GetComponent<Text>();
}
void Start()
{
GetComponent<Toggle>().onValueChanged.AddListener(selectDay);
}
void OnDestroy()
{
GetComponent<Toggle>().onValueChanged.RemoveListener(selectDay);
}
// Update is called once per frame
void Update () {
}
public void setDay(int day)
{
this.day = day;
dayName.text = day.ToString();
}
void selectDay(bool isOn)
{
if (isOn)
{
transform.parent.parent.parent.GetComponent<DateTimeControl>().dayChanged(day);
}
}
public void setActive(bool flag)
{
background.SetActive(flag);
Lable.SetActive(flag);
GetComponent<Toggle>().enabled = flag;
}
}