public void RemoveOnClickListener(string buttonName, InputEventHandle <InputUIOnClickEvent> callback, string parm = null) { InputButtonClickRegisterInfo info = GetClickRegisterInfo(buttonName, callback, parm); m_OnClickEvents.Remove(info); info.RemoveListener(); }
public void AddOnClickListenerByCreate(Button button, string compName, InputEventHandle <InputUIOnClickEvent> callback, string parm = null) { InputButtonClickRegisterInfo info = InputUIEventProxy.GetOnClickListener(button, UIEventKey, compName, parm, callback); info.AddListener(); m_OnClickEvents.Add(info); }
public void AddOnClickListener(string buttonName, InputEventHandle <InputUIOnClickEvent> callback, string parm = null) { InputButtonClickRegisterInfo info = InputUIEventProxy.GetOnClickListener(GetButton(buttonName), UIEventKey, buttonName, parm, callback); info.AddListener(); m_OnClickEvents.Add(info); }
public static InputButtonClickRegisterInfo GetOnClickListener(Button button, string UIName, string ComponentName, string parm, InputEventHandle <InputUIOnClickEvent> callback) { InputButtonClickRegisterInfo info = HeapObjectPool <InputButtonClickRegisterInfo> .GetObject(); info.eventKey = InputUIOnClickEvent.GetEventKey(UIName, ComponentName, parm); info.callBack = callback; info.m_button = button; info.m_OnClick = () => { DispatchOnClickEvent(UIName, ComponentName, parm); }; return(info); }
//TODO 逐步添加所有的移除监听方法 public InputButtonClickRegisterInfo GetClickRegisterInfo(string buttonName, InputEventHandle <InputUIOnClickEvent> callback, string parm) { string eventKey = InputUIOnClickEvent.GetEventKey(UIEventKey, buttonName, parm); for (int i = 0; i < m_OnClickEvents.Count; i++) { InputButtonClickRegisterInfo info = (InputButtonClickRegisterInfo)m_OnClickEvents[i]; if (info.eventKey == eventKey && info.callBack == callback) { return(info); } } throw new Exception("GetClickRegisterInfo Exception not find RegisterInfo by " + buttonName + " parm " + parm); }
public static InputEventRegisterInfo <InputUIOnClickEvent> AddOnClickListener(Button button, string UIName, string ComponentName, string parm, InputEventHandle <InputUIOnClickEvent> callback) { InputButtonClickRegisterInfo info = new InputButtonClickRegisterInfo(); info.eventKey = InputUIOnClickEvent.GetEventKey(UIName, ComponentName, parm); info.callBack = callback; info.m_button = button; info.m_OnClick = () => { DispatchClickEvent(UIName, ComponentName, parm); }; info.AddListener(); button.onClick.AddListener(info.m_OnClick); return(info); }