コード例 #1
0
        private void OnUICanvasClose(BaseUICanvas uiCanvas)
        {
            Destroy(m_uiCanvas.gameObject);
            m_uiCanvas = null;

            m_transition = false;

            if (m_nextCanvas != null)
            {
                m_nextCanvas.GetCanvas().enabled = true;

                OpenUICanvas <BaseUICanvas>(m_nextCanvas.Name, m_nextCanvasParams);
            }
        }
コード例 #2
0
        public BaseUICanvas OpenUICanvas <T>(string name, System.Object param)
        {
            if (m_uiCanvas != null && m_uiCanvas.Name == name)
            {
                return(m_uiCanvas);
            }

            if (m_transition && m_ref != null && m_ref.Name == name && m_uiCanvas != null)
            {
                return(m_uiCanvas);
            }

            if (m_transition)
            {
                if (m_nextCanvas != null)
                {
                    Destroy(m_nextCanvas.gameObject);
                    m_nextCanvas = null;
                }

                if (m_uiCanvas != null)
                {
                    Destroy(m_uiCanvas.gameObject);
                    m_uiCanvas = null;
                }
            }

            m_transition = true;

            m_ref = GetUICanvasRefByName(name);

            if (m_uiCanvas != null)
            {
                m_nextCanvas = Instantiate(m_ref) as BaseUICanvas;
                m_nextCanvas.GetCanvas().enabled = false;
                m_nextCanvasParams = param;

                m_uiCanvas.Close();


                return(m_nextCanvas);
            }
            else if (m_nextCanvas == null)
            {
                m_nextCanvas = Instantiate(m_ref) as BaseUICanvas;
            }


            m_uiCanvas = m_nextCanvas;

            m_uiCanvas.GetCanvas().enabled = true;

            m_nextCanvasParams = null;

            m_uiCanvas.Init();
            m_uiCanvas.onUICanvasClose = OnUICanvasClose;
            m_uiCanvas.onUICanvasOpen  = OnUICanvasOpen;


            m_uiCanvas.name = m_ref.name;


            m_listOfCanvas.Add(m_uiCanvas.Name);
            m_uiCanvas.Open(param);

            m_nextCanvas = null;

            return(m_uiCanvas);
        }
コード例 #3
0
 private void OnUICanvasOpen(BaseUICanvas uiCanvas)
 {
     m_transition = false;
 }
コード例 #4
0
 void OnLevelWasLoaded(int level)
 {
     m_uiCanvas   = null;
     m_nextCanvas = null;
 }