コード例 #1
0
    static int set_validator(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIToggle          obj       = (UIToggle)o;
            UIToggle.Validate arg0      = null;
            LuaTypes          funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (UIToggle.Validate)ToLua.CheckObject(L, 2, typeof(UIToggle.Validate));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(UIToggle.Validate), func) as UIToggle.Validate;
            }

            obj.validator = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index validator on a nil value" : e.Message));
        }
    }
コード例 #2
0
 public static Delegate UIToggle_Validate(LuaFunction func)
 {
     UIToggle.Validate d = (param0) =>
     {
         int    top = func.BeginPCall();
         IntPtr L   = func.GetLuaState();
         LuaScriptMgr.Push(L, param0);
         func.PCall(top, 1);
         object[] objs = func.PopValues(top);
         func.EndPCall(top);
         return((bool)objs[0]);
     };
     return(d);
 }
コード例 #3
0
    static int set_validator(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIToggle          obj  = (UIToggle)o;
            UIToggle.Validate arg0 = (UIToggle.Validate)ToLua.CheckDelegate <UIToggle.Validate>(L, 2);
            obj.validator = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index validator on a nil value"));
        }
    }
コード例 #4
0
    static int get_validator(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIToggle          obj = (UIToggle)o;
            UIToggle.Validate ret = obj.validator;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index validator on a nil value"));
        }
    }
コード例 #5
0
    private static int get_validator(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIToggle          uIToggle  = (UIToggle)obj;
            UIToggle.Validate validator = uIToggle.validator;
            ToLua.Push(L, validator);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index validator on a nil value");
        }
        return(result);
    }
コード例 #6
0
        static internal int checkDelegate(IntPtr l, int p, out UIToggle.Validate 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 = (UIToggle.Validate)checkObj(l, p);
                return(op);
            }
            LuaDelegate ld;

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

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

                pushValue(l, a1);
                ld.pcall(1, error);
                bool ret;
                checkType(l, error + 1, out ret);
                LuaDLL.lua_settop(l, error - 1);
                return(ret);
            };
            ld.d = ua;
            return(op);
        }
コード例 #7
0
ファイル: DelegateFactory.cs プロジェクト: daxingyou/Hunter
    public static Delegate UIToggle_Validate(LuaFunction func, LuaTable self, bool flag)
    {
        if (func == null)
        {
            UIToggle.Validate fn = delegate(bool param0) { return(false); };
            return(fn);
        }

        if (!flag)
        {
            UIToggle_Validate_Event target = new UIToggle_Validate_Event(func);
            UIToggle.Validate       d      = target.Call;
            target.method = d.Method;
            return(d);
        }
        else
        {
            UIToggle_Validate_Event target = new UIToggle_Validate_Event(func, self);
            UIToggle.Validate       d      = target.CallWithSelf;
            target.method = d.Method;
            return(d);
        }
    }