Пример #1
0
        private void RemoveUI(BaseUI ui)
        {
            if (ui != null && _dicUI.ContainsKey(ui.GetUIType()))
            {
                _dicUI.Remove(ui.GetUIType());

                ui.Release();
            }
        }
Пример #2
0
 public void OnTopReturn()
 {
     if (_backSequence.Count != 0)
     {
         BaseUI ui = _backSequence.Peek();
         if (ui != null && ui.mUIStyle == E_UIStyle.BackClose)
         {
             DestroyUI(ui.GetUIType());
             _backSequence.Pop();
         }
     }
 }
Пример #3
0
        private void AddUI(BaseUI ui)
        {
            E_UIType uiType = ui.GetUIType();

            if (_dicUI.ContainsKey(uiType))
            {
                _dicUI[uiType] = ui;
            }
            else
            {
                _dicUI.Add(uiType, ui);
            }
        }
Пример #4
0
 static int GetUIType(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         MyFrameWork.BaseUI   obj = (MyFrameWork.BaseUI)ToLua.CheckObject(L, 1, typeof(MyFrameWork.BaseUI));
         MyFrameWork.E_UIType o   = obj.GetUIType();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #5
0
        private void OnLoadUIFinished(object asset, Command cmd)
        {
            if (asset != null && cmd != null)
            {
                GameObject go = null;
                if (AppConst.PrefabBundleMode && cmd.UIType != E_UIType.Fight &&
                    cmd.UIType != E_UIType.UILoadingPanel &&
                    cmd.UIType != E_UIType.PanelMessageBox &&
                    cmd.UIType != E_UIType.UILoginPanel)
                {
                    WWWRequestHandle handle    = asset as WWWRequestHandle;
                    AssetBundle      bundle    = handle.RetainAsAssetBundle();
                    GameObject       LoadedRes = bundle.LoadAsset(cmd.UIType.ToString()) as GameObject;
                    if (LoadedRes != null)
                    {
                        go = GameObject.Instantiate(LoadedRes) as GameObject;
                    }
                }
                else
                {
                    go = asset as GameObject;
                }
                go.SetActive(false);
                BaseUI ui = go.AddComponent(cmd.MonoType) as BaseUI;
                if (cmd.bLuaBehaviour)
                {
                    go.AddComponent <LuaBehaviour>().OnInit(null);
                }
                ui.mUIType = cmd.UIType;
                go.name    = ui.GetUIType().ToString();
                _curUI     = ui;
                if (ui.mUIStyle == E_UIStyle.BackClose)
                {
                    _backSequence.Push(ui);
                }
                AddUI(ui);

                if (ui.mUIType == E_UIType.UILoadingPanel)
                {
                    GameObject.DontDestroyOnLoad(go);
                }

                if (cmd.CommandType == Command.CmdType.CreateAndShow)
                {
                    if (cmd.lua_fun != null)
                    {
                        ShowUI_LUA(cmd.UIType, cmd.lua_fun, cmd.IsCloseOtherUIs, cmd.CreateCanCall, cmd.Params);
                    }
                    else
                    {
                        ShowUI(cmd.UIType, cmd.MonoType, cmd.Listener, cmd.IsCloseOtherUIs, cmd.CreateCanCall, cmd.Params);
                    }
                }
                else if (cmd.CreateCanCall && cmd.Listener != null)
                {
                    cmd.Listener(ui);
                }
                else if (cmd.CreateCanCall && cmd.lua_fun != null)
                {
                    cmd.lua_fun.Call(ui.gameObject);
                }
                //ui.CachedTransform.SetParent(UIContainer,false);

                ui.UIInit();

                AddColliderBgForWindow(ui);

                LayerMgr.Instance.SetLayer(ui);
            }
        }