Esempio n. 1
0
        public static bool IsUnityEventHasError(UnityEngine.Events.UnityEventBase ev)
        {
            if (ev == null)
            {
                return(true);
            }

            var count = ev.GetPersistentEventCount();

            for (var i = 0; i < count; i++)
            {
                var target = ev.GetPersistentTarget(i);
                if (target == null)
                {
                    return(true);
                }

                var methodName = ev.GetPersistentMethodName(i);
                if (string.IsNullOrEmpty(methodName))
                {
                    return(true);
                }

                var type = target.GetType();
                if (type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
                    .All(m => m.Name != methodName))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
 public static void SwitchListenerState(this UnityEngine.Events.UnityEventBase eventBase, UnityEngine.Events.UnityEventCallState newState)
 {
     for (int i = 0; i < eventBase.GetPersistentEventCount(); i++)
     {
         eventBase.SetPersistentListenerState(i, newState);
     }
 }
Esempio n. 3
0
        public static void UnMuteEventListener(UnityEngine.Events.UnityEventBase eventBase)
        {
            var count = eventBase.GetPersistentEventCount();

            for (var x = 0; x < count; x++)
            {
                eventBase.SetPersistentListenerState(x, UnityEngine.Events.UnityEventCallState.RuntimeOnly);
            }
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="response"></param>
        /// <param name="index"></param>
        /// <returns>return one of the <seealso cref="ListenerValidionState"/></returns>
        public static ListenerValidionState ValidedResponse(UnityEngine.Events.UnityEventBase response, int index)
        {
            if (response.GetPersistentTarget(index) == null)
            {
                return(ListenerValidionState.MissingTarget);
            }
            if (string.IsNullOrEmpty(response.GetPersistentMethodName(index)))
            {
                return(ListenerValidionState.MissingMethod);
            }

            return(ListenerValidionState.Valid);
        }
Esempio n. 5
0
        static StackObject *RemoveAllListeners_0(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, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Events.UnityEventBase instance_of_this_method = (UnityEngine.Events.UnityEventBase) typeof(UnityEngine.Events.UnityEventBase).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.RemoveAllListeners();

            return(__ret);
        }
Esempio n. 6
0
        static StackObject *ToString_5(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Events.UnityEventBase instance_of_this_method = (UnityEngine.Events.UnityEventBase) typeof(UnityEngine.Events.UnityEventBase).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.ToString();

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Esempio n. 7
0
        static StackObject *GetPersistentEventCount_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Events.UnityEventBase instance_of_this_method = (UnityEngine.Events.UnityEventBase) typeof(UnityEngine.Events.UnityEventBase).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetPersistentEventCount();

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method;
            return(__ret + 1);
        }
Esempio n. 8
0
        static StackObject *GetPersistentMethodName_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @index = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Events.UnityEventBase instance_of_this_method = (UnityEngine.Events.UnityEventBase) typeof(UnityEngine.Events.UnityEventBase).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetPersistentMethodName(@index);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Esempio n. 9
0
        static int _m_RemoveAllListeners(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.Events.UnityEventBase __cl_gen_to_be_invoked = (UnityEngine.Events.UnityEventBase)translator.FastGetCSObj(L, 1);


            try {
                {
                    __cl_gen_to_be_invoked.RemoveAllListeners(  );



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 10
0
        static int _m_GetPersistentEventCount(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.Events.UnityEventBase __cl_gen_to_be_invoked = (UnityEngine.Events.UnityEventBase)translator.FastGetCSObj(L, 1);


            try {
                {
                    int __cl_gen_ret = __cl_gen_to_be_invoked.GetPersistentEventCount(  );
                    LuaAPI.xlua_pushinteger(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 11
0
        static StackObject *SetPersistentListenerState_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.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.Events.UnityEventCallState @state = (UnityEngine.Events.UnityEventCallState) typeof(UnityEngine.Events.UnityEventCallState).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 @index = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.Events.UnityEventBase instance_of_this_method = (UnityEngine.Events.UnityEventBase) typeof(UnityEngine.Events.UnityEventBase).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.SetPersistentListenerState(@index, @state);

            return(__ret);
        }
Esempio n. 12
0
        static int _m_ToString(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                UnityEngine.Events.UnityEventBase gen_to_be_invoked = (UnityEngine.Events.UnityEventBase)translator.FastGetCSObj(L, 1);



                {
                    string gen_ret = gen_to_be_invoked.ToString(  );
                    LuaAPI.lua_pushstring(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 13
0
        static int _m_SetPersistentListenerState(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.Events.UnityEventBase __cl_gen_to_be_invoked = (UnityEngine.Events.UnityEventBase)translator.FastGetCSObj(L, 1);


            try {
                {
                    int index = LuaAPI.xlua_tointeger(L, 2);
                    UnityEngine.Events.UnityEventCallState state; translator.Get(L, 3, out state);

                    __cl_gen_to_be_invoked.SetPersistentListenerState(index, state);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 14
0
        static int _m_GetPersistentTarget(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                UnityEngine.Events.UnityEventBase gen_to_be_invoked = (UnityEngine.Events.UnityEventBase)translator.FastGetCSObj(L, 1);



                {
                    int _index = LuaAPI.xlua_tointeger(L, 2);

                    UnityEngine.Object gen_ret = gen_to_be_invoked.GetPersistentTarget(_index);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }