Пример #1
0
        public TestGame()
        {
            LoggerFactory           = new Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory();
            WorldStateFactory       = new TestWorldStateFactory();
            World                   = WorldStateFactory.CreateDevWorldState().ToMutable();
            GameDef                 = new TestGameDefFactory().CreateGameDef();
            ScoreRepository         = new ScoreRepository(GameDef, World);
            PlayerRepository        = new PlayerRepository(World, ScoreRepository);
            PlayerRepositoryWrite   = new PlayerRepositoryWrite(World);
            ResourceRepository      = new ResourceRepository(World, GameDef);
            ResourceRepositoryWrite = new ResourceRepositoryWrite(World, ResourceRepository);
            ActionQueueRepository   = new ActionQueueRepository(World);
            AssetRepository         = new AssetRepository(World, PlayerRepository, ActionQueueRepository);
            AssetRepositoryWrite    = new AssetRepositoryWrite(LoggerFactory.CreateLogger <AssetRepositoryWrite>(), World, AssetRepository, ResourceRepository, ResourceRepositoryWrite, ActionQueueRepository, GameDef);
            UnitRepository          = new UnitRepository(World, GameDef, PlayerRepository, AssetRepository);
            BattleBehavior          = new BattleBehaviorScoOriginal(LoggerFactory.CreateLogger <IBattleBehavior>());
            UnitRepositoryWrite     = new UnitRepositoryWrite(LoggerFactory.CreateLogger <UnitRepositoryWrite>(), World, GameDef, UnitRepository, ResourceRepositoryWrite, PlayerRepository, BattleBehavior);

            var services = new ServiceCollection();

            services.AddSingleton <IGameTickModule>(new ActionQueueExecutor(AssetRepositoryWrite));
            services.AddSingleton <IGameTickModule>(new ResourceGrowthSco(LoggerFactory.CreateLogger <ResourceGrowthSco>(), GameDef, ResourceRepository, ResourceRepositoryWrite, AssetRepository, UnitRepository));
            GameTickModuleRegistry = new GameTickModuleRegistry(LoggerFactory.CreateLogger <GameTickModuleRegistry>(), services.BuildServiceProvider(), GameDef);
            TickEngine             = new GameTickEngine(LoggerFactory.CreateLogger <GameTickEngine>(), World, GameDef, GameTickModuleRegistry, PlayerRepositoryWrite);
        }
Пример #2
0
 public UnitsController(ILogger <UnitsController> logger
                        , CurrentUserContext currentUserContext
                        , PlayerRepository playerRepository
                        , UnitRepository unitRepository
                        , UnitRepositoryWrite unitRepositoryWrite
                        , GameDef gameDef
                        )
 {
     this.logger              = logger;
     this.currentUserContext  = currentUserContext;
     this.playerRepository    = playerRepository;
     this.unitRepository      = unitRepository;
     this.unitRepositoryWrite = unitRepositoryWrite;
     this.gameDef             = gameDef;
 }
Пример #3
0
 public BattleController(ILogger <PlayerRankingController> logger
                         , GameDef gameDef
                         , CurrentUserContext currentUserContext
                         , ScoreRepository scoreRepository
                         , PlayerRepository playerRepository
                         , UnitRepository unitRepository
                         , UnitRepositoryWrite unitRepositoryWrite
                         )
 {
     this.logger              = logger;
     this.gameDef             = gameDef;
     this.currentUserContext  = currentUserContext;
     this.scoreRepository     = scoreRepository;
     this.playerRepository    = playerRepository;
     this.unitRepository      = unitRepository;
     this.unitRepositoryWrite = unitRepositoryWrite;
 }