Exemple #1
0
        public AbstractPanel GetPanel(UIID uiID)
        {
            PanelData panelData = null;
            var       data      = UIDataTable.Get(uiID);

            if (data != null)
            {
                panelData = data as PanelData;
            }
            AbstractPanel panel = null;

            if (!m_AllPanelMap.TryGetValue(uiID, out panel))
            {
                GameObject panelGo = null;
                GameObject uiGo    = m_UILoader.LoadSync(data.fullPath) as GameObject;
                panelGo = GameObject.Instantiate(uiGo);
                panel   = panelGo.GetComponent <AbstractPanel>();
                m_AllPanelMap.Add(uiID, panel);
                panel.uiID = uiID;
            }

            if (panel != null)
            {
                panel.ShowMode = panelData.m_PanelShowMode;
                switch (panel.ShowMode)
                {
                case PanelShowMode.Normal:
                    panel.transform.SetParent(m_UIRoot.NormalRoot);
                    break;

                case PanelShowMode.Pop:
                    panel.transform.SetParent(m_UIRoot.PopRoot);
                    break;

                case PanelShowMode.HideOther:
                    panel.transform.SetParent(m_UIRoot.NormalRoot);
                    break;
                }

                panel.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0);
                panel.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0);
                //panelGo.transform.localRotation = Quaternion.Euler(Vector3.zero);
                panel.transform.localScale    = Vector3.one;
                panel.transform.localPosition = Vector3.zero;
                return(panel);
            }
            return(null);
        }
Exemple #2
0
        private static SDKConfig LoadInstance()
        {
            ResLoader loader = ResLoader.Allocate();

            UnityEngine.Object obj = loader.LoadSync("Resources/Config/SDKConfig");
            if (obj == null)
            {
                loader.Recycle2Cache();
                return(null);
            }

            instance = obj as SDKConfig;

            SDKConfig newAB = GameObject.Instantiate(instance);

            instance = newAB;

            loader.Recycle2Cache();

            return(instance);
        }
Exemple #3
0
        private static AppConfig LoadInstance()
        {
            ResLoader loader = ResLoader.Allocate();

            UnityEngine.Object obj = loader.LoadSync("Resources/Config/AppConfig");
            if (obj == null)
            {
                loader.Recycle2Cache();
                return(null);
            }

            instance = obj as AppConfig;

            // // AppConfig newAB = GameObject.Instantiate(instance);

            // // instance = newAB;

            //loader.Recycle2Cache();

            //简易写法
            //instance = Resources.Load<AppConfig>("Config/AppConfig");

            return(instance);
        }
Exemple #4
0
        private void ResLoaderCallback()
        {
            GameObject go = m_Loader.LoadSync("Bench_A") as GameObject;

            GameObject.Instantiate(go);
        }