示例#1
0
 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;
     }
 }
示例#2
0
 public void SetParent(Transform t)
 {
     if (WindowRoot != null)
     {
         WindowRoot.transform.parent = t;
     }
     else
     {
         m_cacheParent  = t;
         m_cacheStatus |= CachedStatus.Parent;
     }
 }
示例#3
0
 public void SetRootName(string name)
 {
     if (WindowRoot != null)
     {
         WindowRoot.transform.name = name;
     }
     else
     {
         m_cacheStatus |= CachedStatus.Name;
         m_cacheName    = name;
     }
 }
示例#4
0
 public void SetLocalScale(Vector3 scale)
 {
     if (WindowRoot != null)
     {
         WindowRoot.transform.localScale = scale;
     }
     else
     {
         m_cacheStatus |= CachedStatus.Scale;
         m_cacheScale   = scale;
     }
 }
示例#5
0
 public void SetLocalPosition(Vector3 pos)
 {
     if (WindowRoot != null)
     {
         WindowRoot.transform.localPosition = pos;
     }
     else
     {
         m_cacheStatus |= CachedStatus.Position;
         m_cachePositon = pos;
     }
 }
示例#6
0
    IEnumerator HideWindowImpl()
    {
        yield return(new WaitForEndOfFrame());

        if (WindowRoot != null)
        {
            WindowRoot.SetActive(false);
            OnHideWindow();
        }
        else
        {
            m_cacheStatus  |= CachedStatus.Visible;
            m_cacheVisiable = false;
        }
    }
示例#7
0
 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;
     }
 }
示例#8
0
 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);
     }
 }