Example #1
0
        public TrainInfoScreen(ITrainManager trainManager, IGameManager gameManager, IGameBoard gameBoard, ITrainParameters trainParameters, ITrainPainter trainPainter)
        {
            _trainManager          = trainManager;
            _gameManager           = gameManager;
            _gameBoard             = gameBoard;
            _trainParameters       = trainParameters;
            _trainPainter          = trainPainter;
            _trainManager.Changed += (s, e) =>
            {
                this.Visible = _trainManager.CurrentTrain is not null;
                OnChanged();
            };
            _gameManager.Changed += (s, e) => OnChanged();
            _trainManager.CurrentTrainPropertyChanged += (s, e) => OnChanged();

            _controlButton = new MultiButton(20, new ButtonBase[]
            {
                CreateButton(Picture.Backward, () => false, () => _trainManager.CurrentTrain?.Slower()),
                CreateButton(Picture.Play, () => _trainManager.CurrentTrain?.Stopped != true, () => _trainManager.CurrentTrain?.Start()),
                CreateButton(Picture.Pause, () => _trainManager.CurrentTrain?.Stopped == true, () => _trainManager.CurrentTrain?.Stop()),
                CreateButton(Picture.Forward, () => false, () => _trainManager.CurrentTrain?.Faster()),
            });

            _actionButton = new MultiButton(20, new ButtonBase[]
            {
                CreateButton(Picture.Eye, () => _trainManager.CurrentTrain?.Follow ?? false, () => _trainManager.ToggleFollow(_trainManager.CurrentTrain !)),
                CreateButton(Picture.Trash, () => false, () =>
                {
                    _gameBoard.RemoveMovable(_trainManager.CurrentTrain !);
                    Close();
                }),
Example #2
0
 public PointerTool(ITrainManager trainManager, IGameBoard gameBoard, IPixelMapper pixelMapper, ILayout <Track> trackLayout)
 {
     _trainManager = trainManager;
     _gameBoard    = gameBoard;
     _pixelMapper  = pixelMapper;
     _trackLayout  = trackLayout;
 }
 public ClearAllCommand(ITrainManager trainManager, IGameBoard gameBoard)
 {
     _trainManager = trainManager;
     _gameBoard    = gameBoard;
 }
Example #4
0
 public TrainRenderer(ITrainParameters trainParameters, ITrainPainter trainPainter, ITrainManager trainManager)
 {
     _trainParameters = trainParameters;
     _trainPainter    = trainPainter;
     _trainManager    = trainManager;
 }
Example #5
0
 public TrainTool(IGameBoard gameBoard, ILayout <Track> trackLayout, ITrainManager gameState)
 {
     _gameBoard    = gameBoard;
     _trackLayout  = trackLayout;
     _trainManager = gameState;
 }
Example #6
0
 public EraserTool(ILayout trackLayout, IGameBoard gameBoard, ITrainManager trainManager)
 {
     _collection   = trackLayout;
     _gameBoard    = gameBoard;
     _trainManager = trainManager;
 }