public static Weapon SwordMenu() { bool valid; int input; List <Weapon> swords = WeaponShop.GetSwords(2); do { valid = true; Console.Write("Which sword would you like to buy?\n"); int i = 0; foreach (Sword sword in swords) { i++; Console.ForegroundColor = sword.Rarity.GetRarityColor(); Console.WriteLine("\n" + i + ")\n" + sword.ToString(false)); Console.ResetColor(); } Console.Write("\nInput: "); if (!int.TryParse(Console.ReadLine(), out input) || input > swords.Count() || input < 1) { Console.WriteLine("Invalid input, try something else"); Console.ReadKey(); Console.Clear(); valid = false; } } while (valid == false); return(swords[input - 1]); }
public static Weapon MightWeapMenu() { bool valid; int input; List <Weapon> mightyWeaps = WeaponShop.GetMightyWeaps(2); do { valid = true; Console.Write("Which mighty weapon would you like to buy?\n"); int i = 0; foreach (MightyWeapon mightyWeapon in mightyWeaps) { i++; Console.ForegroundColor = mightyWeapon.Rarity.GetRarityColor(); Console.WriteLine("\n" + i + ")\n" + mightyWeapon.ToString(false)); Console.ResetColor(); } Console.Write("\nInput: "); if (!int.TryParse(Console.ReadLine(), out input) || input > mightyWeaps.Count() || input < 1) { Console.WriteLine("Invalid input, try something else"); Console.ReadKey(); Console.Clear(); valid = false; } } while (valid == false); return(mightyWeaps[input - 1]); }