private void TryActions(LuaAction[] actions, Transform actor)
 {
     if (actions == null) return;
     foreach (LuaAction action in actions) {
         if (action != null && action.condition != null && action.condition.IsTrue(actor)) DoAction(action, actor);
     }
 }
 public void DoAction(LuaAction action, Transform actor)
 {
     if (action == null)
     {
         return;
     }
     Lua.Run(action.luaCode, debugLua);
 }
示例#3
0
 public static void recurse(LuaAction <Instance> func, Instance root)
 {
     foreach (var child in root.Children)
     {
         func.Invoke(child);
         recurse(func, child);
     }
 }
 public void DoAction(LuaAction action, Transform actor)
 {
     if (action == null)
     {
         return;
     }
     Lua.Run(action.luaCode, debugLua);
     DialogueManager.SendUpdateTracker();
 }
示例#5
0
 public OpCode(byte testFlag, byte setAFlag, EOpArgMask argBMode, EOpArgMask argCMode, EOpMode opMode,
               string name, LuaAction action)
 {
     TestFlag = testFlag;
     SetAFlag = setAFlag;
     ArgBMode = argBMode;
     ArgCMode = argCMode;
     OpMode   = opMode;
     Name     = name;
     Action   = action;
 }
示例#6
0
        private LuaTable GetLuaTable()
        {
            LuaTable luaModule = ezLua.luaRequire(moduleName);
            LuaAwake awake     = luaModule.Get <LuaAwake>("LuaAwake");
            LuaTable table     = awake == null ? luaModule : awake.Invoke(this);

            luaStart     = table.Get <LuaAction <LuaTable> >("LuaStart");
            luaOnEnable  = table.Get <LuaAction <LuaTable> >("LuaOnEnable");
            luaOnDisable = table.Get <LuaAction <LuaTable> >("LuaOnDisable");
            luaOnDestroy = table.Get <LuaAction <LuaTable> >("LuaOnDestroy");
            return(table);
        }
示例#7
0
文件: EZLua.cs 项目: zjytra/EZUnity
 public void StartLua()
 {
     if (!string.IsNullOrEmpty(settings.luaBootModule))
     {
         luaRequire(settings.luaBootModule);
         luaStart = luaEnv.Global.Get <LuaAction>(settings.luaEntrance);
         luaExit  = luaEnv.Global.Get <LuaAction>(settings.luaExit);
     }
     if (luaStart != null)
     {
         luaStart();
     }
 }
示例#8
0
 public override void Init()
 {
     base.Init();
     luaEnv = new LuaEnv();
     AddBuildin();
     AddLoader();
     luaEnv.DoString("require 'Main'");
     luaStart = luaEnv.Global.Get <LuaAction>("Start");
     luaExit  = luaEnv.Global.Get <LuaAction>("Exit");
     if (luaStart != null)
     {
         luaStart();
     }
 }
示例#9
0
    void OnDestroy()
    {
        if (m_luaOnDestroy != null)
        {
            m_luaOnDestroy();
        }

        m_client.Close();
        m_client.OnEvent       = null;
        m_client.OnMessage     = null;
        m_client.OnRoomMessage = null;
        m_client = null;

        FastNet.App.finalize();

        m_luaOnDestroy = null;
        m_luaUpdate    = null;
        m_luaStart     = null;
        m_mainScriptEnv.Dispose();
        m_mainScriptEnv = null;
    }
示例#10
0
 /// <summary>
 /// Removes a function that was previously bound to the game closing.
 /// </summary>
 public void UnbindFromClose(LuaAction callback)
 {
     _closeBindings.TryRemove(callback);
 }
示例#11
0
 /// <summary>
 /// Binds a function to be called when the game is closing.
 /// </summary>
 /// <param name="callback">The callback function.</param>
 /// <param name="priority">The priority. Higher numbers are called first.</param>
 public void BindToClose(LuaAction callback, int priority = 0)
 {
     _closeBindings.TryAdd(callback, new OnCloseBinding(callback, priority));
 }
 public void DoAction(LuaAction action, Transform actor)
 {
     if (action == null) return;
     Lua.Run(action.luaCode, debugLua);
 }
示例#13
0
 void OnDestroy()
 {
     onUpdate      = null;
     onLateUpdate  = null;
     onFixedUpdate = null;
 }