static void Main(string[] args) { Initialize(); bool playing = true; Game game = new Game(); CollectionScreen collectionScreen = new CollectionScreen(); SettingsScreen settingsScreen = new SettingsScreen(); Title title = new Title(); while (playing) { title.Setup(); title.Play(); title.Hide(); TitleOption option = title.SelectedOption; //Ends the loop if the user selects Exit if (option == TitleOption.Exit) { playing = false; } //Gets the screen that the player selected Screen screen = null; switch (option) { case TitleOption.Play: screen = game; break; case TitleOption.Collection: screen = collectionScreen; break; case TitleOption.Settings: screen = settingsScreen; break; } if (screen != null) { screen.Setup(); screen.Play(); screen.Hide(); } } //Saves the settings and collection files Collection.WriteToFile(COLLECTION_FILE); Settings.WriteToFile(SETTINGS_FILE); //Sets the console text color to white so that the output can be read. Console.ForegroundColor = ConsoleColor.White; }
public AssemblyInfoOptions GetOptionValues() { return(new AssemblyInfoOptions() { AssemblyVersion = UnescapeNewlines(VersionOption.Value()), Title = UnescapeNewlines(TitleOption.Value()), Description = UnescapeNewlines(DescriptionOption.Value()), Copyright = UnescapeNewlines(CopyrightOption.Value()), NeutralLanguage = UnescapeNewlines(NeutralCultureOption.Value()), Culture = UnescapeNewlines(CultureOption.Value()), InformationalVersion = UnescapeNewlines(InformationalVersionOption.Value()), AssemblyFileVersion = UnescapeNewlines(FileVersionOption.Value()), TargetFramework = UnescapeNewlines(TargetFrameworkOption.Value()), }); }
/// <summary> /// Plays the scene, allowing the player to choose an option. /// The chosen option is stored in the SelectedOption property. /// </summary> /// <returns></returns> public override bool Play() { for (int i = 0; i < SPLASH.Length; i++) { Painter.Write(SPLASH[i], Console.WindowWidth / 2 - SPLASH[i].Length / 2, 1 + i, ConsoleColor.White); } foreach (Button b in buttons) { b.Draw(); } //Temprary fix while I figure out why a button doesn't draw properly. //Drawing it makes it appear correctly buttons[0].Draw(); while (true) { ConsoleKeyInfo key = Input.GetKey(); switch (key.Key) { case ConsoleKey.LeftArrow: buttons[activeButton].Toggle(); activeButton = activeButton == 0 ? buttons.Length - 1 : activeButton - 1; buttons[activeButton].Toggle(); break; case ConsoleKey.RightArrow: buttons[activeButton].Toggle(); activeButton = activeButton == buttons.Length - 1 ? 0 : activeButton + 1; buttons[activeButton].Toggle(); break; case ConsoleKey.Enter: option = (TitleOption)activeButton; return(false); } } }