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 void NotifyPlayer(GameObject requestedBy)
 {
     if (changeList.List.Count > 0)
     {
         TileChangesNewClientSync.Send(gameObject, requestedBy, changeList);
     }
 }
 public void UpdateNewPlayer(NetworkConnection requestedBy)
 {
     if (changeList.List.Count > 0)
     {
         TileChangesNewClientSync.Send(gameObject, requestedBy, changeList);
     }
 }
    public void NotifyPlayer(GameObject requestedBy)
    {
        if (changeList.List.Count > 0)
        {
            Logger.LogFormat("Request all updates: ", Category.TileMaps, requestedBy.name);
            string jsondata = JsonUtility.ToJson(changeList);

            TileChangesNewClientSync.Send(gameObject, requestedBy, jsondata);
        }
    }
Example #5
0
    public void NotifyPlayer(GameObject requestedBy)
    {
        if (changeList.List.Count > 0)
        {
            Debug.Log("Request all updates: " + requestedBy.name);
            string jsondata = JsonUtility.ToJson(changeList);

            TileChangesNewClientSync.Send(gameObject, requestedBy, jsondata);
        }
    }
    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);
    }