Example #1
0
    static int set_onDestroyEvent(IntPtr L)
    {
        try
        {
            GameFramework.MonoBase obj  = (GameFramework.MonoBase)ToLua.CheckObject(L, 1, typeof(GameFramework.MonoBase));
            EventObject            arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'GameFramework.MonoBase.onDestroyEvent' can only appear on the left hand side of += or -= when used outside of the type 'GameFramework.MonoBase'"));
            }

            if (arg0.op == EventOp.Add)
            {
                System.Action ev = (System.Action) DelegateTraits <System.Action> .Create(arg0.func);

                obj.onDestroyEvent += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                System.Action ev    = (System.Action)LuaMisc.GetEventHandler(obj, typeof(GameFramework.MonoBase), "onDestroyEvent");
                Delegate[]    ds    = ev.GetInvocationList();
                LuaState      state = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (System.Action)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        obj.onDestroyEvent -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #2
0
    static int get_position(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            GameFramework.MonoBase obj = (GameFramework.MonoBase)o;
            UnityEngine.Vector3    ret = obj.position;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index position on a nil value"));
        }
    }
Example #3
0
    static int set_eulerAngles(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            GameFramework.MonoBase obj  = (GameFramework.MonoBase)o;
            UnityEngine.Vector3    arg0 = ToLua.ToVector3(L, 2);
            obj.eulerAngles = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index eulerAngles on a nil value"));
        }
    }
Example #4
0
    static int set_localRotation(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            GameFramework.MonoBase obj  = (GameFramework.MonoBase)o;
            UnityEngine.Quaternion arg0 = ToLua.ToQuaternion(L, 2);
            obj.localRotation = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index localRotation on a nil value"));
        }
    }
Example #5
0
    static int set_parent(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            GameFramework.MonoBase obj  = (GameFramework.MonoBase)o;
            UnityEngine.Transform  arg0 = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L, 2);
            obj.parent = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index parent on a nil value"));
        }
    }