Ejemplo n.º 1
0
        static internal int checkDelegate(IntPtr l, int p, out UnityEngine.EventSystems.ExecuteEvents.EventFunction <UnityEngine.EventSystems.ISelectHandler> 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.EventSystems.ExecuteEvents.EventFunction <UnityEngine.EventSystems.ISelectHandler>)checkObj(l, p);
                return(op);
            }
            if (LuaDLL.lua_isnil(l, -1))
            {
                ua = null;
                return(op);
            }
            LuaDelegate ld;

            checkType(l, -1, out ld);
            LuaDLL.lua_pop(l, 1);
            if (ld.d != null)
            {
                ua = (UnityEngine.EventSystems.ExecuteEvents.EventFunction <UnityEngine.EventSystems.ISelectHandler>)ld.d;
                return(op);
            }

            l  = LuaState.get(l).L;
            ua = (UnityEngine.EventSystems.ISelectHandler a1, UnityEngine.EventSystems.BaseEventData 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);
        }
Ejemplo n.º 2
0
        static internal int checkDelegate(IntPtr l, int p, out UnityEngine.EventSystems.ExecuteEvents.EventFunction <UnityEngine.EventSystems.ICancelHandler> 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.EventSystems.ExecuteEvents.EventFunction <UnityEngine.EventSystems.ICancelHandler> >(r, out ua))
            {
                return(op);
            }
            LuaDLL.lua_pop(l, 1);
            ua = (UnityEngine.EventSystems.ICancelHandler a1, UnityEngine.EventSystems.BaseEventData a2) =>
            {
                int error = pushTry(l);
                LuaDLL.lua_getref(l, r);

                pushValue(l, a1);
                pushValue(l, a2);
                if (LuaDLL.lua_pcall(l, 2, -1, error) != 0)
                {
                    LuaDLL.lua_pop(l, 1);
                }
                LuaDLL.lua_pop(l, 1);
            };
            cacheDelegate(r, ua);
            return(op);
        }
Ejemplo n.º 3
0
        public static GameObject ExecuteHierarchy <T>(GameObject root, BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents.EventFunction <T> callbackFunction) where T : IEventSystemHandler
        {
            GetEventChain.Invoke(null, new object[] { root, InternalTransformList });
            // GetEventChain(root, s_InternalTransformList);
            GameObject          firstExecuteObject = null;
            UPointerEventDataEx eventDataEx        = eventData as UPointerEventDataEx;

            for (var i = 0; i < InternalTransformList.Count; i++)
            {
                var transform = InternalTransformList[i];

                //当前找到第一个处理事件的对象且需要进行冒泡处理
                if (UnityEngine.EventSystems.ExecuteEvents.Execute(transform.gameObject, eventData, callbackFunction))
                {
                    if (firstExecuteObject == null)
                    {
                        firstExecuteObject = transform.gameObject;
                    }

                    if (eventDataEx == null || !eventDataEx.CanBubbleEvent)
                    {
                        return(firstExecuteObject);
                    }
                }
            }
            return(firstExecuteObject);
        }
Ejemplo n.º 4
0
        static StackObject *Execute_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.EventSystems.ExecuteEvents.EventFunction <UnityEngine.EventSystems.ISubmitHandler> @functor = (UnityEngine.EventSystems.ExecuteEvents.EventFunction <UnityEngine.EventSystems.ISubmitHandler>) typeof(UnityEngine.EventSystems.ExecuteEvents.EventFunction <UnityEngine.EventSystems.ISubmitHandler>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.EventSystems.BaseEventData @eventData = (UnityEngine.EventSystems.BaseEventData) typeof(UnityEngine.EventSystems.BaseEventData).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.GameObject @target = (UnityEngine.GameObject) typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = UnityEngine.EventSystems.ExecuteEvents.Execute <UnityEngine.EventSystems.ISubmitHandler>(@target, @eventData, @functor);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
Ejemplo n.º 5
0
        public static void ExecuteDownInHierarchy <T>(GameObject root, BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents.EventFunction <T> callbackFunction) where T : IEventSystemHandler
        {
            s_InternalTransformList.Clear();
            GetEventChainChildren(root.transform, s_InternalTransformList);

            for (var i = 0; i < s_InternalTransformList.Count; i++)
            {
                var transform = s_InternalTransformList[i];
                ExecuteEvents.Execute(transform.gameObject, eventData, callbackFunction);
            }
        }