aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyndamia <kami02882@gmail.com>2019-09-15 09:37:04 +0300
committerSyndamia <kami02882@gmail.com>2019-09-15 09:37:04 +0300
commit7fc10ca322425deeb3ca5c51cf602718b28863be (patch)
tree8eaf97870919ba1fb4b0fc891a3ab74eeedd36be
parent3967e21a428281bc6a8df364f70c451b93ef9e7a (diff)
downloadShower-7fc10ca322425deeb3ca5c51cf602718b28863be.tar
Shower-7fc10ca322425deeb3ca5c51cf602718b28863be.tar.gz
Shower-7fc10ca322425deeb3ca5c51cf602718b28863be.zip
Worked on issue #59
Left out only the settings menu (2nd checkbox)
-rw-r--r--Bitspace 2.0/Bitspace 2.0/Bitspace 2.0.csproj1
-rw-r--r--Bitspace 2.0/Bitspace 2.0/Menu.cs87
-rw-r--r--Bitspace 2.0/Bitspace 2.0/Program.cs2
3 files changed, 89 insertions, 1 deletions
diff --git a/Bitspace 2.0/Bitspace 2.0/Bitspace 2.0.csproj b/Bitspace 2.0/Bitspace 2.0/Bitspace 2.0.csproj
index f388bf7..0d06311 100644
--- a/Bitspace 2.0/Bitspace 2.0/Bitspace 2.0.csproj
+++ b/Bitspace 2.0/Bitspace 2.0/Bitspace 2.0.csproj
@@ -55,6 +55,7 @@
<Compile Include="KeyBindings.cs" />
<Compile Include="Game map\Map.cs" />
<Compile Include="Game creatures\Mob.cs" />
+ <Compile Include="Menu.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
diff --git a/Bitspace 2.0/Bitspace 2.0/Menu.cs b/Bitspace 2.0/Bitspace 2.0/Menu.cs
new file mode 100644
index 0000000..b65ef98
--- /dev/null
+++ b/Bitspace 2.0/Bitspace 2.0/Menu.cs
@@ -0,0 +1,87 @@
+using System;
+using Bitspace_2._0.Game_map;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Bitspace_2._0 {
+ public static class Menu {
+ private static int yPos;
+
+ public static void StartMenu() {
+ yPos = 2;
+ while (true) {
+ Console.Clear();
+
+ Console.ForegroundColor = ConsoleColor.Gray;
+ Console.WriteLine("Bitspace");
+ Console.WriteLine();
+ Console.WriteLine(" New game");
+ Console.WriteLine(" Load game (unavalable)");
+ Console.WriteLine(" Settings");
+
+ if (!MenuCursor(2, 4)) break;
+ }
+ switch (yPos) {
+ case 2: ProgressMenu(); MapSizeMenu(); break;
+ //case 4: SettingsMenu(); break;
+ }
+ }
+
+ private static void MapSizeMenu() {
+ yPos = 2;
+ while (true) {
+ Console.Clear();
+
+ Console.ForegroundColor = ConsoleColor.Gray;
+ Console.WriteLine("Choose map size:");
+ Console.WriteLine();
+ Console.WriteLine(" Small (5 x 10)");
+ Console.WriteLine(" Medium (10 x 20)");
+ Console.WriteLine(" Large (20 x 40)");
+
+ if (!MenuCursor(2, 4)) break;
+ }
+ switch (yPos) {
+ case 2: Map.Generate(5, 10); break;
+ case 3: Map.Generate(10, 20); break;
+ case 4: Map.Generate(20, 40); break;
+ }
+
+ }
+
+ private static void ProgressMenu() {
+ yPos = 2;
+ while (true) {
+ Console.Clear();
+
+ Console.ForegroundColor = ConsoleColor.Gray;
+ Console.WriteLine("Choose progress saving mode:");
+ Console.WriteLine();
+ Console.WriteLine(" Get over it! (No saving)");
+ Console.WriteLine(" Fanatic (Constant saving) UNAVALABLE");
+
+ if (!MenuCursor(2, 3)) break;
+ }
+ switch(yPos) {
+ case 3:
+ case 2: break;
+ }
+ }
+
+ private static bool MenuCursor(int minValue, int maxValue) { //returns false when enter is pressed
+ Console.ForegroundColor = ConsoleColor.Red;
+ Console.SetCursorPosition(0, yPos);
+ Console.Write('>');
+
+ var pressedKey = Console.ReadKey().Key;
+
+ if (pressedKey == ConsoleKey.UpArrow && yPos > minValue) yPos--;
+ else if (pressedKey == ConsoleKey.DownArrow && yPos < maxValue) yPos++;
+ else if (pressedKey == ConsoleKey.Enter) return false;
+
+ return true;
+ }
+ }
+}
diff --git a/Bitspace 2.0/Bitspace 2.0/Program.cs b/Bitspace 2.0/Bitspace 2.0/Program.cs
index ccad6c6..e249b19 100644
--- a/Bitspace 2.0/Bitspace 2.0/Program.cs
+++ b/Bitspace 2.0/Bitspace 2.0/Program.cs
@@ -10,8 +10,8 @@ using Bitspace_2._0.Game_creatures;
namespace Bitspace_2._0 {
class Program {
static void Main(string[] args) {
- Map.Generate(20, 10);
Console.CursorVisible = false;
+ Menu.StartMenu();
for (ulong gameTick = 0; ; gameTick++, Thread.Sleep(80)) {
if (Console.KeyAvailable) {