Want more features on Pastebin? Sign Up, it's FREE!
Guest

Game.cs

By: a guest on Jul 28th, 2010  |  syntax: C#  |  size: 1.74 KB  |  views: 72  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6.  
  7. namespace ConsoleMenu
  8. {
  9.     class Game
  10.     {
  11.         private Menu gameMenu;
  12.  
  13.         public Game()
  14.         {
  15.             gameMenu = new Menu();
  16.         }
  17.  
  18.         public void Begin()
  19.         {
  20.             MenuOptions selectedOption;
  21.             do
  22.             {
  23.                 selectedOption = gameMenu.ShowMenu();
  24.                 if (selectedOption == MenuOptions.Play)
  25.                     Play();
  26.                 else if (selectedOption == MenuOptions.Exit)
  27.                     Exit();
  28.                 else
  29.                     ShowCredits();
  30.             } while (selectedOption == MenuOptions.Credits);
  31.         }
  32.  
  33.         private void ShowCredits()
  34.         {
  35.             Console.Clear();
  36.             Console.WriteLine("Written By: insertAlias");
  37.             Thread.Sleep(500);
  38.             Console.WriteLine("Directed By: insertAlias");
  39.             Thread.Sleep(500);
  40.             Console.WriteLine("Produced By: insertAlias");
  41.             Thread.Sleep(500);
  42.             Console.WriteLine("Played By: You!");
  43.             Thread.Sleep(500);
  44.             Console.WriteLine("Press any key to return to the menu.");
  45.             Console.ReadKey();
  46.         }
  47.  
  48.         private void Play()
  49.         {
  50.             Console.Clear();
  51.             Console.WriteLine("Beginning Game...");
  52.             Thread.Sleep(500);
  53.             Console.WriteLine("Playing Game...");
  54.             Thread.Sleep(500);
  55.             Console.WriteLine("Exiting Game...");
  56.         }
  57.  
  58.         private void Exit()
  59.         {
  60.             Console.Clear();
  61.             Console.WriteLine("Exiting Game...");
  62.             Thread.Sleep(500);
  63.         }
  64.     }
  65. }
clone this paste RAW Paste Data