/// <summary> /// Prevents a default instance of the Game class from being created. This constructor initializes instances of all classes, that are needed for the game play. /// </summary> private Game() { this.gamePrinter = new GamePrinter(); this.userInput = new UserInput(); this.Memento = new Memento(); this.musicPlayer = new MusicPlayer(); this.gameStatus = GameStatus.GameOn; }
public Game(Action <string> writeLine, string[] players) { _players = new Players(); CreatePlayers(players); _gameEngine = new GameEngine(_players, new GamePrinter(writeLine)); _gamePrinter = new GamePrinter(writeLine); _gamePrinter.PrintoutPlayers(players); }
public void Init() { _gamePrinter = new GamePrinter(_console.WriteLine); _mockedPlayer = Substitute.For <IPlayer>(); _players = Substitute.For <IPlayers>(); _gameEngine = new GameEngine(_players, _gamePrinter); _playerA = new Player("ana", _defaultLocation, _defaultNumberOfCoins); _playerB = new Player("bob", _defaultLocation, _defaultNumberOfCoins); }
public void alive_cells_are_printed_with_an_x() { var printer = new GamePrinter(); var emptyGame = new Game(5, 5, (0, 0), (1, 1), (2, 2), (3, 3), (4, 4)); var result = printer.Print(emptyGame); AssertPrintout(result, @" x.... .x... ..x.. ...x. ....x " ); }
public void print_empty_grid_for_empty_game() { var printer = new GamePrinter(); var emptyGame = new Game(5, 5); var result = printer.Print(emptyGame); AssertPrintout(result, @" ..... ..... ..... ..... ..... " ); result.Should().EndWith(Environment.NewLine); }
public void Init() { new QuestionRepository(1); _gamePrinter = new GamePrinter(_console.WriteLine); }
public GameEngine(IPlayers players, GamePrinter gamePrinter) { _players = players; _gamePrinter = gamePrinter; _currentPlayer = players.GetNextPlayer(); }
private void _printingState_OnUpdate(float f) { var timer = _printingState.Timer; try { if (Setting.Instance._is_print_bill == "打印路单" || Setting.Instance._is_print_bill == "打印不监控") { if (!_waybillPrinted) { SetStateText("打印路单"); Printer.DoorTest(); if (!Printer.IsTherePrinter) { if (timer % 3 == 0) { MessageBox.Show("打印机未连接!等待处理"); } return; } if (!Printer.IsDoorClosed) { if (timer % 3 == 0) { MessageBox.Show("打印机门开!等待处理"); } return; } Printer.PaperTest(); if (!Printer.HasPaper) { if (timer % 3 == 0) { MessageBox.Show("打印机缺纸!等待处理"); } return; } GamePrinter.PrintWaybill(); _waybillPrinted = true; _printingState.ResetTimer(0); } if (_waybillPrinted && timer >= 8) { _waybillPrinted = false; _isPrinted = true; _isPrinting = false; } } else { _isPrinted = true; _isPrinting = false; } } catch (Exception ex) { #if DEBUG MessageBox.Show(ex.Message + ex.StackTrace); #endif } }