示例#1
0
        public GameController(IEnumerable <IView> availableViews, IWindowFascade windowFascade, IBoardStrategy strategy)
            : base(availableViews, windowFascade)
        {
            Game game = Game.Instance;

            _strategy = strategy;

            if (strategy.ProfileName.Equals("Justtest"))
            {
                _score = new NullScore();
            }
            else
            {
                _score = new RealScore();
            }
            game.Score = _score;
            if (_spaceShipPosition == null)
            {
                _spaceShipPosition = game.Board?.GetPosition();
            }
            var bullets = game.Board?.GetBullets() != null?game.Board?.GetBullets() : new List <Bullet>();

            _boardDirector = new BoardDirector(_strategy, game.Level, game.Score, _spaceShipPosition, bullets);
            _builder       = new BoardBuilder();
            _boardDirector.Construct(_builder);
            game.Board = _builder.Build();
        }
示例#2
0
 public HomeController(IList <IView> views, IWindowFascade windowFascade, IPlayerRepository playerRepository, IMediate mediator) :
     base(views, windowFascade)
 {
     _playerRepository = playerRepository;
     _mediator         = mediator;
     _strategyFactory  = new StrategyFactory();
 }
示例#3
0
 protected Controller(IEnumerable <IView> availableViews, IWindowFascade windowFascade)
 {
     Views        = new Dictionary <string, IView>();
     WindowFacade = windowFascade;
     foreach (var view in availableViews)
     {
         Views.Add(view.Name, view);
     }
 }