public RPCMethodHelper GetMethodHelper(string name) { var helper = methodHelpers[name]; if (helper == null) { MethodInfo methodInfo = null; object listener = null; foreach (object listen in listenerList) { listener = listen; methodInfo = listener.GetType().GetMethod(name, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); if (methodInfo != null) { break; } } if (methodInfo != null) { helper = new RPCMethodHelper { listener = listener, method = methodInfo }; methodHelpers.Add(name, helper); } } return(helper); }
public void Dump() { StringBuilder sb = new StringBuilder(); foreach (var pair in methodHelpers) { RPCMethodHelper helper = pair.Value; if (helper.method.DeclaringType != null) { sb.AppendFormat("\t<name:{0}, \tmethod:{1}.{2}>\n", pair.Key, helper.method.DeclaringType.Name, helper.method.Name); } } GameFramework.Debug.Debuger.LogWarning("\nRPC Cached Methods ({0}):\n{1}", methodHelpers.Count, sb); }