Files
tianrunCRM/Assets/CoolapeFrame/Scripts/ui/form/CLUIElementPopList.cs

46 lines
1.0 KiB
C#
Raw Normal View History

2020-07-04 14:41:25 +08:00
using UnityEngine;
using System.Collections;
using Coolape;
2020-07-18 21:12:14 +08:00
using System.Collections.Generic;
2020-07-04 14:41:25 +08:00
[RequireComponent (typeof(UIPopupList))]
public class CLUIElementPopList : UIEventListener
{
UIPopupList _poplist;
2020-07-18 21:12:14 +08:00
public List<EventDelegate> onSelect = new List<EventDelegate>();
2020-07-04 14:41:25 +08:00
2020-07-18 21:12:14 +08:00
protected void ExecuteOnChange()
{
if (EventDelegate.IsValid(onSelect))
{
EventDelegate.Execute(onSelect, gameObject); // modify by chenbin
}
}
2020-07-04 14:41:25 +08:00
public UIPopupList poplist {
get {
if (_poplist == null) {
_poplist = GetComponent<UIPopupList> ();
_poplist.enabled = false;
}
return _poplist;
}
}
public void OnClick ()
{
ArrayList values = new ArrayList ();
values.AddRange (poplist.valueItems);
if (poplist.items.Count == 0) {
2020-07-10 13:22:24 +08:00
//CLAlert.add (Localization.Get ("EmpyContent"), Color.white, 1, 1, false, Vector3.zero);
2020-07-04 14:41:25 +08:00
}
CLUIPopListPanel.show (poplist.items, values, (Callback)onSelectedValue);
}
void onSelectedValue (params object[] orgs)
{
string val = orgs [1].ToString ();
poplist.value = val;
2020-07-18 21:12:14 +08:00
ExecuteOnChange();
2020-07-04 14:41:25 +08:00
}
}