예제 #1
0
        public void AddModelShow(ModelShow3D target)
        {
            Transform cameraRoot = target.cameraRoot;

            cameraRoot.SetParent(transform, true);

            Vector3 nextPosition = RequestNextPosition();

            cameraRoot.transform.position   = nextPosition;
            cameraRoot.transform.localScale = Vector3.one;

            UITools.SetGameObjectLayer(gameObject, LayerDefine.LAYER_AVATAR_SHOW);
        }
예제 #2
0
            public void SetActive(bool visible, bool interactive)
            {
                if (m_Panel == null)
                {
                    return;
                }

                visible = (visible && m_Panel.customVisibleFlag);

                ePanelState nextState = ePanelState.UnInit;

                if (visible)
                {
                    if (interactive)
                    {
                        nextState = ePanelState.Interactive;
                    }
                    else
                    {
                        nextState = ePanelState.OnlyVisible;
                    }
                }
                else
                {
                    nextState = ePanelState.UnVisible;
                }

                if (nextState == m_PanelState && !m_IsStateDirty)
                {
                    return;
                }

                m_PanelState   = nextState;
                m_IsStateDirty = false;

                //1.使用LayerMask 模式设置
                if (visible)
                {
                    if (!m_Panel.gameObject.activeSelf)
                    {
                        m_Panel.gameObject.SetActive(true);
                    }

                    UITools.SetGameObjectLayer(m_Panel.gameObject, LayerDefine.LAYER_UI);
                    if (interactive)
                    {
                        UITools.SetGraphicRaycasterState(m_Panel.gameObject, true);
                    }
                    else
                    {
                        UITools.SetGraphicRaycasterState(m_Panel.gameObject, false);
                    }

                    Transform tr = m_Panel.transform;
                    UIMgr.S.uiRoot.ReleaseFreePos(tr.localPosition);
                    tr.localPosition = m_DefaultPos;
                    m_Panel.OnBecomeVisible();
                }
                else
                {
                    if (m_Panel.gameObject.activeSelf)
                    {
                        UITools.SetGameObjectLayer(m_Panel.gameObject, LayerDefine.LAYER_HIDE_UI);
                        m_Panel.gameObject.transform.localPosition = UIMgr.S.uiRoot.RequireNextFreePos();
                        m_Panel.OnBecomeHide();
                    }
                }

                //2. 使用GameObject开关模式,经过测试每次切换的开销比较大,但是在编辑器模式下方便编辑调试

                /*
                 * if (m_Panel.gameObject.activeSelf != state)
                 * {
                 *  m_Panel.gameObject.SetActive(state);
                 * }
                 */

                //3.使用Canvas 组件的开关模式,该模式和1类似,时间上和1类似

                /*
                 * if (state)
                 * {
                 *  if (!m_Panel.gameObject.activeSelf)
                 *  {
                 *      m_Panel.gameObject.SetActive(true);
                 *  }
                 *
                 *  UITools.SetCanvasState(m_Panel.gameObject, true);
                 *  Transform tr = m_Panel.transform;
                 *  UIMgr.S.uiRoot.ReleaseFreePos(tr.localPosition);
                 *  tr.localPosition = m_DefaultPos;
                 * }
                 * else
                 * {
                 *  UITools.SetCanvasState(m_Panel.gameObject, false);
                 *  m_Panel.gameObject.transform.localPosition = UIMgr.S.uiRoot.RequireNextFreePos();
                 * }
                 */
            }
예제 #3
0
 public void OnAllocate(GameObject result)
 {
     UITools.SetGameObjectLayer(result, LayerDefine.LAYER_UI);
 }
예제 #4
0
 public void OnRecycle(GameObject result)
 {
     UITools.SetGameObjectLayer(result, LayerDefine.LAYER_HIDE_UI);
 }
예제 #5
0
 public void ProcessContainer(GameObject container)
 {
     UITools.SetGameObjectLayer(container, LayerDefine.LAYER_HIDE_UI);
 }