Exemplo n.º 1
0
 public MessagesSpan <T> Slice(int index, int count)
 {
     Assert.IsTrue(index >= 0);
     Assert.IsTrue(index + count <= Count);
     return(count == 0
         ? MessagesSpan <T> .Empty()
         : new MessagesSpan <T>(this, index, count));
 }
Exemplo n.º 2
0
        IDiffCommandResponseStorage <WorldCommands.CreateEntity.ReceivedResponse> .GetResponse(CommandRequestId requestId)
        {
            if (!createEntitySorted)
            {
                createEntityResponses.Sort(comparer);
                createEntitySorted = true;
            }

            var responseIndex = createEntityResponses.GetResponseIndex(requestId);

            return(responseIndex.HasValue
                ? createEntityResponses.Slice(responseIndex.Value, 1)
                : MessagesSpan <WorldCommands.CreateEntity.ReceivedResponse> .Empty());
        }
Exemplo n.º 3
0
        IDiffCommandResponseStorage <WorldCommands.EntityQuery.ReceivedResponse> .GetResponse(CommandRequestId requestId)
        {
            if (!entityQueriesSorted)
            {
                entityQueryResponses.Sort(comparer);
                entityQueriesSorted = true;
            }

            var responseIndex = entityQueryResponses.GetResponseIndex(requestId);

            return(responseIndex.HasValue
                ? entityQueryResponses.Slice(responseIndex.Value, 1)
                : MessagesSpan <WorldCommands.EntityQuery.ReceivedResponse> .Empty());
        }
Exemplo n.º 4
0
        IDiffCommandResponseStorage <WorldCommands.ReserveEntityIds.ReceivedResponse> .GetResponse(CommandRequestId requestId)
        {
            if (!reserveEntityIdsSorted)
            {
                reserveEntityIdsResponses.Sort(comparer);
                reserveEntityIdsSorted = true;
            }

            var responseIndex = reserveEntityIdsResponses.GetResponseIndex(requestId);

            return(responseIndex.HasValue
                ? reserveEntityIdsResponses.Slice(responseIndex.Value, 1)
                : MessagesSpan <WorldCommands.ReserveEntityIds.ReceivedResponse> .Empty());
        }
        IDiffCommandResponseStorage <WorldCommands.DeleteEntity.ReceivedResponse> .GetResponse(long requestId)
        {
            if (!deleteEntitySorted)
            {
                deleteEntityResponses.Sort(comparer);
                deleteEntitySorted = true;
            }

            var responseIndex = deleteEntityResponses.GetResponseIndex(requestId);

            return(responseIndex.HasValue
                ? deleteEntityResponses.Slice(responseIndex.Value, 1)
                : MessagesSpan <WorldCommands.DeleteEntity.ReceivedResponse> .Empty());
        }