internal static int checkDelegate(IntPtr l, int p, out UIEventListener.VectorDelegate 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.VectorDelegate)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.VectorDelegate)ld.d;
                return(result);
            }
            l  = LuaState.get(l).L;
            ua = delegate(GameObject a1, Vector2 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);
        }
    static int set_onDrag(IntPtr L)
    {
        object o = null;

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

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

            obj.onDrag = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onDrag on a nil value" : e.Message));
        }
    }
    static int AddDragEvent(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            UIEventListener obj = (UIEventListener)ToLua.CheckObject(L, 1, typeof(UIEventListener));
            UIEventListener.VectorDelegate arg0 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

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

            obj.AddDragEvent(arg0);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #4
0
 public static UIEventListener.VectorDelegate VectorDelegate(LuaFunction func)
 {
     UIEventListener.VectorDelegate action = (go, delta) =>
     {
         func.Call(go, delta);
     };
     return(action);
 }
Example #5
0
    static int VectorDelegate(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        LuaFunction arg0 = LuaScriptMgr.GetLuaFunction(L, 1);

        UIEventListener.VectorDelegate o = LuaHelper.VectorDelegate(arg0);
        LuaScriptMgr.Push(L, o);
        return(1);
    }
Example #6
0
    private void Attach(ref UIEventListener.VectorDelegate dele)
    {
        if (vector_list == null)
        {
            vector_list = new List <UIEventListener.VectorDelegate>();
        }

        vector_list.Add(dele);
    }
Example #7
0
    public static Delegate UIEventListener_VectorDelegate(LuaFunction func)
    {
        if (func == null)
        {
            UIEventListener.VectorDelegate fn = delegate { };
            return(fn);
        }

        UIEventListener.VectorDelegate d = (new UIEventListener_VectorDelegate_Event(func)).Call;
        return(d);
    }
Example #8
0
 public static Delegate UIEventListener_VectorDelegate(LuaFunction func)
 {
     UIEventListener.VectorDelegate 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);
 }
Example #9
0
 public static void TryRegistOnDrag(this GameObject go, UIEventListener.VectorDelegate action, bool isAddUp = false)
 {
     if (go == null)
     {
         return;
     }
     if (isAddUp)
     {
         UIEventListener.Get(go).onDrag += action;
     }
     else
     {
         UIEventListener.Get(go).onDrag = action;
     }
 }
Example #10
0
 static int VectorDelegate(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         LuaFunction arg0 = ToLua.CheckLuaFunction(L, 1);
         UIEventListener.VectorDelegate o = LuaHelper.VectorDelegate(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int set_onDrag(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIEventListener obj = (UIEventListener)o;
            UIEventListener.VectorDelegate arg0 = (UIEventListener.VectorDelegate)ToLua.CheckDelegate <UIEventListener.VectorDelegate>(L, 2);
            obj.onDrag = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onDrag on a nil value"));
        }
    }
    static int get_onDrag(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIEventListener obj = (UIEventListener)o;
            UIEventListener.VectorDelegate ret = obj.onDrag;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onDrag on a nil value"));
        }
    }
Example #13
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;
 }
Example #14
0
    private static int get_onDrag(IntPtr L)
    {
        object obj = null;
        int    result;

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

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

            l  = LuaState.get(l).L;
            ua = (UnityEngine.GameObject a1, UnityEngine.Vector2 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);
        }
Example #16
0
 public static void TryRegistOnDrag <T>(this Component component, string name, UIEventListener.VectorDelegate action, bool isAddUp = false) where T : Component
 {
     TryRegistOnDrag(component.transform.TryGetComponent <T>(name).gameObject, action, isAddUp);
 }
Example #17
0
 public static void TryRegistOnDrag(this Component component, UIEventListener.VectorDelegate action, bool isAddUp = false)
 {
     TryRegistOnDrag(component.gameObject, action, isAddUp);
 }
Example #18
0
 protected void RegistDrag(GameObject go, UIEventListener.VectorDelegate cb)
 {
     UIEventListener.Get(go).onDrag = cb;
     Attach(ref UIEventListener.Get(go).onDrag);
 }
Example #19
0
    public static void RegistOnDrag(this GameObject button, UIEventListener.VectorDelegate action)
    {
        UIEventListener listener = UIEventListener.Get(button);

        listener.onDrag = action;
    }
Example #20
0
 protected void ListenOnDrag(GameObject obj, UIEventListener.VectorDelegate callback)
 {
     UIEventListener.Get(obj).onDrag = callback;
 }