Example #1
0
        public StrongholdManager(IStrongholdConfigurator strongholdConfigurator,
                                 IStrongholdFactory strongholdFactory,
                                 IRegionManager regionManager,
                                 Chat chat,
                                 IDbManager dbManager,
                                 ISimpleStubGeneratorFactory simpleStubGeneratorFactory,
                                 Formula formula,
                                 ICityManager cityManager,
                                 IActionFactory actionFactory,
                                 ITileLocator tileLocator,
                                 ITroopObjectInitializerFactory troopInitializerFactory)
        {
            idGenerator = new LargeIdGenerator(Config.stronghold_id_max, Config.stronghold_id_min);
            strongholds = new ConcurrentDictionary <uint, IStronghold>();

            this.strongholdConfigurator = strongholdConfigurator;
            this.strongholdFactory      = strongholdFactory;
            this.regionManager          = regionManager;
            this.chat                    = chat;
            this.dbManager               = dbManager;
            this.formula                 = formula;
            this.actionFactory           = actionFactory;
            this.tileLocator             = tileLocator;
            this.troopInitializerFactory = troopInitializerFactory;

            cityManager.CityAdded += CityManagerCityAdded;
            simpleStubGenerator    = simpleStubGeneratorFactory.CreateSimpleStubGenerator(formula.StrongholdUnitRatio(), formula.StrongholdUnitType());
        }
Example #2
0
        public BattleManager(uint battleId,
                             BattleLocation location,
                             BattleOwner owner,
                             IRewardStrategy rewardStrategy,
                             IDbManager dbManager,
                             IBattleReport battleReport,
                             ICombatListFactory combatListFactory,
                             IBattleFormulas battleFormulas,
                             IBattleOrder battleOrder,
                             IBattleRandom battleRandom)
        {
            groupIdGen = new LargeIdGenerator(uint.MaxValue);
            idGen      = new LargeIdGenerator(uint.MaxValue);
            // Group id 1 is always reserved for local troop
            groupIdGen.Set(1);

            BattleId     = battleId;
            Location     = location;
            Owner        = owner;
            BattleReport = battleReport;
            Attackers    = combatListFactory.GetAttackerCombatList();
            Defenders    = combatListFactory.GetDefenderCombatList();

            this.rewardStrategy = rewardStrategy;
            this.dbManager      = dbManager;
            this.battleOrder    = battleOrder;
            this.battleFormulas = battleFormulas;
            this.battleRandom   = battleRandom;
        }