void OnDisable() { UIEventSystem.UnregisterTriggerMain(this); if (m_UseInputModule) { InputModule inputModule = UIEventSystem.inputModuleMain; if (inputModule != null) { inputModule.playersChangedEvent -= OnInputModulePlayersChangedEvent; } } }
void OnEnable() { if (m_UseInputModule) { InputModule inputModule = UIEventSystem.inputModuleMain; if (inputModule != null) { inputModule.playersChangedEvent += OnInputModulePlayersChangedEvent; RefreshPlayers(); } } UIEventSystem.RegisterTriggerMain(this); }
public static void RemoveFocusFrom(GameObject i_Root) { if (i_Root == null) { return; } GameObject currentFocus = UIEventSystem.focusMain; if (currentFocus != null) { if (i_Root.transform.HasChild(currentFocus)) { UIEventSystem.SetFocusMain(null); } } }
private void Internal_SetupEntries() { Internal_ClearEntries(); int triggersCount = UIEventSystem.triggersCountMain; for (int index = 0; index < triggersCount; ++index) { UIEventTrigger trigger = UIEventSystem.GetUIEventTriggerMain(index); if (trigger == null) { continue; } OnTriggerAdded(trigger); } GameObject currentFocus = UIEventSystem.focusMain; OnFocusChanged(null, currentFocus); }
// INTERNALS private IEnumerator ShowView() { m_IsCoroutineRunning = true; yield return(null); SetRootActive(true); MoveOutView(); yield return(null); MoveInView(); if (m_Animator != null) { m_Animator.SetBool(s_OpenBoolId, true); yield return(null); AnimatorClipInfo[] animatorClipsInfo = m_Animator.GetCurrentAnimatorClipInfo(0); if (animatorClipsInfo != null && animatorClipsInfo.Length > 0) { AnimatorClipInfo animatorClipInfo = animatorClipsInfo[0]; AnimationClip clip = animatorClipInfo.clip; if (clip != null) { if (clip.length > 0f) { AnimatorStateInfo animatorStateInfo = m_Animator.GetCurrentAnimatorStateInfo(0); float normalizedTime = animatorStateInfo.normalizedTime; while (normalizedTime < 1f) { yield return(null); animatorStateInfo = m_Animator.GetCurrentAnimatorStateInfo(0); normalizedTime = animatorStateInfo.normalizedTime; } } } } } EnableCanvasGroup(); m_IsOpen = true; UI.ActivateEventTriggers(gameObject); GameObject focusGo = GetFocusGameObject(gameObject); if (focusGo != null) { UIEventSystem.SetFocusMain(focusGo); } OnEnter(); m_IsCoroutineRunning = false; Callback(); }