/// <summary> /// 移除点击事件处理 /// </summary> /// <param name="obj"></param> public void RemoveClickHandler(GameObject obj) { if (m_ClickHandlerDic.ContainsKey(obj)) { m_ClickHandlerDic.Remove(obj); } UIEventLisner lisner = obj.AddComponent <UIEventLisner>(); lisner.PointerClickHandler -= OnPointerClickHandler; }
/// <summary> /// 添加点击事件处理 /// </summary> /// <param name="obj"></param> /// <param name="onClick"></param> public void AddOnClickHandler(GameObject obj, OnClick onClick) { if (m_ClickHandlerDic.ContainsKey(obj)) { m_ClickHandlerDic.Remove(obj); } m_ClickHandlerDic.Add(obj, onClick); UIEventLisner lisner = obj.AddComponent <UIEventLisner>(); lisner.PointerClickHandler += OnPointerClickHandler; }