天津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.
 
 
 
 
 
 

42 lines
993 B

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class MonthDropDown : MonoBehaviour
{
// Use this for initialization
private Dropdown months;
void Awake()
{
months = GetComponent<Dropdown>();
setOptions();
}
void Start()
{
months.onValueChanged.AddListener(selectMonth);
}
void OnDestroy()
{
months.onValueChanged.RemoveListener(selectMonth);
}
// Update is called once per frame
void Update()
{
}
private void setOptions()
{
for (int i = 1; i <= 12; i++)
{
months.options.Add(new Dropdown.OptionData(i + "月"));
}
}
void selectMonth(int monthIndex)
{
//Debug.Log(year);
var optionDate = months.options[monthIndex].text;
var month = int.Parse(optionDate.Substring(0, optionDate.Length - 1));
transform.parent.parent.GetComponent<DateTimeControl>().monthChanged(month);
}
}