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 DisplayRightPanel() { string color = StringToColor.ConvertToString(currentColor).PadRight(12); MainMenuHelper.MakeFrame(Console.WindowWidth - 31, 0); int textStart = Console.WindowWidth - 29; MainMenuHelper.WriteInCenter("Settings", 3, textStart, 2); MainMenuHelper.WriteText("Current X position: " + cursorLeftPosition.ToString().PadRight(4), textStart, 5); MainMenuHelper.WriteText("Current Y position: " + (EditorInstance.MapHeight - cursorTopPosition - 1).ToString().PadRight(4), textStart, 6); if (currentTabIndex == 0) { MainMenuHelper.WriteText("Current color: " + color, textStart, 8); MainMenuHelper.WriteText("Map height: " + EditorInstance.MapHeight.ToString().PadRight(4), textStart, 10); MainMenuHelper.WriteText("Map width: " + EditorInstance.MapWidth.ToString().PadRight(4), textStart, 11); } else if (currentTabIndex == 1) { //Current color if (currentCursorIndex == 0) { if (!enterPressed) { MainMenuHelper.WriteText("Current color: " + color, textStart, 8, ConsoleColor.Gray, ConsoleColor.Blue); } else if (enterPressed) { MainMenuHelper.WriteText("Current color: " + color, textStart, 8, ConsoleColor.Black, ConsoleColor.Cyan); } } else { MainMenuHelper.WriteText("Current color: " + color, textStart, 8); } //Map height string mapHeight = EditorInstance.MapHeight.ToString().PadRight(4); MainMenuHelper.WriteText("Map height: ", textStart, 10); if (currentCursorIndex == 1) { if (!enterPressed) { MainMenuHelper.WriteText(mapHeight, textStart + 12, 10, ConsoleColor.Gray, ConsoleColor.Blue); } else if (enterPressed) { MainMenuHelper.WriteText(mapHeight, textStart + 12, 10, ConsoleColor.Black, ConsoleColor.Cyan); } } else { MainMenuHelper.WriteText(mapHeight, textStart + 12, 10); } //Map width string mapWidth = EditorInstance.MapWidth.ToString().PadRight(4); MainMenuHelper.WriteText("Map width: ", textStart, 11); if (currentCursorIndex == 2) { if (!enterPressed) { MainMenuHelper.WriteText(mapWidth, textStart + 12, 11, ConsoleColor.Gray, ConsoleColor.Blue); } else if (enterPressed) { MainMenuHelper.WriteText(mapWidth, textStart + 12, 11, ConsoleColor.Black, ConsoleColor.Cyan); } } else { MainMenuHelper.WriteText(mapWidth, textStart + 12, 11); } } }