Exemplo n.º 1
0
        public Drawer(IBoard board, ICurveDrawer cdrawer, ISettingsProvider settingsProvider, IIOComponent iOComponent, IPhraseProvider phraseProvider)
        {
            this.board            = board;
            this.curveDrawer      = cdrawer;
            this.settingsProvider = settingsProvider;
            this.drawSettings     = settingsProvider.GetDrawSettings();
            this.iO             = iOComponent;
            this.phraseProvider = phraseProvider;


            this.drawers = new Dictionary <int, DrawMethod>();
            drawers.Add(1, this.curveDrawer.DrawDot);
            drawers.Add(2, this.curveDrawer.DrawHorizontalLine);
            drawers.Add(3, this.curveDrawer.DrawVerticalLine);
            drawers.Add(4, this.curveDrawer.DrawAnotherCurve);
        }
Exemplo n.º 2
0
        public ClientApp(RequestSenderModule requestSender, IInputOutput inputOutputModule, IPhraseProvider phraseProvider, ISettingsProvider settingsProvider)
        {
            this.requestSender     = requestSender;
            this.phraseProvider    = phraseProvider;
            this.inputOutputModule = inputOutputModule;

            try
            {
                this.gameSettings = settingsProvider.GetGameSettings();
            }
            catch (ArgumentException ex)
            {
                inputOutputModule.WriteOutput(ex.Message);
                this.gameSettings = null;
                return;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the<see cref="Game" /> class
        /// </summary>
        /// <param name="settingsProvider">Setting interface</param>
        /// <param name="inputOutputDevice">Read/Write Interface</param>
        /// <param name="phraseProvider">Get messages interface</param>
        /// <param name="board">Screen for drawing interface</param>
        /// <param name="figureProvider">Drawing figures interface</param>
        public Game(
            ISettingsProvider settingsProvider,
            IInputOutput inputOutputDevice,
            IPhraseProvider phraseProvider,
            IBoard board,
            IFigureProvider figureProvider)
        {
            this.settingsProvider     = settingsProvider;
            this.inputOutputComponent = inputOutputDevice;
            this.phraseProvider       = phraseProvider;
            this.board          = board;
            this.figureProvider = figureProvider;

            this.gameSettings = this.settingsProvider.GameSettings();

            this.board.BoardSizeX = this.gameSettings.Length;
            this.board.BoardSizeY = this.gameSettings.Width;
        }
Exemplo n.º 4
0
        bool exitCode = false;           //flag to exit (if entered exit code)


        public DoorsAndLevels(
            IInputOutputComponent inputOutputComponent,
            IDoorsNumbersGenerator doorsNumbersGenerator,
            ISettingsProvider settingsProvider,
            IPhraseProvider phraseProvider,
            IStorageComponent stackStorageComponent
            )
        {
            this.ioComponent           = inputOutputComponent;
            this.doorsNumbersGenerator = doorsNumbersGenerator;
            this.settingsProvider      = settingsProvider;
            this.phraseProvider        = phraseProvider;
            this.stackStorageComponent = stackStorageComponent;

            this.gameSettings = this.settingsProvider.gameSettings();

            m_arrayDoorsValue = new int[gameSettings.doorsAmount];
        }
Exemplo n.º 5
0
 public Game
     (IPhraseProvider phraseProvider, IInputOutput ioModule,
     ISettingsProvider settingsProvider, IDoorsNumbersGenerator doorsNumbersGenerator)
 {
     this.phraseProvider = phraseProvider;
     this.ioModule       = ioModule;
     try
     {
         this.gameSettings = settingsProvider.GetGameSettings();
     }
     catch (ArgumentException ex)
     {
         ioModule.WriteOutput(ex.Message);
         this.gameSettings = null;
         return;
     }
     this.doorNumbersHolder = doorsNumbersGenerator.GenerateDoorsNumbers(this.gameSettings.DoorsAmount);
     this.userInputHolder   = new Stack <int>();
 }
Exemplo n.º 6
0
 public ConsoleDrawer(
     IDrawManager drawManager,
     IKeyboardManager keyboardManager,
     IPhraseProvider phraseProvider,
     IObjectDrawer canvasDrawer,
     IObjectDrawer dotDarwer,
     IObjectDrawer verticalLineDrawer,
     IObjectDrawer horizontalLineDrawer,
     IObjectDrawer gooseDrawer,
     IBoard board)
 {
     this.drawManager          = drawManager;
     this.keyboardManager      = keyboardManager;
     this.phraseProvider       = phraseProvider;
     this.canvasDrawer         = canvasDrawer;
     this.dotDrawer            = dotDarwer;
     this.verticalLineDrawer   = verticalLineDrawer;
     this.horizontalLineDrawer = horizontalLineDrawer;
     this.gooseDrawer          = gooseDrawer;
     this.board = board;
 }
Exemplo n.º 7
0
        public App(IPhraseProvider phraseProvider, IInputOutput inputOutputModule, ISettingsProvider settingsProvider,
                   ClientsService clientsService, TradingService tradingService, ShowDbInfoService showDbInfoService)
        {
            this.phraseProvider    = phraseProvider;
            this.inputOutputModule = inputOutputModule;

            this.clientsService    = clientsService;
            this.tradingService    = tradingService;
            this.showDbInfoService = showDbInfoService;

            try
            {
                this.gameSettings = settingsProvider.GetGameSettings();
            }
            catch (ArgumentException ex)
            {
                inputOutputModule.WriteOutput(ex.Message);
                this.gameSettings = null;
                return;
            }
        }
Exemplo n.º 8
0
        public Game(IPhraseProvider phraseProvider, IInputOutput inputOutputModule, IDraw drawModule, ISettingsProvider settingsProvider, IBoard board)
        {
            this.phraseProvider    = phraseProvider;
            this.inputOutputModule = inputOutputModule;
            this.drawModule        = drawModule;
            this.board             = board;

            try
            {
                this.gameSettings = settingsProvider.GetGameSettings();
            }
            catch (ArgumentException ex)
            {
                inputOutputModule.WriteOutput(ex.Message);
                this.gameSettings = null;
                return;
            }

            this.board.BoardSizeY = this.gameSettings.BoardHeight;
            this.board.BoardSizeX = this.gameSettings.BoardWidth;
        }
Exemplo n.º 9
0
        public Controller(
            IInputOutput io,
            IPhraseProvider phraseProvider,
            GameSettings gs)
        {
            this.io             = io;
            this.phraseProvider = phraseProvider;

            Point start  = (0, 0);
            int   whidth = gs.whidthWindow;
            int   height = gs.heightWindow;

            if (whidth < 160)
            {
                io.Print("Window width is low" + Environment.NewLine);
                throw new Exception();
            }
            if (height < 30)
            {
                io.Print("Window height is low" + Environment.NewLine);
                throw new Exception();
            }

            this.io.SetWindowSize(whidth + 4, height);
            terminal = new Terminal(
                (whidth / 2 + 1, start.y),
                whidth / 2,
                5,
                io,
                phraseProvider);

            menu = new Menu(
                start,
                whidth / 2,
                height,
                io,
                phraseProvider);
        }
Exemplo n.º 10
0
 public TraderService(IPhraseProvider provider, ITraderRepository traderRep, ILoggerService logger)
 {
     this.provider  = provider;
     this.traderRep = traderRep;
     this.logger    = logger;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the GameMenu class.
 /// </summary>
 /// <param name="board">It is an IBoard, where menu should be printed.</param>
 /// <param name="phraseProvider">IPhraseProvider which is used for printing messages.</param>
 public GameMenu(IBoard board, IPhraseProvider phraseProvider)
 {
     this.PhraseProvider = phraseProvider;
     this.Board          = board;
 }
 public DBTransactionHistoryRecorder(IPhraseProvider phraseProvider, IInputOutputDevice inputOutputDevice)
 {
     this.inputOutputDevice = inputOutputDevice;
     this.phraseProvider    = phraseProvider;
 }
Exemplo n.º 13
0
 public ConsoleInputOutput(IPhraseProvider phraseProvider)
 {
     this.jsonPhraseProvider = (JsonPhraseProvider)phraseProvider;
 }
Exemplo n.º 14
0
 public void Initialize()
 {
     this.traderRep = Substitute.For <ITraderRepository>();
     this.provider  = Substitute.For <IPhraseProvider>();
     this.logger    = Substitute.For <ILoggerService>();
 }
Exemplo n.º 15
0
 public ShareView(IPhraseProvider phraseProvider, IIOProvider iOProvider)
 {
     this.phraseProvider = phraseProvider;
     this.iOProvider     = iOProvider;
 }
Exemplo n.º 16
0
 public NumbersChanger(IInputOutputDevice ioDevice, IPhraseProvider phraseProvider, ISettingsProvider settingsProvider)
 {
     this.gameSettings   = settingsProvider.GetGameSettings();
     this.ioDevice       = ioDevice;
     this.phraseProvider = phraseProvider;
 }