static void Main(string[] args) { Shelter myShelter = new Shelter(); Console.SetWindowSize(124, 40); Console.CursorVisible = false; // HIDE the cursor /************ * ConsoleKeyInfo cki; * * do * { * Console.WriteLine("\nPress a key to display; press the 'x' key to quit."); * * // Your code could perform some useful task in the following loop. However, * // for the sake of this example we'll merely pause for a quarter second. * * while (Console.KeyAvailable == false) * Thread.Sleep(250); // Loop until input is entered. * * cki = Console.ReadKey(true); * Console.WriteLine("You pressed the '{0}' key.", cki.Key); * } while (cki.Key != ConsoleKey.X); * ***************/ Console.BackgroundColor = ConsoleColor.DarkBlue; //Change Console background color //VirtualPet[] pet1 = new VirtualPet[2]; VirtualPet pet1 = new VirtualPet(); //This may need to be moved bool gameContinues = true; bool petExists = false; VirtualPet.Kitty(10, 100); //Kitty(tabs, milliseconds); Console.ResetColor(); int menuSelection = -1; /*do * { * menuSelection = StartMenu(StartMenuList, menuSelection); * } while (menuSelection < 1);*/ while (StartMenu(StartMenuList, ref menuSelection) < 1) { ; } menuSelection = -1; while (StartMenu(InteractionMenu, ref menuSelection) < 1) { ; } switch (menuSelection) { case 1: DisplayWholeShelter(myShelter); break; case 2: break; case 3: break; default: break; } if (menuSelection == 3) { Console.WriteLine("yoyoyo!!!!"); } Console.WriteLine("Something was chosen: " + menuSelection); Console.ReadKey(); Console.WriteLine("Welcome to the Pet Shelter!"); Console.BackgroundColor = ConsoleColor.Black; //Change console background color back to black //Console.BackgroundColor. int menuSelectionCurrent = 1; int menuSelectionNext = 0; //didn't actually need this bool selected = false; MenuHighlight(1); do { var ch = Console.ReadKey(false).Key; switch (ch) { case ConsoleKey.Escape: Console.WriteLine("ESCAPE! "); return; case ConsoleKey.UpArrow: Console.WriteLine("up!"); menuSelectionCurrent--; break; case ConsoleKey.DownArrow: Console.WriteLine("Down!"); menuSelectionCurrent++; break; case ConsoleKey.RightArrow: Console.WriteLine("up!"); break; case ConsoleKey.LeftArrow: Console.WriteLine("Down!"); break; case ConsoleKey.D1: //the D1 means "1" above the q key and Numpad1 means "1" on num pad! case ConsoleKey.NumPad1: //once you're in the switch, it continues until a break, so D1 or NumPad1 makes menuSelectionCurrent = 1 Console.WriteLine("Decision Has Been Made!!!"); menuSelectionCurrent = 1; selected = true; break; case ConsoleKey.D2: case ConsoleKey.NumPad2: Console.WriteLine("Decision Has Been Made!!!"); menuSelectionCurrent = 2; selected = true; break; case ConsoleKey.D3: case ConsoleKey.NumPad3: Console.WriteLine("Decision Has Been Made!!!"); menuSelectionCurrent = 3; selected = true; break; case ConsoleKey.D4: case ConsoleKey.NumPad4: Console.WriteLine("Decision Has Been Made!!!"); menuSelectionCurrent = 4; selected = true; break; case ConsoleKey.Enter: Console.WriteLine("Decision Has Been Made!!!"); selected = true; break; default: break; } /* * if (menuSelectionCurrent > 4) menuSelectionCurrent = 4; // Don't go over 4 * else if (menuSelectionCurrent < 1) menuSelectionCurrent = 1; // Don't go under 1 */ if (menuSelectionCurrent > 4) { menuSelectionCurrent = 1; //cycle from bottom to top } else if (menuSelectionCurrent < 1) { menuSelectionCurrent = 4; //cycle from top to bottom } //This next part can probably be done in the above switch statement... MAYBE... it's late and bedtime if (selected) //if a menu item was selected...next go to what was selected, probably a method { switch (menuSelectionCurrent) { case 1: Console.WriteLine("....#1 Chosen!"); //theShelter[currentPet].Feed(); break; case 2: Console.WriteLine("....#2 Chosen!"); //theShelter[currentPet].Play(); break; case 3: Console.WriteLine("....#3 Chosen!"); //theShelter[currentPet].Nap(); break; case 4: Console.WriteLine("....#4 Chosen!"); //mainMenu(); break; default: Console.WriteLine("....NOPE Chosen!"); break; } } else { MenuHighlight(menuSelectionCurrent); } } while (!selected); do { Console.Write("\tType a LETTER to continue: \n\n\t" + "E - Exit \n\t" + "P - View Pet \n\t" + "I - View Instructions"); Console.WriteLine(""); string userInput = Console.ReadLine().ToLower(); Console.Clear(); if (userInput.Equals("e")) { Console.WriteLine("Good-bye. Come again soon."); //Environment.Exit(0); gameContinues = false; } else if (userInput.Equals("p")) { if (petExists) { pet1.DisplayPetInfo(); while (pet1.DisplayInteractionMenu()) { pet1.TimeIncrement(); pet1.DisplayPetInfo(); if (!pet1.IsAlive()) { Console.Clear(); Console.Beep(); pet1.PetDies(); } } Console.Clear(); } else { Console.WriteLine("We Don't have any pets yet."); Console.WriteLine("Enter Y to create a Pet."); if (Console.ReadLine().ToLower().Equals("y")) { pet1.CreatePet(); pet1.DisplayPetInfo(); //Console.WriteLine("How hungry is " + pet1.Name + " on a scale of 1 to 10 ? (10 being super FULL)"); //pet1.Fullness = System.Convert.ToInt32(Console.ReadLine()); petExists = true; } } //Console.WriteLine("Here's where the pet is"); } if ((petExists) && (gameContinues)) { pet1.TimeIncrement(); } } while (gameContinues); }
static void Main(string[] args) { Console.SetWindowSize(130, 40); Console.BackgroundColor = ConsoleColor.DarkBlue; //Change Console background color //VirtualPet[] pet1 = new VirtualPet[2]; Shelter allPets = new Shelter(); //OrganicPet pet1 = new OrganicPet("Kitty", "Rob", 4); //This may need to be removed bool gameContinues = true; //bool petExists = false;//probably remove OrganicPet.Kitty(10, 100); //Kitty(tabs, milliseconds); Console.WriteLine("Welcome to the Pet Shelter!"); Console.BackgroundColor = ConsoleColor.Black; //Change console background color back to black /* * Shelter xxx = new Shelter(); * Console.Clear(); * xxx.DisplayAllPets(); * Console.ReadLine(); */ do { Console.Write("\tType a LETTER to continue: \n\n" + "\tG - Give a Pet Away for Adoption\n" + "\tA - Add a Pet \n" + "\tP - View Pets in Shelter \n" + "\tI - View Instructions \n" + "\tE - Exit \n\n"); //string userInput = Console.ReadLine().ToLower(); string userInput = Console.ReadLine(); if ((userInput.Length > 1) || !(char.IsLetter(userInput[0]))) { userInput = "x"; } else { userInput = userInput.ToLower(); } Console.Clear(); if (userInput.Equals("e")) { Console.WriteLine("Good-bye. Come again soon."); //Environment.Exit(0); gameContinues = false; } else if (userInput.Equals("p"))//Display Shelter { if (allPets.HowManyPetsInShelter() > 0) { Console.Clear(); int petChoice = 0; do { Console.Clear(); allPets.DisplayAllPetsZZ(); Console.Write("\n\tChoose a pet (0 to Go Back): "); //petChoice = Convert.ToInt32(Console.ReadLine()); string petChoiceString = Console.ReadLine(); if (char.IsNumber(petChoiceString[0]) && petChoiceString.Length == 1) { petChoice = Convert.ToInt32(petChoiceString); //Console.WriteLine("petChoice: " + petChoice); } else { petChoice = -1; } if ((petChoice > 0) && (petChoice <= allPets.GetNumPets())) { bool continueInteracting = true; do { Console.Clear(); allPets.DisplayShelterPetInfo(petChoice); continueInteracting = allPets.DisplayShelterPetInteractions(petChoice); if (continueInteracting) { allPets.TimePasses(); } allPets.CheckForDeath(); if (petChoice > allPets.HowManyPetsInShelter()) { continueInteracting = false; } } while (continueInteracting); } else { //invalid choice Console.WriteLine("Please choose a valid pet"); } } while (petChoice != 0); //Console.ReadLine() } else { Console.Clear(); Console.WriteLine("The Shelter is EMPTY! (Hint: Add a Pet)"); Console.WriteLine("...Press any key to continue"); Console.ReadKey(); } } else if (userInput.Equals("a")) { int petType = 0; do { Console.Clear(); Console.WriteLine("Add a Pet..."); Console.WriteLine("Which type of Pet?"); Console.WriteLine("\t1. Organic"); Console.WriteLine("\t2. Robotic"); petType = 0; string petChoiceString = Console.ReadLine(); if (char.IsNumber(petChoiceString[0]) && petChoiceString.Length == 1) { petType = Convert.ToInt32(petChoiceString); //Console.WriteLine("petChoice: " + petChoice); } else { petType = -1; } switch (petType) { case 1: allPets.CreateOrgPet(); break; case 2: allPets.CreateRoboPet(); break; default: Console.WriteLine("Choose Organic or Robotic"); break; } } while (!(petType >= 1 && petType <= 2)); } else if (userInput.Equals("i")) { Console.Clear(); displayInstructions(); Console.WriteLine("...Press any key to continue"); Console.ReadKey(); } else if (userInput.Equals("g")) { if (allPets.HowManyPetsInShelter() > 0) { Console.Clear(); int petChoice = 0; bool petWasRemoved = false; do { allPets.DisplayAllPetsZ(); Console.WriteLine("Which Pet found a Permanent Home?"); Console.Write("\n\tChoose a pet: "); //petChoice = Convert.ToInt32(Console.ReadLine()); string petChoiceString = Console.ReadLine(); if (char.IsNumber(petChoiceString[0]) && petChoiceString.Length == 1) { petChoice = Convert.ToInt32(petChoiceString); //Console.WriteLine("petChoice: " + petChoice); } else { petChoice = -1; } if ((petChoice > 0) && (petChoice <= allPets.GetNumPets())) { allPets.RemoveAPet(petChoice); petWasRemoved = true; } else { //invalid choice Console.WriteLine("Please choose a valid pet"); } } while (petChoice != 0 && !petWasRemoved); //Console.ReadLine() } else { Console.Clear(); Console.WriteLine("The Shelter is EMPTY! (Hint: Add a Pet)"); Console.WriteLine("...Press any key to continue"); Console.ReadKey(); } } else { Console.WriteLine("Please choose a valid option!"); Console.WriteLine("...Press any key to continue."); Console.ReadKey(); Console.Clear(); } Console.Clear(); } while (gameContinues); }