コード例 #1
0
        public static int GetSingleInteger(string message, int startRange, int endRange)
        {
            string userInput        = String.Empty;
            int    intValue         = 0;
            int    numberOfAttempts = 0;

            bool exit = false;

            do
            {
                if (numberOfAttempts > 0)
                {
                    MiscUtility.PlaySound("Sounds\\ahem.wav");
                    Console.WriteLine($"\nInvalid input format. Selection must be a number between { startRange} and { endRange}.");
                }

                Console.Write(message + " ");
                userInput = Console.ReadKey().KeyChar.ToString();
                numberOfAttempts++;

                if (int.TryParse(userInput, out intValue))
                {
                    if (intValue >= startRange && intValue <= endRange)
                    {
                        exit = true;
                    }
                }
            }while (!exit);

            return(intValue);
        }
コード例 #2
0
 private void FeedMoney(double amount)
 {
     _vm.AddToBalance(amount);
     MiscUtility.PlaySound("Sounds\\coin.wav");
     Logging.LogFeed(amount, _vm);
     Console.WriteLine($"\n{amount.ToString("C")} was fed into the machine.");
     Console.WriteLine($"Current Money Provided is now {_vm.UserBalance.ToString("C")}");
 }
コード例 #3
0
 private void PurchaseItem(string menuSelection)
 {
     _vm.DispenseItem(menuSelection);
     MiscUtility.PlaySound(_vm.FetchItemSoundFile(menuSelection));
     Console.WriteLine(_vm.FetchItemNoiseMessage(menuSelection));
     Logging.LogPurchase(menuSelection, _vm);
     Reporting.ReportSale(menuSelection, _vm);
     PressAnyToContinue();
 }
コード例 #4
0
        public void OpeningSplash()
        {
            MiscUtility.PlaySound("Sounds\\LOZ_Fanfare.wav");
            using (StreamReader sr = new StreamReader("SplashArt.txt"))
            {
                while (!sr.EndOfStream)
                {
                    Console.WriteLine(sr.ReadLine());
                }
            }
            Console.WriteLine("\nAn Umbrella Corporation Creation\n\n\n\n\n\n");

            ResidentEvil();

            PressAnyToContinue();
            MainMenu();
        }