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

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

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

            obj.onScroll = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onScroll on a nil value" : e.Message));
        }
    }
コード例 #2
0
        internal static int checkDelegate(IntPtr l, int p, out UIEventListener.FloatDelegate ua)
        {
            int result = LuaObject.extractFunction(l, p);

            if (LuaDLL.pua_isnil(l, p))
            {
                ua = null;
                return(result);
            }
            if (LuaDLL.pua_isuserdata(l, p) == 1)
            {
                ua = (UIEventListener.FloatDelegate)LuaObject.checkObj(l, p);
                return(result);
            }
            LuaDelegate ld;

            LuaObject.checkType(l, -1, out ld);
            LuaDLL.pua_pop(l, 1);
            if (ld.d != null)
            {
                ua = (UIEventListener.FloatDelegate)ld.d;
                return(result);
            }
            l  = LuaState.get(l).L;
            ua = delegate(GameObject a1, float a2)
            {
                int num = LuaObject.pushTry(l);
                LuaObject.pushValue(l, a1);
                LuaObject.pushValue(l, a2);
                ld.pcall(2, num);
                LuaDLL.pua_settop(l, num - 1);
            };
            ld.d = ua;
            return(result);
        }
コード例 #3
0
 public static void AddGenericScroll(UIEventListener.FloatDelegate fun)
 {
     if (UICamera.genericEventHandler != null)
     {
         UIEventListener.Get(UICamera.genericEventHandler).onScroll += fun;
     }
 }
コード例 #4
0
 public static UIEventListener.FloatDelegate FloatDelegate(LuaFunction func)
 {
     UIEventListener.FloatDelegate action = (go, delta) =>
     {
         func.Call(go, delta);
     };
     return(action);
 }
コード例 #5
0
 public void AddBarChange(UIEventListener.FloatDelegate fun)
 {
     if (barChangeFun == null)
     {
         barChangeFun = fun;
     }
     else
     {
         barChangeFun += fun;
     }
 }
コード例 #6
0
    public static Delegate UIEventListener_FloatDelegate(LuaFunction func)
    {
        if (func == null)
        {
            UIEventListener.FloatDelegate fn = delegate { };
            return(fn);
        }

        UIEventListener.FloatDelegate d = (new UIEventListener_FloatDelegate_Event(func)).Call;
        return(d);
    }
コード例 #7
0
 public static void RemoveGenericScroll(UIEventListener.FloatDelegate fun)
 {
     if (UICamera.genericEventHandler != null)
     {
         UIEventListener e = UIEventListener.Get(UICamera.genericEventHandler);
         if (e != null)
         {
             e.onScroll -= fun;
         }
     }
 }
コード例 #8
0
 public static Delegate UIEventListener_FloatDelegate(LuaFunction func)
 {
     UIEventListener.FloatDelegate d = (param0, param1) =>
     {
         int    top = func.BeginPCall();
         IntPtr L   = func.GetLuaState();
         LuaScriptMgr.Push(L, param0);
         LuaScriptMgr.Push(L, param1);
         func.PCall(top, 2);
         func.EndPCall(top);
     };
     return(d);
 }
コード例 #9
0
 static int FloatDelegate(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         LuaFunction arg0 = ToLua.CheckLuaFunction(L, 1);
         UIEventListener.FloatDelegate o = LuaHelper.FloatDelegate(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #10
0
    static int set_onScroll(IntPtr L)
    {
        object o = null;

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

        try
        {
            o = ToLua.ToObject(L, 1);
            UIEventListener obj = (UIEventListener)o;
            UIEventListener.FloatDelegate ret = obj.onScroll;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onScroll on a nil value"));
        }
    }
コード例 #12
0
 public void Clear()
 {
     this.onSubmit      = null;
     this.onClick       = null;
     this.onDoubleClick = null;
     this.onHover       = null;
     this.onPress       = null;
     this.onSelect      = null;
     this.onScroll      = null;
     this.onDragStart   = null;
     this.onDrag        = null;
     this.onDragOver    = null;
     this.onDragOut     = null;
     this.onDragEnd     = null;
     this.onDrop        = null;
     this.onKey         = null;
     this.onTooltip     = null;
 }
コード例 #13
0
    private static int get_onScroll(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIEventListener uIEventListener        = (UIEventListener)obj;
            UIEventListener.FloatDelegate onScroll = uIEventListener.onScroll;
            ToLua.Push(L, onScroll);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index onScroll on a nil value");
        }
        return(result);
    }
        static internal int checkDelegate(IntPtr l, int p, out UIEventListener.FloatDelegate 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 = (UIEventListener.FloatDelegate)checkObj(l, p);
                return(op);
            }
            LuaDelegate ld;

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

            l  = LuaState.get(l).L;
            ua = (UnityEngine.GameObject a1, float a2) =>
            {
                int error = pushTry(l);

                pushValue(l, a1);
                pushValue(l, a2);
                ld.pcall(2, error);
                LuaDLL.lua_settop(l, error - 1);
            };
            ld.d = ua;
            return(op);
        }