Files
tianrunCRM/Assets/trCRM/Scripts/ui/CLUICheckbox.cs
2020-07-04 14:41:25 +08:00

73 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Coolape;
public class CLUICheckbox : CLUIElement
{
public bool isMultMode = true;
object data;
//ArrayList checkeds = new ArrayList();
string _value = "";
public List<EventDelegate> onChange = new List<EventDelegate>();
public void init(object data)
{
this.data = data;
}
protected void ExecuteOnChange()
{
if (EventDelegate.IsValid(onChange))
{
EventDelegate.Execute(onChange, gameObject); // modify by chenbin
}
}
public void OnClick()
{
CLPanelManager.getPanelAsy("PanelPopCheckBoxs", (Callback)onGetPanel);
}
void onGetPanel(params object[] obj)
{
CLPanelLua p = (CLPanelLua)(obj[0]);
ArrayList orgs = new ArrayList();
orgs.Add(data);
orgs.Add(value);
orgs.Add(isMultMode);
orgs.Add((Callback)onSelectedValue);
p.setData(orgs);
CLPanelManager.showTopPanel(p, true, true);
}
void onSelectedValue(params object[] orgs)
{
string val = orgs[0].ToString();
value = val;
}
public override object value
{
get
{
return _value;
}
set
{
_value = value.ToString();
ExecuteOnChange();
}
}
public override object getValue()
{
return value;
}
public override void setValue(object obj)
{
value = obj;
}
}