public void RetreatUnits_RetreatsStationedUnitsThatAreNotInTribeThatOwnsStronghold( IStronghold stronghold, [FrozenMock] IActionFactory actionFactory, [FrozenMock] ITroopObjectInitializerFactory troopInitializerFactory, ITroopObjectInitializer troopInitializer, ITroopStub stub, ITribe tribe, ITribe shTribe, RetreatChainAction retreatAction, StrongholdManager strongholdManager) { stub.State.Returns(TroopState.Stationed); stub.City.Owner.IsInTribe.Returns(true); stub.City.Id.Returns<uint>(1234); stub.TroopId.Returns<ushort>(2); stub.City.Owner.Tribesman.Tribe.Returns(tribe); stronghold.MainBattle.Returns((IBattleManager)null); stronghold.Tribe.Returns(shTribe); stronghold.Troops.StationedHere().Returns(new[] { stub }); troopInitializerFactory.CreateStationedTroopObjectInitializer(stub).Returns(troopInitializer); actionFactory.CreateRetreatChainAction(stub.City.Id, troopInitializer).Returns(retreatAction); strongholdManager.RetreatUnits(stronghold); stub.City.Worker.Received(1).DoPassive(stub.City, retreatAction, true); }
/// <summary> /// Initializes a new instance of the <see cref="CommandMessage"/> class. /// </summary> public CommandMessage() { if (!PresentationFrameworkModule.IsInDesignMode) { _actionFactory = ServiceLocator.Current.GetInstance <IActionFactory>(); } }
/// <summary> /// Initializes property host. /// </summary> /// <param name="controller">The controller.</param> /// <param name="actionFactory">The action factory.</param> /// <param name="serviceLocator">The service locator.</param> public static void Initialize(IRoutedMessageController controller, IActionFactory actionFactory, IServiceLocator serviceLocator) { _controller = controller; _actionFactory = actionFactory; _serviceLocator = serviceLocator; }
/// <summary> /// Initializes property host. /// </summary> /// <param name="controller">The controller.</param> /// <param name="actionFactory">The action factory.</param> /// <param name="serviceLocator">The service locator.</param> public static void Initialize(IRoutedMessageController controller, IActionFactory actionFactory, IServiceLocator serviceLocator) { _controller = controller; _actionFactory = actionFactory; _serviceLocator = serviceLocator; }
public CombatStructure(uint id, uint battleId, IStructure structure, BattleStats stats, decimal hp, ushort type, byte lvl, string theme, Formula formula, IActionFactory actionFactory, IBattleFormulas battleFormulas, ITileLocator tileLocator, IRegionManager regionManager, IDbManager dbManager) : base(id, battleId, battleFormulas, dbManager) { Structure = structure; this.formula = formula; this.actionFactory = actionFactory; this.tileLocator = tileLocator; this.regionManager = regionManager; this.stats = stats; this.hp = hp; this.type = type; this.lvl = lvl; this.Theme = theme; }
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()); }
public LoginCommandsModule(IActionFactory actionFactory, ITribeManager tribeManager, IDbManager dbManager, ILocker locker, IWorld world, Procedure procedure, ICityFactory cityFactory, ILocationStrategyFactory locationStrategyFactory, IBarbarianTribeManager barbarianTribeManager, CallbackProcedure callbackProcedure, IChannel channel, IThemeManager themeManager, IPlayerFactory playerFactory, ILoginHandler loginHandler) { this.actionFactory = actionFactory; this.tribeManager = tribeManager; this.dbManager = dbManager; this.locker = locker; this.world = world; this.procedure = procedure; this.callbackProcedure = callbackProcedure; this.channel = channel; this.themeManager = themeManager; this.playerFactory = playerFactory; this.loginHandler = loginHandler; this.cityFactory = cityFactory; this.locationStrategyFactory = locationStrategyFactory; this.barbarianTribeManager = barbarianTribeManager; }
public GoToActivity(IActionFactory actionFactory, NavigationData navigationData, INavigator navigator, string name) : base(name) { _actionFactory = actionFactory; _navigationData = navigationData; _destination = navigationData.Destination; _navigator = navigator; }
public void RegisterFactory(IActionFactory factory, params string[] actionNames) { foreach (string actionName in GetValidActionNames(actionNames)) { factories[actionName] = factory; } }
public async Task <bool> ResolveAction(Phase speed, Present present, SelfCtx ctx) { // ------------- // Select Actions to resolve // ------------- IActionFactory[] options = this.GetAvailableActions(speed).ToArray(); IActionFactory option = await this.SelectFactory("Select " + speed + " to resolve:", options, present); if (option == null) { return(false); } // if user clicked a slow card that was made fast, // slow card won't be in the options if (!options.Contains(option)) { // find the fast version of the slow card that was clicked option = options.Cast <IActionFactory>() .First(factory => factory == option); } if (!options.Contains(option)) { throw new Exception("Dude! - You selected something that wasn't an option"); } await TakeAction(option, ctx); return(true); }
public GeneralDataFlow(IURIDiscovery uriDiscovery, ICacheService cacheServcie, IActionFactory actionFactory) { _URIDiscovery = uriDiscovery; _cacheService = cacheServcie; _actionFactory = actionFactory; }
public GeneralDataFlow(IURIDiscovery uriDiscovery, ICacheService cacheServcie, IActionFactory actionFactory) { _URIDiscovery = uriDiscovery; _cacheService = cacheServcie; _actionFactory = actionFactory; }
public AiActionResolver(IActionFactory actionFactory, IUtilityAi utilityAi, IActivityCreationContext activityCreationContext, IActivityResolver activityResolver) { _actionFactory = actionFactory; _utilityAi = utilityAi; _activityCreationContext = activityCreationContext; _activityResolver = activityResolver; }
public void SetActionFactory(IActionFactory actionFactory) { if (actionFactory == null) { throw new ArgumentNullException("actionFactory"); } _factoryActivator = () => actionFactory; }
public static Menu FromConfig(MenuConfiguration config, IActionFactory actionFactory) { return(new Menu( CommandBindingCollection.FromCollection(config.CommandBindings, actionFactory), config.Pages.Select((p, i) => MenuPage.FromConfig(p, i, actionFactory)), config.Help, config.Help2)); }
/// <summary> /// Initializes a new instance of the <see cref="CommandMessage"/> class. /// </summary> public CommandMessage() { if (!PresentationFrameworkModule.IsInDesignMode) { _actionFactory = ServiceLocator.Current.GetInstance <IActionFactory>(); } SetValue(ParametersProperty, new FreezableCollection <Parameter>()); }
public InventoryService(IActionFactory actionFactory, IInventoryRepository inventoryRepository, IUserService userService, ISlackWebApi slack, ITargetActionFactory targetFactory, IEquipmentRepository equipmentRepository) { _actionFactory = actionFactory; _inventoryRepository = inventoryRepository; _userService = userService; _slack = slack; _targetFactory = targetFactory; _equipmentRepository = equipmentRepository; }
public override async Task TakeAction(IActionFactory factory, SelfCtx ctx) { actionElements = null; // make sure these are cleared out for every action try { await base.TakeAction(factory, ctx); } finally { actionElements = null; } }
public static long GetSize(IActionFactory actionFactory) { using (Stream s = new MemoryStream()) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(s, actionFactory); return(s.Length); } }
public static MenuPage FromConfig(PageConfiguration config, int index, IActionFactory actionFactory) { return(new MenuPage( index, config.Help, config.Help2, CommandBindingCollection.FromCollection(config.CommandBindings, actionFactory), config.Items.Select((item, i) => PageItem.FromConfig(item, i, config.Items.Count, actionFactory)))); }
public CityCommandLineModule(Procedure procedure, IActionFactory actionFactory, ILocker locker, IWorld world) { this.procedure = procedure; this.actionFactory = actionFactory; this.locker = locker; this.world = world; }
public ApproachActivity(IActionFactory actionFactory, INavigator navigator, Func <Position> targetPositionGetter, int turnsLimit, string name) : base(name) { _actionFactory = actionFactory; _navigator = navigator; _targetPositionGetter = targetPositionGetter; _turnsLimit = turnsLimit; _lastTargetPosition = targetPositionGetter(); }
public ResourceGatherActiveAction(ILocker locker, IObjectTypeFactory objectTypeFactory, IWorld world, IActionFactory actionFactory) { this.locker = locker; this.objectTypeFactory = objectTypeFactory; this.world = world; this.actionFactory = actionFactory; }
public override void Initialize() { foreach (var behavior in behaviors) behavior.Value.Initialize(); actionManager = GameServiceManager.GetService<IActionManager>(); ActionFactory = GameServiceManager.GetService<IActionFactory>(); behaviorFactory = GameServiceManager.GetService<IBehaviorFactory>(); base.Initialize(); }
/// <summary> /// Adds the actions from the specified factory. /// </summary> /// <param name="actionFactory">The action factory.</param> public void Add(IActionFactory actionFactory) { if (actionFactory == null) { throw new ArgumentNullException("actionFactory"); } ICollection <Action> newActions = actionFactory.CreateActions(); Add(newActions); }
public ResourceGatherActiveAction(uint cityId, uint objectId, ILocker locker, IObjectTypeFactory objectTypeFactory, IWorld world, IActionFactory actionFactory) : this(locker, objectTypeFactory, world, actionFactory) { this.cityId = cityId; this.objectId = objectId; }
public BarbarianTribeAttackChainAction(IActionFactory actionFactory, Procedure procedure, ILocker locker, IGameObjectLocator gameObjectLocator, BattleProcedure battleProcedure) { this.actionFactory = actionFactory; this.procedure = procedure; this.locker = locker; this.gameObjectLocator = gameObjectLocator; this.battleProcedure = battleProcedure; }
public CityDefenseChainAction(BattleProcedure battleProcedure, IActionFactory actionFactory, ILocker locker, IWorld world, Procedure procedure) { this.battleProcedure = battleProcedure; this.actionFactory = actionFactory; this.locker = locker; this.world = world; this.procedure = procedure; }
private IAction CreateActionInstance(IActionFactory factory) { try { return(factory.Build()); } catch (Exception exception) { logger.Warn($"Error on action instanciation.", factory, exception); return(null); } }
/// <summary> /// Initializes a new instance of the <see cref="ActionHost"/> class. /// </summary> /// <param name="targetType">Type of the target.</param> /// <param name="factory">The factory.</param> /// <param name="serviceLocator">The container</param> public ActionHost(Type targetType, IActionFactory factory, IServiceLocator serviceLocator) { _targetType = targetType; _serviceLocator = serviceLocator; AddMetadataFrom(targetType); _filters = new FilterManager(_targetType, this, serviceLocator); foreach(var action in factory.CreateFor(this)) { _actions[action.Name] = action; } }
public RequestController(IActionFactory actionFactory, IRequest request) { this.actionFactory = actionFactory; this.request = request; }
public Controller(IActionFactory actionFactory) { _actionFactory = actionFactory; }
public Dispacher(IActionFactory commandFactory) { this.ActionFactory = commandFactory; //this.BinderFactory = binderFactory; }
public FinTsService(IActionFactory actionFactory, ITanSourceFactory tanSourceFactory, IInputOutput io) { this.actionFactory = actionFactory; this.tanSourceFactory = tanSourceFactory; this.io = io; }
public void SetActionFactory(IActionFactory actionFactory) { if (actionFactory == null) { throw new ArgumentNullException("actionFactory"); } _factoryActivator = () => actionFactory; }
/// <summary> /// register a new action /// </summary> /// <param name="id">the id of the action</param> /// <param name="factory">factory to construct the action</param> public void registerAction(XnaScrapId id, IActionFactory factory) { if (!m_registeredAction.Keys.Contains(id)) m_registeredAction.Add(id, factory); else { // TODO throw exception } }
/// <summary> /// Adds the actions from the specified factory. /// </summary> /// <param name="actionFactory">The action factory.</param> public void Add(IActionFactory actionFactory) { if (actionFactory == null) { throw new ArgumentNullException("actionFactory"); } ICollection<Action> newActions = actionFactory.CreateActions(); Add(newActions); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultBinder"/> class. /// </summary> /// <param name="serviceLocator">The service locator.</param> /// <param name="actionFactory">The action factory.</param> /// <param name="messageBinder">The message binder.</param> public DefaultBinder(IServiceLocator serviceLocator, IActionFactory actionFactory, IMessageBinder messageBinder) { _serviceLocator = serviceLocator; _actionFactory = actionFactory; _messageBinder = messageBinder; }
public HelloWorldController(IActionFactory actionFactory) { this.actionFactory = actionFactory; }
public RequestController(IActionFactory actionFactory, IRequest request, IFingerprintFactory fingerprintFactory) { this.actionFactory = actionFactory; this.request = request; this.fingerprintFactory = fingerprintFactory; }