Esempio n. 1
0
 public void UpdateQuality()
 {
     foreach (var item in items)
     {
         StrategySelector.GetStrategy(item).Update(item);
     }
 }
        public Alien SelectShootingAlien(Entity target)
        {
            var atPlayerAlien = _atPlayerStrategy.SelectShootingAlien(target);

            if (StrategySelector.UseFirstStrategy())
            {
                return(atPlayerAlien);
            }

            return(_randomlyStrategy.SelectShootingAlienExcludingAliens(target, new List <Alien>(1)
            {
                atPlayerAlien
            }));
        }
Esempio n. 3
0
        public MainViewModel()
        {
            var speaker = new SpeakerDummy();
            //var listener = new ListenerDummy();

            IStrategyFactory strategyFactory = new StrategyFactory(speaker, _listener);
            var strategySelector             = new StrategySelector();
            var worldSource = new XmlWorldSource();

            var appl = new Appl(strategyFactory, strategySelector, worldSource);

            _appl = appl;
            //_appl.Run();


            Update();
        }
Esempio n. 4
0
        public static void Execute(string inputPath, string outputPath)
        {
            ILogger logger = Logging.CreateLogger <EntryPoint>();
            IList <CountryShippingModel> outputModel = new List <CountryShippingModel>();
            var serviceProvider = new ServiceCollection()
                                  .AddSingleton <IFileInputProcessor <InputModel> >(x => new FileInputProcessor <InputModel>())
                                  .AddSingleton <IFileOutputProcessor <List <CountryShippingModel> > >(x => new GenerateOutput <List <CountryShippingModel> >())
                                  .BuildServiceProvider();

            var fileHandler     = serviceProvider.GetService <IFileInputProcessor <InputModel> >();
            var outputGenerator = serviceProvider.GetService <GenerateOutput <IList <CountryShippingModel> > >();

            var inputData = fileHandler.ProcessFile(new StreamReader(AppConstants.FILE_INPUT_PATH));

            var model = MapCountryShippingModel.Map(inputData);

            foreach (var item in model)
            {
                StrategySelector selector = new StrategySelector(item);
                var shippingInfo          = selector.ShippingStrategy.ShippingInformation(item);
                outputModel.Add(shippingInfo);
            }
        }
        void Draw(Graphics graphics, LabelRow row, float x, ref float y)
        {
            var placeholers = GetPlaceholders(row.Text);

            var rowHeight = 10;

            var strategySelector = new StrategySelector
            {
                Graphics = graphics,
                Barcode  = Barcode,
                LabelRow = row
            };

            //Draw all placeholders
            foreach (var placeholer in placeholers)
            {
                var drawingStrategy = strategySelector.GetStrategy(placeholer);

                drawingStrategy.Draw(ref rowHeight, ref x, y);
            }

            //Increase row width
            y = rowHeight + y;
        }
Esempio n. 6
0
 public NodeRunner(Node node, ITimer timer, StrategySelector strategySelector)
 {
     Node = node;
     _strategySelector = strategySelector;
     _timer            = timer;
 }
Esempio n. 7
0
 public UnitMapper(StrategySelector strategySelector)
 {
     _strategySelector = strategySelector;
 }