Пример #1
0
 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);
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
 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));
     }
 }