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); } }
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); }
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); } }
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); }
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)); } }