public static void CountdownMessage(string text, byte i) { ColorWriter.Write("Yellow", "\n " + text + " "); while (i > 0) { ColorWriter.Write("White", i + " "); System.Threading.Thread.Sleep(750); i--; } ColorWriter.WriteLine("White", i.ToString()); Console.Clear(); }
private void PlanetDetails() { ColorWriter.SpaceWriteLine("Cyan", planets.Planet[idSelectedPlanet - 1].Name); ColorWriter.SpaceWriteLine("DarkGray", "\u2022 " + planets.Planet[idSelectedPlanet - 1].Description); ColorWriter.SpaceWrite("Gray", "\u00BB " + "Villain Attack Modifier: "); if (planets.Planet[idSelectedPlanet - 1].Modifiers.VillainAttackModifier >= 0) { ColorWriter.WriteLine("Green", "+" + planets.Planet[idSelectedPlanet - 1].Modifiers.VillainAttackModifier.ToString()); } else { ColorWriter.WriteLine("Red", planets.Planet[idSelectedPlanet - 1].Modifiers.VillainAttackModifier.ToString()); } ColorWriter.SpaceWrite("Gray", "\u00BB " + "Villain Health Modifier: "); if (planets.Planet[idSelectedPlanet - 1].Modifiers.VillainHealthModifier >= 0) { ColorWriter.WriteLine("Green", "+" + planets.Planet[idSelectedPlanet - 1].Modifiers.VillainHealthModifier.ToString()); } else { ColorWriter.WriteLine("Red", planets.Planet[idSelectedPlanet - 1].Modifiers.VillainHealthModifier.ToString()); } ColorWriter.SpaceWrite("Gray", "\u00BB " + "Hero Attack Modifier: "); if (planets.Planet[idSelectedPlanet - 1].Modifiers.HeroAttackModifier >= 0) { ColorWriter.WriteLine("Green", "+" + planets.Planet[idSelectedPlanet - 1].Modifiers.HeroAttackModifier.ToString()); } else { ColorWriter.WriteLine("Red", planets.Planet[idSelectedPlanet - 1].Modifiers.HeroAttackModifier.ToString()); } ColorWriter.SpaceWrite("Gray", "\u00BB " + "Hero Health Modifier: "); if (planets.Planet[idSelectedPlanet - 1].Modifiers.HeroHealthModifier >= 0) { ColorWriter.WriteLine("Green", "+" + planets.Planet[idSelectedPlanet - 1].Modifiers.HeroHealthModifier.ToString()); } else { ColorWriter.WriteLine("Red", planets.Planet[idSelectedPlanet - 1].Modifiers.HeroHealthModifier.ToString()); } }
private static byte MainSelectionMenu() { ColorWriter.WriteLine("Yellow", " Main menu options: \n"); ColorWriter.SpaceWrite("Yellow", "Black", "1"); ColorWriter.SpaceWrite("Gray", "Select a"); ColorWriter.SpaceWriteLine("Cyan", "Planet"); if (arena.PlanetChecker() != null) { ColorWriter.SpaceWriteLine("Green", " \u00BB " + arena.PlanetChecker() + " selected!"); } else { Console.WriteLine(); } ColorWriter.SpaceWrite("Yellow", "Black", "2"); ColorWriter.SpaceWrite("Gray", "Select a"); ColorWriter.SpaceWriteLine("Cyan", "Villain"); if (arena.VillainChecker() != null) { ColorWriter.SpaceWriteLine("Green", " \u00BB " + arena.VillainChecker() + " selected!"); } else { Console.WriteLine(); } ColorWriter.SpaceWrite("Yellow", "Black", "3"); ColorWriter.SpaceWrite("Gray", "Select a"); ColorWriter.SpaceWriteLine("Cyan", "Hero"); if (arena.HeroChecker() != null) { ColorWriter.SpaceWriteLine("Green", " \u00BB " + arena.HeroChecker() + " selected!"); } else { Console.WriteLine(); } ColorWriter.SpaceWrite("Yellow", "Black", "4"); ColorWriter.SpaceWrite("Gray", "Build the"); ColorWriter.SpaceWriteLine("Cyan", "Avengers Team"); if (arena.AvengersChecker()) { ColorWriter.SpaceWriteLine("Green", " \u00BB Avengers Team assembled!"); } else { Console.WriteLine(); } ColorWriter.SpaceWrite("Yellow", "Black", "5"); ColorWriter.SpaceWrite("Gray", "Start the"); ColorWriter.SpaceWriteLine("Cyan", "Fight\n"); ColorWriter.SpaceWrite("Yellow", "Black", "6"); ColorWriter.SpaceWriteLine("Gray", "Exit"); ColorWriter.Write("Yellow", "\n Select an option (number) : "); byte option = 0; try { option = byte.Parse(Console.ReadLine()); } catch (Exception) { SpecialMessage.ErrorMessage("Wrong type of value given!\n Expected Byte!"); errorGiven = true; } return(option); }
private void OptionSelector(string dataName, bool multiple) { while (true) { ColorWriter.SpaceWriteLine("Yellow", "Black", dataName + " Selector\n"); bool errorGiven = false; if (dataName == "Planet") { foreach (Planet planet in planets.Planet) { ColorWriter.SpaceWrite("Yellow", "Black", planet.Id.ToString()); ColorWriter.SpaceWrite("Cyan", planet.Name + '\n'); ColorWriter.SpaceWriteLine("DarkGray", " \u2022 " + planet.Description); } } else { foreach (Character character in characters.Character) { if (character.IsVillain && dataName == "Villain") { ColorWriter.SpaceWrite("Yellow", "Black", character.Id.ToString()); ColorWriter.SpaceWrite("Cyan", character.Name + '\n'); ColorWriter.SpaceWriteLine("DarkGray", " \u2022 " + character.Description); } if (!character.IsVillain && dataName == "Hero") { ColorWriter.SpaceWrite("Yellow", "Black", character.Id.ToString()); ColorWriter.SpaceWrite("Cyan", character.Name + '\n'); ColorWriter.SpaceWriteLine("DarkGray", " \u2022 " + character.Description); } } } ColorWriter.Write("Yellow", "\n Select a " + dataName.ToLower() + " : "); byte idSelectedEntity = 0; try { idSelectedEntity = byte.Parse(Console.ReadLine()); } catch (Exception) { SpecialMessage.ErrorMessage("Wrong type of value given!\n Expected Byte"); errorGiven = true; } bool entityFound = false; if (dataName == "Planet") { foreach (Planet planet in planets.Planet) { if (planet.Id == idSelectedEntity) { entityFound = true; idSelectedPlanet = idSelectedEntity; } } } else { if (dataName == "Villain") { foreach (Character character in characters.Character) { if (character.Id == idSelectedEntity && character.IsVillain) { entityFound = true; idSelectedVillain = idSelectedEntity; } } } else { if (dataName == "Hero") { foreach (Character character in characters.Character) { if (character.Id == idSelectedEntity && !character.IsVillain) { entityFound = true; } } } } } if (entityFound) { while (true) { bool errorGiven2 = false; byte option = 0; if (dataName == "Planet") { Console.Clear(); PlanetDetails(); } else { if (dataName == "Villain") { CharacterDetails(idSelectedEntity); } else { if (dataName == "Hero") { CharacterDetails(idSelectedEntity); } } } ColorWriter.WriteLine("Yellow", "\n Options: \n"); ColorWriter.SpaceWrite("Yellow", "Black", "1"); if (dataName == "Hero" && multiple) { ColorWriter.SpaceWriteLine("Gray", "Add to the Avengers team\n"); } else { ColorWriter.SpaceWriteLine("Gray", "Confirm selected " + dataName.ToLower() + '\n'); } ColorWriter.SpaceWrite("Yellow", "Black", "2"); ColorWriter.SpaceWriteLine("Gray", "Go back to the selection menu"); if (dataName == "Hero" && multiple) { Console.WriteLine(); ColorWriter.SpaceWrite("Yellow", "Black", "3"); ColorWriter.SpaceWriteLine("Gray", "Show the Avengers team\n"); ColorWriter.SpaceWrite("Yellow", "Black", "4"); ColorWriter.SpaceWriteLine("Gray", "Clear the Avengers team\n"); ColorWriter.SpaceWrite("Yellow", "Black", "5"); ColorWriter.SpaceWriteLine("Gray", "Confirm Avengers Team"); } ColorWriter.Write("Yellow", "\n Select an option: "); try { option = byte.Parse(Console.ReadLine()); } catch (Exception) { SpecialMessage.ErrorMessage("Wrong type of value given!\n Expected Byte!"); errorGiven2 = true; } switch (option) { case 1: if (dataName == "Hero" && multiple) { AddHeroToAvengers(idSelectedEntity); } else { if (dataName == "Hero" && !multiple) { idSelectedHero = idSelectedEntity; } goto mainExit; } break; case 2: Console.Clear(); goto localExit; case 3: if (dataName == "Hero" && multiple) { ShowAvengersTeam(); } else { goto default; } break; case 4: if (dataName == "Hero" && multiple) { if (avengersList.Any()) { avengersList.Clear(); SpecialMessage.SuccessMessage("The Avengers team was cleared!"); } else { SpecialMessage.ErrorMessage("The Avengers team is already empty!"); } } else { goto default; } break; case 5: if (dataName == "Hero" && multiple) { goto mainExit; } else { goto default; } default: if (!errorGiven2) { SpecialMessage.ErrorMessage("No option of value = " + option + " was found"); } break; } } localExit :; } else { if (!errorGiven) { SpecialMessage.ErrorMessage("No " + dataName.ToLower() + " of id = " + idSelectedEntity + " was found"); } } } mainExit: Console.Clear(); }