public async Task Process(INetworkMessage message, GameNetworkContext context) { if (await context.FaultyState(GameState.Online)) { return; } if (message is ShopPageRequest shopRequest) { const int pageSize = 6; await context.SendAsync(new ShopPageResponse() { Items = _shopItemDataStore.Search(shopRequest.Category, shopRequest.Part, shopRequest.Hero) .Skip((shopRequest.Page - 1) * pageSize) .Take(pageSize) .ToList() }); } }
public async Task Process(INetworkMessage message, GameNetworkContext context) { if (await context.FaultyState(GameState.Online)) { return; } if (message is ShopItemCountRequest shopRequest) { IEnumerable <ShopItem> list = _shopItemDataStore.Search(shopRequest.Category, shopRequest.Part, shopRequest.Hero); await context.SendAsync(new ShopItemCountResponse() { Category = shopRequest.Category, Part = shopRequest.Part, Hero = shopRequest.Hero, Pages = list.Count() }); } }