Пример #1
0
 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));
 }
Пример #2
0
 private async Task DeleteExecutedClientCommands(ICrvServiceContext context)
 {
     if (Options.DeleteExecutedClientCommands)
     {
         await context.DeleteExecutedClientCommands();
     }
 }
Пример #3
0
 public WorldRepositoryEntity(ICrvServiceContext context)
 {
     Context = context;
 }
Пример #4
0
        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);
        }
Пример #5
0
 public Instances(ICrvServiceContext context, INewInstanceFactory newInstanceFactory)
 {
     WorldRepository    = new WorldRepositoryEntity(context);
     ProcessorsProvider = new ProcessorsProvider(newInstanceFactory);
     NewWorldGenerator  = new NewWorldGenerator(newInstanceFactory, WorldRepository);
 }