예제 #1
0
 public void Call(MyFrameWork.BaseUI param0)
 {
     func.BeginPCall();
     func.Push(param0);
     func.PCall();
     func.EndPCall();
 }
예제 #2
0
 static int Release(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         MyFrameWork.BaseUI obj = (MyFrameWork.BaseUI)ToLua.CheckObject(L, 1, typeof(MyFrameWork.BaseUI));
         obj.Release();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #3
0
        public void ShowMessageBox(string msg, string leftStr, UIEventListener.VoidDelegate leftCallBack, string rightStr, UIEventListener.VoidDelegate rightCallBack)
        {
            BaseUI msgWindow = GetUIByType(E_UIType.PanelMessageBox);

            if (msgWindow != null)
            {
                UIMessageBox messageBoxWindow = ((UIMessageBox)msgWindow);
                ((UIMessageBox)msgWindow).ResetWindow();
                messageBoxWindow.SetMsg(msg);
                messageBoxWindow.SetRightBtnCallBack(rightStr, rightCallBack);
                messageBoxWindow.SetLeftBtnCallBack(leftStr, leftCallBack);
                ShowUI(E_UIType.PanelMessageBox, typeof(UIMessageBox), null);
            }
        }
예제 #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
 static int ExecuteReturnLogic(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         MyFrameWork.BaseUI obj = (MyFrameWork.BaseUI)ToLua.CheckObject(L, 1, typeof(MyFrameWork.BaseUI));
         bool o = obj.ExecuteReturnLogic();
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #6
0
 static int Show(IntPtr L)
 {
     try
     {
         int count = LuaDLL.lua_gettop(L);
         MyFrameWork.BaseUI obj  = (MyFrameWork.BaseUI)ToLua.CheckObject(L, 1, typeof(MyFrameWork.BaseUI));
         object[]           arg0 = ToLua.ToParamsObject(L, 2, count - 1);
         obj.Show(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #7
0
 static int SetPanelDepth(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         MyFrameWork.UIMgr  obj  = (MyFrameWork.UIMgr)ToLua.CheckObject(L, 1, typeof(MyFrameWork.UIMgr));
         MyFrameWork.BaseUI arg0 = (MyFrameWork.BaseUI)ToLua.CheckUnityObject(L, 2, typeof(MyFrameWork.BaseUI));
         bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
         obj.SetPanelDepth(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #8
0
    static int set_mUILayertype(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            MyFrameWork.BaseUI      obj  = (MyFrameWork.BaseUI)o;
            MyFrameWork.E_LayerType arg0 = (MyFrameWork.E_LayerType)ToLua.CheckObject(L, 2, typeof(MyFrameWork.E_LayerType));
            obj.mUILayertype = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index mUILayertype on a nil value" : e.Message));
        }
    }
예제 #9
0
    static int get_mUILayertype(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            MyFrameWork.BaseUI      obj = (MyFrameWork.BaseUI)o;
            MyFrameWork.E_LayerType ret = obj.mUILayertype;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index mUILayertype on a nil value" : e.Message));
        }
    }
예제 #10
0
    static int get_CachedGameObject(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            MyFrameWork.BaseUI     obj = (MyFrameWork.BaseUI)o;
            UnityEngine.GameObject ret = obj.CachedGameObject;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index CachedGameObject on a nil value" : e.Message));
        }
    }
예제 #11
0
    static int set_StateChanged(IntPtr L)
    {
        MyFrameWork.BaseUI obj  = (MyFrameWork.BaseUI)ToLua.CheckObject(L, 1, typeof(MyFrameWork.BaseUI));
        EventObject        arg0 = null;

        if (LuaDLL.lua_isuserdata(L, 2) != 0)
        {
            arg0 = (EventObject)ToLua.ToObject(L, 2);
        }
        else
        {
            return(LuaDLL.luaL_error(L, "The event 'MyFrameWork.BaseUI.StateChanged' can only appear on the left hand side of += or -= when used outside of the type 'MyFrameWork.BaseUI'"));
        }

        if (arg0.op == EventOp.Add)
        {
            MyFrameWork.StateChangedEvent ev = (MyFrameWork.StateChangedEvent)DelegateFactory.CreateDelegate(typeof(MyFrameWork.StateChangedEvent), arg0.func);
            obj.StateChanged += ev;
        }
        else if (arg0.op == EventOp.Sub)
        {
            MyFrameWork.StateChangedEvent ev = (MyFrameWork.StateChangedEvent)LuaMisc.GetEventHandler(obj, typeof(MyFrameWork.BaseUI), "StateChanged");
            Delegate[] ds    = ev.GetInvocationList();
            LuaState   state = LuaState.Get(L);

            for (int i = 0; i < ds.Length; i++)
            {
                ev = (MyFrameWork.StateChangedEvent)ds[i];
                LuaDelegate ld = ev.Target as LuaDelegate;

                if (ld != null && ld.func == arg0.func)
                {
                    obj.StateChanged -= ev;
                    state.DelayDispose(ld.func);
                    break;
                }
            }

            arg0.func.Dispose();
        }

        return(0);
    }
예제 #12
0
        private void _Create(Command cmd)
        {
            BaseUI ui = null;

            _dicUI.TryGetValue(cmd.UIType, out ui);
            if (ui != null)
            {
                //已加载
                if (cmd.Listener != null)
                {
                    cmd.Listener(ui);
                }

                if (cmd.lua_fun != null)
                {
                    cmd.lua_fun.Call(ui.gameObject);
                }

                return;
            }
            else
            {
                if (AppConst.PrefabBundleMode && cmd.UIType != E_UIType.Fight &&
                    cmd.UIType != E_UIType.UILoadingPanel &&
                    cmd.UIType != E_UIType.PanelMessageBox &&
                    cmd.UIType != E_UIType.UILoginPanel)
                {
                    string PrefabUrl = BundleResMgr.GetResourceURL(cmd.UIType.ToString(), "unity3d");
                    if (PrefabUrl == null)
                    {
                        DebugUtil.Error("Atlas [" + cmd.UIType.ToString() + "] is null!!!");
                    }
                    WWWRequestHandle handle = BundleResMgr.Instance.RequestWWW(PrefabUrl, cmd, OnLoadUIFinished, null);
                }
                else
                {
                    AppFacade.Instance.GetManager <ResourceMgr>(ManagerName.Resource).LoadAssetAndInstance(cmd.UIType.ToString(), (asset) => { OnLoadUIFinished(asset, cmd); });
                }
            }
        }
예제 #13
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);
            }
        }