Exemplo n.º 1
0
        private Hashtable ht = null;                        //容器键值对集合



        /// <summary>
        /// 得到实例(单例)
        /// </summary>
        /// <returns></returns>
        public static ResourcesMgr GetInstance()
        {
            if (_Instance == null)
            {
                _Instance = new GameObject("_ResourceMgr").AddComponent <ResourcesMgr>();
            }
            return(_Instance);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 加载指定名称的“UI窗体”
        /// 功能:
        /// 1、根据“UI窗体名“加载预设克隆体
        /// 2、根据克隆体中不同位置信息,设置不同父对象
        /// 3、隐藏刚创建的UI克隆体
        /// 4、把克隆体加入到 _dicAllUiForms 中
        /// </summary>
        /// <param name="uiFormName">UI窗体的名称</param>
        private BaseUIForm LoadUIForm(string uiFormName)
        {
            string     strUIFormsPaths  = null;
            GameObject goCloneUIPrefabs = null;
            BaseUIForm baseUiForm       = null;

            // 根据UI窗体名称,得到对应的加载路径
            _dicFormsPaths.TryGetValue(uiFormName, out strUIFormsPaths);
            //1、根据“UI窗体名“加载预设克隆体
            if (!string.IsNullOrEmpty(strUIFormsPaths))
            {
                goCloneUIPrefabs = ResourcesMgr.GetInstance().LoadAsset(strUIFormsPaths, false);
            }
            //2、根据克隆体中不同位置信息,设置不同父对象
            if (_traCanvasTransform != null && goCloneUIPrefabs != null)
            {
                baseUiForm = goCloneUIPrefabs.GetComponent <BaseUIForm>();
                if (baseUiForm == null)
                {
                    Debug.Log(strUIFormsPaths + "  克隆的窗体上没有BaseUIForm");
                    return(null);
                }
                switch (baseUiForm.CurrentUiType.UIForms_Type)
                {
                case UIFormsType.Normal:     // 普通窗体
                    goCloneUIPrefabs.transform.SetParent(_traNormal, false);
                    break;

                case UIFormsType.Fixed:     // 固定窗体
                    goCloneUIPrefabs.transform.SetParent(_traFixed, false);
                    break;

                case UIFormsType.PopUp:     //弹出窗体
                    goCloneUIPrefabs.transform.SetParent(_traPopUp, false);
                    break;

                default:
                    break;
                }
                //3、隐藏刚创建的UI克隆体
                goCloneUIPrefabs.SetActive(false);
                //4、把克隆体加入到 _dicAllUiForms 中
                _dicAllUiForms.Add(uiFormName, baseUiForm);
                return(baseUiForm);
            }
            else
            {
                Debug.Log("_traCanvasTransform = null Or  goCloneUIPrefabs = null" + uiFormName);
                return(null);
            }
        }
Exemplo n.º 3
0
        private GameObject InitRootCanvasLoading()
        {
            GameObject canvas = ResourcesMgr.GetInstance().LoadAsset(SysDefine.SYS_PATH_CANVAS, false);

            return(canvas);
        }