Inheritance: IDisposable
Exemple #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;
        }
    }
    static int get_LateUpdateEvent(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            LuaLooper obj = (LuaLooper)o;
            LuaInterface.LuaBeatEvent ret = obj.LateUpdateEvent;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index LateUpdateEvent on a nil value"));
        }
    }
Exemple #3
0
 void Start()
 {
     try
     {
         UpdateEvent = GetEvent("UpdateBeat");
         LateUpdateEvent = GetEvent("LateUpdateBeat");
         FixedUpdateEvent = GetEvent("FixedUpdateBeat");
     }
     catch (Exception e)
     {
         Destroy(this);
         throw e;
     }
 }
Exemple #4
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;
    }