예제 #1
0
 public WorldController(TerrariumSettings terrariumSettings, ScreenController screenController)
 {
     TerrariumSettings = terrariumSettings;
     Terrarium         = new Terrarium(TerrariumSettings.Width, TerrariumSettings.Height);
     TimeController    = new TimeController(-1000000, Terrarium);
     ScreenController  = screenController;
 }
예제 #2
0
        // SETTINGS
        public void SettingsScreen(TerrariumSettings terrariumSettings)
        {
            // Print ASCIIART "Terrarium"
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            PrintASCIIArt(2, ASCIIART["settings"]);
            Console.ForegroundColor = ConsoleColor.White;

            // Loop through props to change settings
            terrariumSettings.ChangeSettings();

            // Print menu buttons
            int selectedItem = Menu.MultipleChoice(14, 25, true, "SAVE CHANGES", "BACK (without saving)");

            // Menu actions
            switch (selectedItem)
            {
            case 0:
                Console.Clear();
                GameScreen(terrariumSettings, "SETTTINGS CHANGED");
                break;

            case 1:
                Console.Clear();
                terrariumSettings.ResetSettings();
                GameScreen(terrariumSettings, "DEFAULT SETTINGS");
                break;
            }
        }
예제 #3
0
 public WorldController(Terrarium terrarium, TimeController timecontroller, TerrariumSettings terrariumSettings, bool loaded)
 {
     TerrariumSettings = terrariumSettings;
     Terrarium         = terrarium;
     TimeController    = timecontroller;
     loadedGame        = loaded;
 }
예제 #4
0
 public void LoadScreens(TerrariumSettings terrariumSettings)
 {
     // Scale window size with Terrarium width and height
     Console.SetWindowSize(120, 30);
     // Set buffersize to remove scroll bars from window
     Console.SetBufferSize(120, 30);
     StartScreen();
     GameScreen(terrariumSettings, "");
 }
예제 #5
0
        public void HowToScreen(TerrariumSettings terrariumSettings)
        {
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            PrintASCIIArt(2, ASCIIART["howto"]);
            Console.ForegroundColor = ConsoleColor.White;
            printHowTo(14, 12);

            int selectedItem = Menu.MultipleChoice(14, 25, true, "BACK");

            // Menu actions
            switch (selectedItem)
            {
            default:
                Console.Clear();
                GameScreen(terrariumSettings, "");
                break;
            }
        }
예제 #6
0
 public void LoadGame(string path)
 {
     try
     {
         using (var bestand = File.Open(path, FileMode.Open, FileAccess.Read))
         {
             var        lezer = new BinaryFormatter();
             SaveObject Load;
             Load = (SaveObject)lezer.Deserialize(bestand);
             WorldController world = new WorldController(Load.Terrarium, Load.TimeController, Load.TerrariumSettings, true);
             WorldController   = world;
             TerrariumSettings = world.TerrariumSettings;
             WorldController.Start();
         }
     }
     catch (Exception ex)
     {
         ScreenController.GameScreen(new TerrariumSettings(), ex.Message);
     }
 }
예제 #7
0
 /* Constructor */
 public WorldController(Terrarium terrarium, TimeController timecontroller, TerrariumSettings terrariumSettings)
 {
     TerrariumSettings = terrariumSettings;
     Terrarium         = terrarium;
     TimeController    = timecontroller;
 }
예제 #8
0
        // MAIN SCREEN
        public void GameScreen(TerrariumSettings terrariumSettings, string statusUpdate)
        {
            // Print ASCIIART "Terrarium"
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            PrintASCIIArt(2, ASCIIART["terrarium"]);

            // Create introtext array
            var intro = new String[]
            {
                "Well, the way they make shows is, they make one show.",
                "That show's called a pilot. Then they show that show to the people who make shows, ",
                "and on the strength of that one show they decide if they're going to make more shows.",
                "Some pilots get picked and become television programs.",
                "Some don't, become nothing. She starred in one of the ones that became nothing."
            };

            // Print introText
            Console.ForegroundColor = ConsoleColor.White;
            var lineCounter = 10;

            foreach (var line in intro)
            {
                var windowCenter = (Console.WindowWidth - line.Length) / 2;
                Console.SetCursorPosition(windowCenter, lineCounter);
                Console.WriteLine(line);
                lineCounter++;
            }

            // Print status
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            var wCenter = (Console.WindowWidth - statusUpdate.Length) / 2;

            Console.SetCursorPosition(wCenter, lineCounter + 2);
            Console.WriteLine(statusUpdate);
            Console.ForegroundColor = ConsoleColor.White;

            // Print menu buttons
            int selectedItem = Menu.MultipleChoice(42, 21, true, "START GAME", "LOAD GAME", "HOW TO", "SETTINGS", "QUIT");

            // Menu actions
            switch (selectedItem)
            {
            case 0:
                Console.Clear();
                LoadingScreen();
                break;

            case 1:
                Console.Clear();
                LoadGameScreen();
                break;

            case 2:
                Console.Clear();
                HowToScreen(terrariumSettings);
                break;

            case 3:
                Console.Clear();
                SettingsScreen(terrariumSettings);
                break;

            default:
                Console.Clear();
                Environment.Exit(0);
                break;
            }
        }
예제 #9
0
 public SaveObject(Terrarium terrarium, TimeController timeController, TerrariumSettings terrariumSettings)
 {
     Terrarium         = terrarium;
     TimeController    = timeController;
     TerrariumSettings = terrariumSettings;
 }
예제 #10
0
 public GameController()
 {
     TerrariumSettings = new TerrariumSettings();
     ScreenController  = new ScreenController(this);
 }