コード例 #1
0
        private Hashtable ht = null;                        //容器键值对集合



        /// <summary>
        /// 得到实例(单例)
        /// </summary>
        /// <returns></returns>
        public static ResourcesMgr GetInstance()
        {
            if (m_Instance == null)
            {
                m_Instance = new GameObject("_ResourceMgr").AddComponent <ResourcesMgr>();
            }
            return(m_Instance);
        }
コード例 #2
0
        private BaseUI LoadUI(string UIName)
        {
            string     uiPath;
            GameObject UIPrefabs = null;
            BaseUI     baseUI    = null;

            UIPaths.TryGetValue(UIName, out uiPath);
            if (!string.IsNullOrEmpty(uiPath))
            {
                UIPrefabs = ResourcesMgr.GetInstance().LoadAsset(uiPath, false);
            }

            if (transformRoot != null && UIPrefabs != null)
            {
                baseUI = UIPrefabs.GetComponent <BaseUI>();
                if (baseUI == null)
                {
                    return(null);
                }

                switch (baseUI.curUIType.type)
                {
                case UIFormType.Normal:
                    UIPrefabs.transform.SetParent(transformNormal, false);
                    break;

                case UIFormType.Fixed:
                    UIPrefabs.transform.SetParent(transformFixed, false);
                    break;

                case UIFormType.PopUp:
                    UIPrefabs.transform.SetParent(transformPopUp, false);
                    break;
                }

                UIPrefabs.SetActive(true);
                cacheUIs.Add(UIName, baseUI);
                return(baseUI);
            }
            return(null);
        }