public void ProccessJson(JObject jObject) { try { ServerMessage serverMessage = ServerMessage.ParseData(jObject); Type type = Type.GetType(serverMessage.@class); MethodInfo methodInfo = type.GetMethod(serverMessage.method); ParameterInfo[] parameterInfos = methodInfo.GetParameters(); Player player = PlayerListener.GetInstance().FindPlayer(Convert.ToInt16(serverMessage.key)); List <object> functionParameters = ServerMessageUtils.CreateFunctionParameters(parameterInfos, serverMessage); Dispatcher.Instance.Invoke(() => InvokeMethod(methodInfo, player, functionParameters)); } catch (Exception e) { Console.WriteLine(e); } }
private void Start() { PlayerListener.GetInstance().Register(this); }