Example #1
0
    static int _CreateLuaProxy(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                string   arg0 = ToLua.CheckString(L, 1);
                LuaProxy obj  = new LuaProxy(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2)
            {
                string   arg0 = ToLua.CheckString(L, 1);
                object   arg1 = ToLua.ToVarObject(L, 2);
                LuaProxy obj  = new LuaProxy(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LuaProxy.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #2
0
        public void RegisterLuaProxy(string proxyName)
        {
            luaEnv.DoString("require '" + proxyName + "'");
            ILuaProxy proxy = new LuaProxy();

            proxy.NAME       = luaEnv.Global.GetInPath <string>(proxyName + ".NAME");
            proxy.OnRegister = luaEnv.Global.GetInPath <Action>(proxyName + ".OnRegister");
            proxy.OnRemove   = luaEnv.Global.GetInPath <Action>(proxyName + ".OnRemove");
            base.RegisterLuaProxy(proxy);
        }
Example #3
0
 static int OnRemove(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         LuaProxy obj = (LuaProxy)ToLua.CheckObject <LuaProxy>(L, 1);
         obj.OnRemove();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #4
0
    static int get_Proxy(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            LuaProxy obj = (LuaProxy)o;
            LuaInterface.LuaTable ret = obj.Proxy;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Proxy on a nil value"));
        }
    }
Example #5
0
    void OnDestroy()
    {
        LogicEvent.remove(this);

#if FRAME_RECORDING
        FrameRecording.terminate();
#endif

#if !SCENEEDITOR_TOOL
        LuaProxy.terminate();
#endif

        SceneViews.terminate();

        RealTimeRAProcessCenter.terminate();

        Profiler.terminate();

        Game.terminate();

        Debuger.Close();
    }
Example #6
0
    void Awake()
    {
        Debug.Log("---------------  Awake ------------------------");

        proxyLua = new LuaProxy();
        proxyLua.AddSearchPath(Application.persistentDataPath);
        string lua = proxyLua.ReadFile(System.IO.Path.Combine(Application.streamingAssetsPath, "root.lua"));

        proxyLua.UseRootCode(lua);

        proxyXR.DoAwake();

        GameObject objMT = new GameObject("_MT_");

        runtimetMT      = objMT.AddComponent <RuntimeMT>();
        runtimetMT.mvcs = this;

        foreach (Transform child in this.transform.Find("UIFacades"))
        {
            UIFacade facade = child.GetComponent <UIFacade>();
            facade.Register();
        }

        initialize();

        // bootloader
        BootloaderView viewBootloader = new BootloaderView();

        framework.viewCenter.Register(BootloaderView.NAME, viewBootloader);
        controllerBootloader          = new BootloaderBatchController();
        controllerBootloader.onFinish = runRom;
        framework.controllerCenter.Register(BootloaderBatchController.NAME, controllerBootloader);
        modelBootloader = new BootloaderModel();
        framework.modelCenter.Register(BootloaderModel.NAME, modelBootloader);

        proxyLua.DoAwake();
    }
Example #7
0
    void Awake()
    {
        Debuger.SetOutputType(Debuger.OutputType.Console);
        Debuger.SetDebugLevel((int)(Debuger.DebugLevel.Normal | Debuger.DebugLevel.Warning | Debuger.DebugLevel.Error));
        Debuger.Open();

        Game.create();

        RealTimeRAProcessCenter.create();

        SceneViews.create();

        Profiler.create();

#if !SCENEEDITOR_TOOL
        LuaProxy.create();
#endif

#if FRAME_RECORDING
        FrameRecording.create();
#endif

        LogicEvent.add("onWaitForSync", this, "onWaitForSync");

        //FBGame刚被创建
        LogicEvent.add("onFBGameNewed", this, "onFBGameNewed");
        //FBGame被删除
        LogicEvent.add("onFBGameDestroyed", this, "onFBGameDestroyed");

        //FBGame游戏开始前,比如进场
        LogicEvent.add("onFBGameEnter", this, "onFBGameEnter");
        //FBGame游戏正式开始
        LogicEvent.add("onFBGameStart", this, "onFBGameStart");
        //FBGame游戏结束
        LogicEvent.add("onFBGameOver", this, "onFBGameOver");
    }