public static void Send(GameObject managerSubject, NetworkConnection recipient, TileChangeList changeList) { if (changeList == null || changeList.List.Count == 0) { return; } foreach (var changeChunk in changeList.List.ToArray().Chunk(MAX_CHANGES_PER_MESSAGE).Select(TileChangeList.FromList)) { foreach (var entry in changeChunk.List) { Logger.LogTraceFormat("Sending update for {0} layer {1}", Category.TileMaps, entry.Position, entry.LayerType); } string jsondata = JsonUtility.ToJson(changeChunk); TileChangesNewClientSync msg = new TileChangesNewClientSync { ManagerSubject = managerSubject.GetComponent <NetworkIdentity>().netId, data = jsondata }; msg.SendTo(recipient); } }
public static TileChangesNewClientSync Send(GameObject managerSubject, GameObject recipient, string jsondata) { TileChangesNewClientSync msg = new TileChangesNewClientSync { ManagerSubject = managerSubject.GetComponent <NetworkIdentity>().netId, data = jsondata }; msg.SendTo(recipient); return(msg); }