예제 #1
0
파일: MainMenu.cs 프로젝트: David955/pluto
        public static void LoadGameMenu()
        {
            Console.SetCursorPosition(0, 13);
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("                                                               version 0.2\n\n");
            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.WriteLine("                                                                 NEW GAME");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("                                                               > LOAD GAME");
            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.WriteLine("                                                                 SETTINGS");
            Console.WriteLine("                                                                 QUIT");
            // sets text to black, so no input in menu is visible
            Console.ForegroundColor = ConsoleColor.Black;

            while (true)
            {
                var ch = Console.ReadKey(false).Key;
                switch (ch)
                {
                case ConsoleKey.Enter:
                    // this will clear the bottom error text when loading after previous failed loading
                    Console.SetCursorPosition(0, 43);
                    Console.WriteLine("                                                                                                                ");
                    // PreLoadGame checks if is save file present
                    PreLoadGame p = new PreLoadGame();
                    if (p.CheckSaveFile() == true)
                    {
                        // if is file present, starts loading animation
                        LoadGame.LoadingAnimation();
                        // turn loading of game on (variable is used in Game class)
                        gameLoaded = true;
                    }
                    else
                    {
                        // else error message from PreLoadGame is displayed, then return to main menu
                        Music.SystemSound();
                        LoadGameMenu();
                    }
                    Game.ClearSpace();
                    return;

                case ConsoleKey.UpArrow:
                    Music.MenuSound();
                    NewGameMenu();
                    return;

                case ConsoleKey.DownArrow:
                    Music.MenuSound();
                    SettingsMenu();
                    return;

                case ConsoleKey.Escape:
                    Music.NoSound();
                    QuitGame.QuitFromMenu();
                    return;
                }
            }
        }
예제 #2
0
파일: Game.cs 프로젝트: David955/pluto
        public void Play()
        {
            // if player choosed LOAD GAME option, this condition will load values from save_data.txt to "ThePlayer",
            // if not, player will start with default values from PLayer class.
            if (MainMenu.gameLoaded == true)
            {
                var LoadGame = new LoadGame();
                ThePlayer.currentRoom      = LoadGame.LoadRoom();
                ThePlayer.currentInventory = LoadGame.LoadInventory();
            }

            Console.WriteLine("this is the game");
            // standard for input, inspiration from Zork
            Console.CursorVisible = true;
            Console.Write("> "); Console.ReadLine();
        }