public static void Main() { // Resolved deps. var output = new ConsoleOutput(); var characterService = new CharacterService(); var textGenerator = new TextGenerator(); var dialogModalScreenHandler = new DialogModalScreenHandler(textGenerator, output); var screenNavigation = new ScreenNavigation(dialogModalScreenHandler); var connectionManager = new ConnectionManager(); var mainMenuHandler = new MainMenuHandler(screenNavigation, connectionManager); var mainMenuPrinter = new MainMenuPrinter(output, characterService); var mainMenuScreenHandler = new MainMenuScreenHandler(textGenerator, mainMenuHandler, mainMenuPrinter); var characterCreationHandler = new CharacterCreationHandler(screenNavigation); var characterCreationPrinter = new CharacterCreationPrinter(output, characterService); var characterCreationScreenHandler = new CharacterCreationScreenHandler(textGenerator, characterCreationHandler, characterCreationPrinter); var screenProvider = new ScreenHandlerProvider(screenNavigation, mainMenuScreenHandler, characterCreationScreenHandler, dialogModalScreenHandler); // Authenticated and got list of characters from API. var characters = new[] { "1", "2", "ivan-id" }; mainMenuScreenHandler.UpdateState(new MainMenuState(characters)); while (true) { Console.Clear(); var screen = screenProvider.GetCurrentScreenHandler(); screen.PrintState(); var key = Console.ReadKey(); switch (key.Key) { case ConsoleKey.Escape: screen.Escape(); break; case ConsoleKey.Backspace: screen.Backspace(); break; case ConsoleKey.Tab: screen.Tab(); break; default: screen.Type(key.KeyChar); break; } } }
public Game(MainMenuPrinter mainMenuPrinter) { _mainMenuPrinter = mainMenuPrinter; }