add
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
public class CLUIElementDate : UIEventListener
|
||||
{
|
||||
public bool isSetTime = false;
|
||||
public bool isDateRange = false;
|
||||
public List<EventDelegate> onChange = new List<EventDelegate>();
|
||||
UIInput _input;
|
||||
|
||||
@@ -25,13 +26,13 @@ public class CLUIElementDate : UIEventListener
|
||||
|
||||
public void OnClick ()
|
||||
{
|
||||
if (input != null && !string.IsNullOrEmpty (input.value)) {
|
||||
DateTime d = DateTime.Parse (input.value);
|
||||
// DateTime d = DateTime.ParseExact(input.value, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture);
|
||||
CLUIFormUtl.showCalender (d.Year, d.Month, (Callback)onGetDate, isSetTime);
|
||||
} else {
|
||||
CLUIFormUtl.showCalender ((Callback)onGetDate, isSetTime);
|
||||
}
|
||||
//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)
|
||||
|
||||
59
Assets/CoolapeFrame/Scripts/ui/form/CLUIElementTime.cs
Normal file
59
Assets/CoolapeFrame/Scripts/ui/form/CLUIElementTime.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System;
|
||||
using Coolape;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[RequireComponent (typeof(UIInput))]
|
||||
public class CLUIElementTime : UIEventListener
|
||||
{
|
||||
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 ()
|
||||
{
|
||||
Hashtable map = new Hashtable();
|
||||
map["time"] = input.value;
|
||||
map["callback"]= (Callback)onGetDate;
|
||||
CLPanelManager.getPanelAsy("PanelPopTime", (Callback)onGetCalenderPanel, map);
|
||||
}
|
||||
|
||||
public static void onGetCalenderPanel(params object[] orgs)
|
||||
{
|
||||
CLPanelBase p = orgs[0] as CLPanelBase;
|
||||
Hashtable map = orgs[1] as Hashtable;
|
||||
if (p == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
p.setData(map);
|
||||
CLPanelManager.showTopPanel(p, true, true);
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/CoolapeFrame/Scripts/ui/form/CLUIElementTime.cs.meta
Normal file
13
Assets/CoolapeFrame/Scripts/ui/form/CLUIElementTime.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3cdf5f2b8d8745a69ee31dc45d16005
|
||||
timeCreated: 1517308118
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -177,20 +177,13 @@ namespace Coolape
|
||||
/// <param name="paras">Paras.</param>
|
||||
public static void showCalender(params object[] paras)
|
||||
{
|
||||
if (paras != null && paras.Length >= 4)
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
list.Add(paras[0]);//year);
|
||||
list.Add(paras[1]);//month);
|
||||
list.Add(paras[2]);//callback);
|
||||
list.Add(paras[3]);//isSetTime);
|
||||
ArrayList list = new ArrayList();
|
||||
list.Add(paras[0]);//defaultDate);
|
||||
list.Add(paras[1]);//callback);
|
||||
list.Add(paras[2]);//isSetTime);
|
||||
list.Add(paras[3]);//isDateRange);
|
||||
|
||||
CLPanelManager.getPanelAsy("PanelCalender", (Callback)onGetCalenderPanel, list);
|
||||
}
|
||||
else
|
||||
{
|
||||
showCalender(System.DateTime.Now.Year, System.DateTime.Now.Month, paras[0], paras[1]);
|
||||
}
|
||||
CLPanelManager.getPanelAsy("PanelCalender", (Callback)onGetCalenderPanel, list);
|
||||
}
|
||||
|
||||
public static void onGetCalenderPanel(params object[] orgs)
|
||||
|
||||
Reference in New Issue
Block a user