public object ToObject() { if (ENSUtils.IsSimple(System.Type.GetType(jsonDataTypeName))) { return(System.Convert.ChangeType(jsonData, System.Type.GetType(jsonDataTypeName))); } else { return(JsonUtility.FromJson(jsonData, System.Type.GetType(jsonDataTypeName))); } }
public RPCPacketData(int netID, int rpcIndex, int ownerID, params object[] list) { this.networkObjectID = netID; this.rpcIndex = rpcIndex; this.packetOwnerID = ownerID; foreach (object o in list) { if (!ENSUtils.IsSimple(o.GetType())) { parameters.Add(JsonUtility.ToJson(o)); } else { parameters.Add("" + o); } paramTypes.Add(o.GetType().ToString()); } }
public RPCArgs ReturnArgs() { RPCArgs rpcArgs = new RPCArgs(); rpcArgs.ownerID = packetOwnerID; for (int i = 0; i < parameters.Count; i++) { if (!ENSUtils.IsSimple(System.Type.GetType(paramTypes[i]))) { rpcArgs.parameters.Add(JsonUtility.FromJson(parameters[i], System.Type.GetType(paramTypes[i]))); } else { System.Type t = System.Type.GetType(paramTypes[i]); rpcArgs.parameters.Add(System.Convert.ChangeType(parameters[i], t)); } } return(rpcArgs); }