public virtual void HideWindow() { if (WindowRoot != null) { if (WindowRoot.activeSelf) {//当前窗口是显示状态 if (GlobalEnvironment.Singleton.IsInCallbackOrTrigger) { DelegateCoroutine.CallStartCoroutine(WindowRoot, HideWindowImpl()); return; } WindowRoot.SetActive(false); } OnHideWindow(); if (JoystickMap != null) { JoystickMap.OnDestroy(); } } else { m_cacheStatus |= CachedStatus.Visible; m_cacheVisiable = false; } }
public void SetParent(Transform t) { if (WindowRoot != null) { WindowRoot.transform.parent = t; } else { m_cacheParent = t; m_cacheStatus |= CachedStatus.Parent; } }
public void SetRootName(string name) { if (WindowRoot != null) { WindowRoot.transform.name = name; } else { m_cacheStatus |= CachedStatus.Name; m_cacheName = name; } }
public void SetLocalScale(Vector3 scale) { if (WindowRoot != null) { WindowRoot.transform.localScale = scale; } else { m_cacheStatus |= CachedStatus.Scale; m_cacheScale = scale; } }
public void SetLocalPosition(Vector3 pos) { if (WindowRoot != null) { WindowRoot.transform.localPosition = pos; } else { m_cacheStatus |= CachedStatus.Position; m_cachePositon = pos; } }
IEnumerator HideWindowImpl() { yield return(new WaitForEndOfFrame()); if (WindowRoot != null) { WindowRoot.SetActive(false); OnHideWindow(); } else { m_cacheStatus |= CachedStatus.Visible; m_cacheVisiable = false; } }
public virtual void ShowWindow() { if (WindowRoot != null) { WindowRoot.SetActive(true); OnShowWindow(); if (JoystickMap != null && WindowRoot.activeInHierarchy) { JoystickMap.OnEnable(); } } else { m_cacheStatus |= CachedStatus.Visible; m_cacheVisiable = true; } }
public void OnLoaded() { if ((m_cacheStatus & CachedStatus.Parent) != 0) { Vector3 pos = WindowRoot.transform.localPosition; SetParent(m_cacheParent); m_cacheParent = null; WindowRoot.transform.localScale = Vector3.one; WindowRoot.transform.localPosition = pos; } OnInit(); AttachEvent(); if ((m_cacheStatus & CachedStatus.Visible) != 0) { if (m_cacheVisiable) { ShowWindow(); } else { HideWindow(); } } if ((m_cacheStatus & CachedStatus.Position) != 0) { SetLocalPosition(m_cachePositon); } if ((m_cacheStatus & CachedStatus.Scale) != 0) { SetLocalScale(m_cacheScale); } if ((m_cacheStatus & CachedStatus.Name) != 0) { SetRootName(m_cacheName); } m_cacheStatus = CachedStatus.None; if (IsAutoMapJoystick) { JoystickMap = new JoystickAutoMapUI(); JoystickMap.Init(this); } }