private async Task <WorldEntity> GetFullWorld(string worldGuid, ICrvServiceContext context) { return(await context.Worlds .Include(c => c.CityCollection).ThenInclude(c => c.BuildingCollection).ThenInclude(c => c.CargoCollection) .Include(c => c.PlayerCollection) .FirstOrDefaultAsync(c => c.Guid == worldGuid)); }
private async Task DeleteExecutedClientCommands(ICrvServiceContext context) { if (Options.DeleteExecutedClientCommands) { await context.DeleteExecutedClientCommands(); } }
public WorldRepositoryEntity(ICrvServiceContext context) { Context = context; }
private async Task ProcessWorld(string worldGuid, ClientCommandEntity[] commands, ICrvServiceContext context) { var world = await GetFullWorld(worldGuid, context); IPlayer player = null; var processedPlayers = new List <string>(); foreach (var command in commands) { if (player == null || !processedPlayers.Contains(player.Guid)) { player = world.PlayerCollection.FirstOrDefault(c => c.Guid == command.PlayerGuid); if (player != null) { ProcessorsProvider.Process(player); processedPlayers.Add(player.Guid); } } ProcessorsProvider.ProcessClientCommand(command, world, player); } ProcessorsProvider.Process(world); }
public Instances(ICrvServiceContext context, INewInstanceFactory newInstanceFactory) { WorldRepository = new WorldRepositoryEntity(context); ProcessorsProvider = new ProcessorsProvider(newInstanceFactory); NewWorldGenerator = new NewWorldGenerator(newInstanceFactory, WorldRepository); }