少年修仙传客户端代码仓库
client_Wu Xijin
2018-10-22 0f0c48714089fab030974d7215bc13fc3596b722
Lua/LuaWindow.cs
@@ -20,28 +20,28 @@
    Action onActived;
    Action onLateUpdate;
    private LuaTable scriptEnv;
    private LuaTable table;
    private void Init()
    {
        scriptEnv = LuaUtility.env.NewTable();
        LuaTable meta = LuaUtility.env.NewTable();
        meta.Set("__index", LuaUtility.env.Global);
        scriptEnv.SetMetaTable(meta);
        table = LuaUtility.GetNewTable();
        var meta = LuaUtility.GetNewTable();
        meta.Set("__index", LuaUtility.Global);
        table.SetMetaTable(meta);
        meta.Dispose();
        LuaUtility.Do(string.Format("window.{0}", this.gameObject.name), this.gameObject.name, scriptEnv);
        LuaUtility.Do(string.Format("window.{0}", this.gameObject.name), this.gameObject.name, table);
        scriptEnv.Get("BindController", out onBindController);
        scriptEnv.Get("AddListeners", out onAddListeners);
        scriptEnv.Get("OnPreOpen", out onPreOpen);
        scriptEnv.Get("OnAfterOpen", out onAfterOpen);
        scriptEnv.Get("OnPreClose", out onPreClose);
        scriptEnv.Get("OnAfterClose", out onAfterClose);
        scriptEnv.Get("OnActived", out onActived);
        scriptEnv.Get("LateUpdate", out onLateUpdate);
        table.Get("BindController", out onBindController);
        table.Get("AddListeners", out onAddListeners);
        table.Get("OnPreOpen", out onPreOpen);
        table.Get("OnAfterOpen", out onAfterOpen);
        table.Get("OnPreClose", out onPreClose);
        table.Get("OnAfterClose", out onAfterClose);
        table.Get("OnActived", out onActived);
        table.Get("LateUpdate", out onLateUpdate);
        scriptEnv.Get("OnDestroy", out luaOnDestroy);
        table.Get("OnDestroy", out luaOnDestroy);
    }
    void OnDestroy()
@@ -61,9 +61,9 @@
        onActived = null;
        onLateUpdate = null;
        if (scriptEnv != null)
        if (table != null)
        {
            scriptEnv.Dispose();
            table.Dispose();
        }
    }