private static string GetEventParams(TestityEventBase evt) { MethodInfo methodInfo = evt.FindMethod("Invoke", evt, TestityPersistentListenerMode.EventDefined, null); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(" ("); Type[] array = ( from x in methodInfo.GetParameters() select x.ParameterType).ToArray <Type>(); for (int i = 0; i < array.Length; i++) { stringBuilder.Append(array[i].Name); if (i < array.Length - 1) { stringBuilder.Append(", "); } } stringBuilder.Append(")"); return(stringBuilder.ToString()); }
public static bool IsPersistantListenerValid(TestityEventBase dummyEvent, string methodName, UnityEngine.Object uObject, TestityPersistentListenerMode modeEnum, Type argumentType) { return !(uObject == null) && !string.IsNullOrEmpty(methodName) && dummyEvent.FindMethod(methodName, uObject, modeEnum, argumentType) != null; }
private static string GetEventParams(TestityEventBase evt) { MethodInfo methodInfo = evt.FindMethod("Invoke", evt, TestityPersistentListenerMode.EventDefined, null); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(" ("); Type[] array = ( from x in methodInfo.GetParameters() select x.ParameterType).ToArray<Type>(); for (int i = 0; i < array.Length; i++) { stringBuilder.Append(array[i].Name); if (i < array.Length - 1) { stringBuilder.Append(", "); } } stringBuilder.Append(")"); return stringBuilder.ToString(); }
public TestityBaseInvokableCall GetRuntimeCall(TestityEventBase theEvent) { if (this.m_CallState == TestityEventCallState.RuntimeOnly && !Application.isPlaying) { return null; } if (this.m_CallState == TestityEventCallState.Off || theEvent == null) { return null; } MethodInfo methodInfo = theEvent.FindMethod(this); if (methodInfo == null) { return null; } switch (this.m_Mode) { case TestityPersistentListenerMode.EventDefined: { return theEvent.GetDelegate(this.target, methodInfo); } case TestityPersistentListenerMode.Void: { return new TestityInvokableCall(this.target, methodInfo); } case TestityPersistentListenerMode.Object: { return TestityPersistentCall.GetObjectCall(this.target, methodInfo, this.m_Arguments); } case TestityPersistentListenerMode.Int: { return new TestityCachedInvokableCall<int>(this.target, methodInfo, this.m_Arguments.intArgument); } case TestityPersistentListenerMode.Float: { return new TestityCachedInvokableCall<float>(this.target, methodInfo, this.m_Arguments.floatArgument); } case TestityPersistentListenerMode.String: { return new TestityCachedInvokableCall<string>(this.target, methodInfo, this.m_Arguments.stringArgument); } case TestityPersistentListenerMode.Bool: { return new TestityCachedInvokableCall<bool>(this.target, methodInfo, this.m_Arguments.boolArgument); } } return null; }
public static bool IsPersistantListenerValid(TestityEventBase dummyEvent, string methodName, UnityEngine.Object uObject, TestityPersistentListenerMode modeEnum, Type argumentType) { return(!(uObject == null) && !string.IsNullOrEmpty(methodName) && dummyEvent.FindMethod(methodName, uObject, modeEnum, argumentType) != null); }