コード例 #1
0
    protected override void OnDragDropRelease(GameObject surface)
    {
        base.OnDragDropRelease(surface);

        if (this.originalItem != null && this.originalItem is UIDragDropItemEvent)
        {
            UIDragDropItemEvent item = this.originalItem as UIDragDropItemEvent;
            if (item.OnDragDrop != null)
            {
                item.OnDragDrop(surface);
            }
        }
    }
コード例 #2
0
    static int get_OnDragDrop(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);
        UIDragDropItemEvent obj = (UIDragDropItemEvent)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name OnDragDrop");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index OnDragDrop on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.OnDragDrop);
        return(1);
    }
コード例 #3
0
    static int set_OnDragDrop(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);
        UIDragDropItemEvent obj = (UIDragDropItemEvent)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name OnDragDrop");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index OnDragDrop on a nil value");
            }
        }

        LuaTypes funcType = LuaDLL.lua_type(L, 3);

        if (funcType != LuaTypes.LUA_TFUNCTION)
        {
            obj.OnDragDrop = (UIEventListener.VoidDelegate)LuaScriptMgr.GetNetObject(L, 3, typeof(UIEventListener.VoidDelegate));
        }
        else
        {
            LuaFunction func = LuaScriptMgr.ToLuaFunction(L, 3);
            obj.OnDragDrop = (param0) =>
            {
                int top = func.BeginPCall();
                LuaScriptMgr.Push(L, param0);
                func.PCall(top, 1);
                func.EndPCall(top);
            };
        }
        return(0);
    }