public static string CorrectLetterOnlyInput() { var str = ""; var Repeat = false; while (true) { if (Repeat == true) { XtronFunctions.ClearLine(1); } Console.Write($"\n PLAYER NAME:>"); str = Console.ReadLine(); if (str != "" && str.All(char.IsLetter)) //FIXA SÅ INTE ENTER FLYTTAR NER OM TOM INPUT { XtronFunctions.ClearLine(1); Console.WriteLine($" ADVENTURER {str.ToUpper()}, SELECT YOUR CLASS!\n"); return(str.ToUpper()); } if (Repeat == false) { Repeat = true; } } }
public void StartGame() { //STARTMENY GameMenues.GenerateHeader(); var MenuSelect = GameMenues.StartMenuSelect(); XtronFunctions.ClearLine(7); switch (MenuSelect) { case 1: Hero1 = new Player(Player.CorrectLetterOnlyInput(), Player.SelectClass()); Console.WriteLine($"Player Name: {Hero1.Name} Class: {Hero1.PlayerClass} HP: {Hero1.HP}"); break; case 2: break; case 3: break; } XtronFunctions.DelayStringWrite("Quack Quack Quack", 250); Console.ReadLine(); }
public static int StartMenuSelect() { XtronFunctions.DrawLine(ConsoleColor.DarkGreen); Console.ForegroundColor = ConsoleColor.DarkGray; Console.Write($"\n{SmallTab}>> "); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("NEW GAME"); if (!File.Exists(@"gamesave.txt")) { Console.ForegroundColor = ConsoleColor.DarkRed; } Console.WriteLine($"{SmallTab} CONTINUE"); if (Console.ForegroundColor == ConsoleColor.DarkRed) { Console.ForegroundColor = ConsoleColor.DarkGreen; } Console.WriteLine($"{SmallTab} EXIT\n\n"); XtronFunctions.DrawLine(ConsoleColor.DarkGreen); int MenuSelect; return(MenuSelect = MenuBrowse(3, 5, 16, 22)); }