private void DisplayMapSelection() { //Load maps mainMaps = Helper.GetAndVerifyMaps(Environment.CurrentDirectory + "\\Map layouts\\Main"); customMaps = Helper.GetAndVerifyMaps(Environment.CurrentDirectory + "\\Map layouts\\Custom"); //New game top part MainMenuHelper.MakeEdges('|', 0); MainMenuHelper.MakeFrame(); MainMenuHelper.MakeEdges('|', Console.WindowHeight - 2); MainMenuHelper.WriteInCenter("New game", 2); MainMenuHelper.FillALine('=', 1, 4); for (int i = 5; i < Console.WindowHeight - 6; i++) { MainMenuHelper.WriteInCenter("|", Console.CursorTop); } //Display main maps MainMenuHelper.WriteText("Main maps", 3, 6); for (int i = 0; i < mainMaps.Count; i++) { if (currentTabIndex == 0 && currentCursorIndex == i) { MainMenuHelper.WriteText(mainMaps[i].Split('\\')[^ 1], 6, ConsoleColor.Gray, ConsoleColor.Blue);
private void DisplayNewMap() { while (true) { currentCursorIndexLimit = 2; Console.SetWindowSize(30, 14); Console.SetBufferSize(30, 14); MainMenuHelper.MakeFrame(); MainMenuHelper.WriteInCenter("New map", 2); MainMenuHelper.FillALine('=', 1, 4); MainMenuHelper.WriteInCenter("Map name: ", 6); MainMenuHelper.WriteText(mapNameInput.PadRight(14), 8, 8); MainMenuHelper.WriteInCenter("‾‾‾‾‾‾‾‾‾‾‾‾‾‾", 9); Console.SetCursorPosition(8 + mapNameInput.Length, 8); Console.CursorVisible = true; ConsoleKeyInfo input = Console.ReadKey(); switch (input.Key) { case ConsoleKey.Enter: StartEditor(); return; case ConsoleKey.Backspace: if (mapNameInput.Length > 0) { mapNameInput = mapNameInput.Remove(mapNameInput.Length - 1); } break; case ConsoleKey.Escape: currentSection = MapEditorSection.Menu; Console.Clear(); Console.CursorVisible = false; DisplayMenu(); //I need to display the menu here, or else the player will be on a blank screen. return; default: if (mapNameInput.Length < 14) { if (input.KeyChar == ' ') { mapNameInput += ' '; } else { //trim used for getting rid of characters like pgup, del, insert, tab mapNameInput += input.KeyChar.ToString().Trim(); } } break; } } }
private void DisplayMainMenu() { CursorIndexLimit = 3; MainMenuHelper.MakeFrame(); //Title text DisplayMainTitle(); MainMenuHelper.FillALine('=', 1, 13); MainMenuHelper.WriteSelectableTextInCenter("Play", 15, 0, currentCursorIndex); MainMenuHelper.WriteSelectableTextInCenter("Editor", 18, 1, currentCursorIndex); MainMenuHelper.WriteSelectableTextInCenter("Settings", 21, 2, currentCursorIndex); MainMenuHelper.WriteSelectableTextInCenter("Exit", 24, 3, currentCursorIndex); }
private void DisplayMenu() { currentCursorIndexLimit = 2; Console.SetWindowSize(30, 14); Console.SetBufferSize(30, 14); MainMenuHelper.MakeFrame(); MainMenuHelper.WriteInCenter("Map editor", 2); MainMenuHelper.FillALine('=', 1, 4); MainMenuHelper.WriteSelectableTextInCenter("Create a new map", 6, 0, currentCursorIndex); MainMenuHelper.WriteSelectableTextInCenter("Edit an existing map", 8, 1, currentCursorIndex); MainMenuHelper.WriteSelectableTextInCenter("Back to main menu", 10, 2, currentCursorIndex); }