コード例 #1
0
    static int ObjectDelegate(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(LuaInterface.LuaFunction)))
            {
                LuaFunction arg0 = ToLua.ToLuaFunction(L, 1);
                UIEventListener.ObjectDelegate o = LuaHelper.ObjectDelegate(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(LuaInterface.LuaFunction), typeof(LuaInterface.LuaTable)))
            {
                LuaFunction arg0 = ToLua.ToLuaFunction(L, 1);
                LuaTable    arg1 = ToLua.ToLuaTable(L, 2);
                UIEventListener.ObjectDelegate o = LuaHelper.ObjectDelegate(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: LuaHelper.ObjectDelegate"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #2
0
    static int set_onDrop(IntPtr L)
    {
        object o = null;

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

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

            obj.onDrop = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onDrop on a nil value" : e.Message));
        }
    }
コード例 #3
0
        internal static int checkDelegate(IntPtr l, int p, out UIEventListener.ObjectDelegate 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.ObjectDelegate)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.ObjectDelegate)ld.d;
                return(result);
            }
            l  = LuaState.get(l).L;
            ua = delegate(GameObject a1, GameObject 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);
        }
コード例 #4
0
 public static UIEventListener.ObjectDelegate ObjectDelegate(LuaFunction func, LuaTable tab)
 {
     UIEventListener.ObjectDelegate action = (go, state) =>
     {
         func.Call(tab, go, state);
     };
     return(action);
 }
コード例 #5
0
    public static Delegate UIEventListener_ObjectDelegate(LuaFunction func)
    {
        if (func == null)
        {
            UIEventListener.ObjectDelegate fn = delegate { };
            return(fn);
        }

        UIEventListener.ObjectDelegate d = (new UIEventListener_ObjectDelegate_Event(func)).Call;
        return(d);
    }
コード例 #6
0
 public static Delegate UIEventListener_ObjectDelegate(LuaFunction func)
 {
     UIEventListener.ObjectDelegate 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);
 }
コード例 #7
0
ファイル: NGUIExtensions.cs プロジェクト: Hengle/QEngine
 public static void TryRegistOnDrop(this GameObject go, UIEventListener.ObjectDelegate action, bool isAddUp = false)
 {
     if (go == null)
     {
         return;
     }
     if (isAddUp)
     {
         UIEventListener.Get(go).onDrop += action;
     }
     else
     {
         UIEventListener.Get(go).onDrop = action;
     }
 }
コード例 #8
0
    static int get_onDrop(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIEventListener obj = (UIEventListener)o;
            UIEventListener.ObjectDelegate ret = obj.onDrop;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onDrop on a nil value"));
        }
    }
コード例 #9
0
    static int set_onDrop(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIEventListener obj = (UIEventListener)o;
            UIEventListener.ObjectDelegate arg0 = (UIEventListener.ObjectDelegate)ToLua.CheckDelegate <UIEventListener.ObjectDelegate>(L, 2);
            obj.onDrop = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onDrop on a nil value"));
        }
    }
コード例 #10
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;
 }
コード例 #11
0
    private static int get_onDrop(IntPtr L)
    {
        object obj = null;
        int    result;

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

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

            l  = LuaState.get(l).L;
            ua = (UnityEngine.GameObject a1, UnityEngine.GameObject 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);
        }
コード例 #13
0
ファイル: NGUIExtensions.cs プロジェクト: Hengle/QEngine
 public static void TryRegistOnDrop <T>(this Component component, string name, UIEventListener.ObjectDelegate action, bool isAddUp = false) where T : Component
 {
     TryRegistOnDrop(component.transform.TryGetComponent <T>(name).gameObject, action, isAddUp);
 }
コード例 #14
0
 public void AddDragDropDelegate(UIEventListener.ObjectDelegate del)
 {
     avatarSlot.AddDragDropDelegate(del);
 }
コード例 #15
0
ファイル: UIObject.cs プロジェクト: ChestnutGames/boxing
 protected void ListenOnDrop(GameObject obj, UIEventListener.ObjectDelegate callback)
 {
     UIEventListener.Get(obj).onDrop = callback;
 }
コード例 #16
0
 public void AddDragDropDelegate(UIEventListener.ObjectDelegate del)
 {
     eventBtn.enabled = true;
     UIEventListener.Get(eventBtn.gameObject).onDrop += del;
 }
コード例 #17
0
ファイル: UIEventNotifyHelper.cs プロジェクト: Hengle/Lua
    public static void RegistOnDrop(this GameObject button, UIEventListener.ObjectDelegate action)
    {
        UIEventListener listener = UIEventListener.Get(button);

        listener.onDrop = action;
    }
コード例 #18
0
ファイル: NGUIExtensions.cs プロジェクト: Hengle/QEngine
 public static void TryRegistOnDrop(this Component component, UIEventListener.ObjectDelegate action, bool isAddUp = false)
 {
     TryRegistOnDrop(component.gameObject, action, isAddUp);
 }