Ejemplo n.º 1
0
        public IBaseView CreatePanel(int panelId)
        {
            IBaseView tmp = null;

            if (_UIDict.TryGetValue(panelId, out tmp))
            {
                return(tmp);
            }

            IBaseView view = ViewFactory.CreateView(panelId);

            UIType uiType = ViewFactory.GetViewType(panelId);

            if (null == uiType)
            {
                Debug.LogErrorFormat("path null error!!");
            }
            GameObject go = this.CoreModules.resMDL.GetRes <GameObject>(uiType.Path);

            if (null == go)
            {
                Debug.LogErrorFormat("GameObject null error!!");
            }
            go.transform.SetParent(CoreModules.seneUnity.uiRoot, false);
            go.name = uiType.Name;

            IMonoUI monoUI = go.GetComponent <MonoUI>();

            if (null == view)
            {
                Debug.LogErrorFormat("view null error!!");
            }

            view.Core        = this.Core;
            view.CoreModules = this.CoreModules;
            view.monoUI      = monoUI;
            view.ViewType    = uiType;
            view.Initialize();
            _UIDict.AddOrReplace(uiType.panelId, view);

            return(view);
        }