示例#1
0
        static int _e_onDisplaysUpdated(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                int gen_param_count         = LuaAPI.lua_gettop(L);
                UnityEngine.Display.DisplaysUpdatedDelegate gen_delegate = translator.GetDelegate <UnityEngine.Display.DisplaysUpdatedDelegate>(L, 2);
                if (gen_delegate == null)
                {
                    return(LuaAPI.luaL_error(L, "#2 need UnityEngine.Display.DisplaysUpdatedDelegate!"));
                }


                if (gen_param_count == 2 && LuaAPI.xlua_is_eq_str(L, 1, "+"))
                {
                    UnityEngine.Display.onDisplaysUpdated += gen_delegate;
                    return(0);
                }


                if (gen_param_count == 2 && LuaAPI.xlua_is_eq_str(L, 1, "-"))
                {
                    UnityEngine.Display.onDisplaysUpdated -= gen_delegate;
                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Display.onDisplaysUpdated!"));
        }
        static internal int checkDelegate(IntPtr l, int p, out UnityEngine.Display.DisplaysUpdatedDelegate ua)
        {
            int op = extractFunction(l, p);

            if (LuaDLL.lua_isnil(l, p))
            {
                ua = null;
                return(op);
            }
            else if (LuaDLL.lua_isuserdata(l, p) == 1)
            {
                ua = (UnityEngine.Display.DisplaysUpdatedDelegate)checkObj(l, p);
                return(op);
            }
            LuaDelegate ld;

            checkType(l, -1, out ld);
            LuaDLL.lua_pop(l, 1);
            if (ld.d != null)
            {
                ua = (UnityEngine.Display.DisplaysUpdatedDelegate)ld.d;
                return(op);
            }

            l  = LuaState.get(l).L;
            ua = () =>
            {
                int error = pushTry(l);

                ld.pcall(0, error);
                LuaDLL.lua_settop(l, error - 1);
            };
            ld.d = ua;
            return(op);
        }
示例#3
0
        static internal int checkDelegate(IntPtr l, int p, out UnityEngine.Display.DisplaysUpdatedDelegate ua)
        {
            int op = extractFunction(l, p);

            if (LuaDLL.lua_isnil(l, -1))
            {
                ua = null;
                return(op);
            }
            int r = LuaDLL.luaS_checkcallback(l, -1);

            if (r < 0)
            {
                LuaDLL.luaL_error(l, "expect function");
            }
            if (getCacheDelegate <UnityEngine.Display.DisplaysUpdatedDelegate>(r, out ua))
            {
                return(op);
            }
            LuaDLL.lua_pop(l, 1);
            ua = () =>
            {
                int error = pushTry(l);
                LuaDLL.lua_getref(l, r);

                if (LuaDLL.lua_pcall(l, 0, -1, error) != 0)
                {
                    LuaDLL.lua_pop(l, 1);
                }
                LuaDLL.lua_pop(l, 1);
            };
            cacheDelegate(r, ua);
            return(op);
        }
    static bool Display_remove_onDisplaysUpdated__DisplaysUpdatedDelegate(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 1)
        {
            UnityEngine.Display.DisplaysUpdatedDelegate action = JSDataExchangeMgr.GetJSArg <UnityEngine.Display.DisplaysUpdatedDelegate>(() =>
            {
                if (JSApi.isFunctionS((int)JSApi.GetType.Arg))
                {
                    return(Display_remove_onDisplaysUpdated_GetDelegate_member3_arg0(JSApi.getFunctionS((int)JSApi.GetType.Arg)));
                }
                else
                {
                    return((UnityEngine.Display.DisplaysUpdatedDelegate)JSMgr.datax.getObject((int)JSApi.GetType.Arg));
                }
            });
            UnityEngine.Display.onDisplaysUpdated -= action;
        }

        return(true);
    }