Files
tianrunCRM/Assets/CoolapeFrame/Scripts/ui/form/CLUIElementDate.cs
2020-07-24 22:12:55 +08:00

53 lines
1.2 KiB
C#

using UnityEngine;
using System.Collections;
using System;
using Coolape;
using System.Collections.Generic;
[RequireComponent (typeof(UIInput))]
public class CLUIElementDate : UIEventListener
{
public bool isSetTime = false;
public bool isDateRange = false;
public List<EventDelegate> onChange = new List<EventDelegate>();
UIInput _input;
public UIInput input {
get {
if (_input == null) {
_input = GetComponent<UIInput> ();
if (_input != null) {
_input.enabled = false;
}
}
return _input;
}
}
public void OnClick ()
{
//if (input != null && !string.IsNullOrEmpty (input.value)) {
// DateTime d = DateTime.Parse (input.value);
// CLUIFormUtl.showCalender (d.Year, d.Month, (Callback)onGetDate, isSetTime, isDateRange);
//} else {
// CLUIFormUtl.showCalender ((Callback)onGetDate, isSetTime, isDateRange);
//}
CLUIFormUtl.showCalender(input.value, (Callback)onGetDate, isSetTime, isDateRange);
}
public void onGetDate (params object[] paras)
{
input.value = paras [0].ToString ();
ExecuteOnChange();
}
protected void ExecuteOnChange()
{
if (EventDelegate.IsValid(onChange))
{
EventDelegate.Execute(onChange, gameObject); // modify by chenbin
}
}
}