Пример #1
0
    public void Destroy()
    {
        if (luaState != null)
        {
            if (UpdateEvent != null)
            {
                UpdateEvent.Dispose();
                UpdateEvent = null;
            }

            if (LateUpdateEvent != null)
            {
                LateUpdateEvent.Dispose();
                LateUpdateEvent = null;
            }

            if (FixedUpdateEvent != null)
            {
                FixedUpdateEvent.Dispose();
                FixedUpdateEvent = null;
            }

            luaState = null;
        }
    }
Пример #2
0
    private LuaBeatEvent GetEvent(string name)
    {
        LuaTable table = this.luaState.GetTable(name, true);

        if (table == null)
        {
            throw new LuaException(string.Format("Lua table {0} not exists", name), null, 1);
        }
        LuaBeatEvent result = new LuaBeatEvent(table);

        table.Dispose();
        return(result);
    }
Пример #3
0
 void Start()
 {
     try
     {
         UpdateEvent      = GetEvent("UpdateBeat");
         LateUpdateEvent  = GetEvent("LateUpdateBeat");
         FixedUpdateEvent = GetEvent("FixedUpdateBeat");
     }
     catch (Exception e)
     {
         Destroy(this);
         throw e;
     }
 }
Пример #4
0
 private void Start()
 {
     try
     {
         this.UpdateEvent      = this.GetEvent("UpdateBeat");
         this.LateUpdateEvent  = this.GetEvent("LateUpdateBeat");
         this.FixedUpdateEvent = this.GetEvent("FixedUpdateBeat");
     }
     catch (Exception ex)
     {
         UnityEngine.Object.Destroy(this);
         throw ex;
     }
 }
Пример #5
0
    LuaBeatEvent GetEvent(string name)
    {
        LuaTable table = luaState.GetTable(name);

        if (table == null)
        {
            throw new LuaException(string.Format("Lua table {0} not exists", name));
        }

        LuaBeatEvent e = new LuaBeatEvent(table);
        table.Dispose();
        table = null;
        return e;
    }
Пример #6
0
 public void Init(LuaState state)
 {
     try
     {
         luaState         = state;
         UpdateEvent      = GetEvent("UpdateBeat");
         LateUpdateEvent  = GetEvent("LateUpdateBeat");
         FixedUpdateEvent = GetEvent("FixedUpdateBeat");
     }
     catch (Exception e)
     {
         Destroy();
         throw e;
     }
 }
Пример #7
0
 public void Destroy()
 {
     if (this.luaState != null)
     {
         if (this.UpdateEvent != null)
         {
             this.UpdateEvent.Dispose();
             this.UpdateEvent = null;
         }
         if (this.LateUpdateEvent != null)
         {
             this.LateUpdateEvent.Dispose();
             this.LateUpdateEvent = null;
         }
         if (this.FixedUpdateEvent != null)
         {
             this.FixedUpdateEvent.Dispose();
             this.FixedUpdateEvent = null;
         }
         this.luaState = null;
     }
 }