public void UnregistClickEvent(string _targetName, CORE_ONCLICKED_CALLBACK _eventEntity) { try { CORE_ONCLICKED_CALLBACK _event = m_onClickedEventSet.GetEntity(_targetName); _event -= _eventEntity; } catch (Exception ex) { Debug.Log("点击事件注销出错 " + _targetName + " " + ex); } }
private void OnClicked() { GameObject _currentSelected = EventSystem.current.currentSelectedGameObject; if (_currentSelected) { CORE_ONCLICKED_CALLBACK _event = m_onClickedEventSet.GetEntity(_currentSelected.name); if (_event != null) { _event(); } } /// <summary> /// 修复unity5.4.2f版本按钮动画的bug /// </summary> EventSystem.current.SetSelectedGameObject(null); }
public void RegistClickEvent(string _targetName, CORE_ONCLICKED_CALLBACK _eventEntity) { try { CORE_ONCLICKED_CALLBACK _event = m_onClickedEventSet.GetEntity(_targetName); if (_event == null) { m_onClickedEventSet.Add(_targetName, _eventEntity); } else { _event += _eventEntity; } } catch (Exception ex) { this.DLog(string.Format("点击事件注册出错 {0} {1}", _targetName, ex)); } }