/// <summary>Appends a description of this call.</summary> public void ToString(StringBuilder text) { text.Append("PersistentCall: MethodName="); text.Append(_MethodName); text.Append(", Target="); text.Append(_Target != null ? _Target.ToString() : "null"); text.Append(", PersistentArguments="); UltEventUtils.AppendDeepToString(text, _PersistentArguments.GetEnumerator(), "\n "); }
/************************************************************************************************************************/ /// <summary>Sets the method which this call encapsulates.</summary> public void SetMethod(MethodBase method, Object target) { _Method = method; _Target = target; if (method != null) { if (method.IsStatic || method.IsConstructor) { _MethodName = UltEventUtils.GetFullyQualifiedName(method); _Target = null; } else { _MethodName = method.Name; } var parameters = method.GetParameters(); if (_PersistentArguments == null || _PersistentArguments.Length != parameters.Length) { _PersistentArguments = NewArgumentArray(parameters.Length); } for (int i = 0; i < _PersistentArguments.Length; i++) { var parameter = parameters[i]; var persistentArgument = _PersistentArguments[i]; persistentArgument.SystemType = parameter.ParameterType; switch (persistentArgument.Type) { case PersistentArgumentType.Parameter: case PersistentArgumentType.ReturnValue: break; default: if ((parameter.Attributes & ParameterAttributes.HasDefault) == ParameterAttributes.HasDefault) { persistentArgument.Value = parameter.DefaultValue; } break; } } } else { _MethodName = null; _PersistentArguments = NoArguments; } }
/// <summary>Appends a description of this event.</summary> public void ToString(StringBuilder text) { text.Append(GetType().GetNameCS()); text.Append(": PersistentCalls="); UltEventUtils.AppendDeepToString(text, _PersistentCalls.GetEnumerator(), "\n "); text.Append("\n DynamicCalls="); #if UNITY_EDITOR var invocationList = GetDynamicCallInvocationList(); #else var invocationList = DynamicCallsBase != null?DynamicCallsBase.GetInvocationList() : null; #endif var enumerator = invocationList != null?invocationList.GetEnumerator() : null; UltEventUtils.AppendDeepToString(text, enumerator, "\n "); }