diff --git a/.vs/EvilSatellites/v16/.suo b/.vs/EvilSatellites/v16/.suo index 80e1eab..06cd66f 100644 Binary files a/.vs/EvilSatellites/v16/.suo and b/.vs/EvilSatellites/v16/.suo differ diff --git a/EvilSatellites/Menu/MenuContainer.cs b/EvilSatellites/Menu/MenuContainer.cs index 1a110a3..c248067 100644 --- a/EvilSatellites/Menu/MenuContainer.cs +++ b/EvilSatellites/Menu/MenuContainer.cs @@ -9,5 +9,19 @@ namespace EvilSatellites.Menu public class MenuContainer { public List Entries; + public string Title; + public string Description; + public MenuContainer(string title, string description) + { + Entries = new List(); + Title = title; + Description = description; + } + + public MenuContainer Add(MenuEntry entry) + { + Entries.Add(entry); + return this; + } } } diff --git a/EvilSatellites/Menu/MenuEntry.cs b/EvilSatellites/Menu/MenuEntry.cs index a78c915..a7b33d2 100644 --- a/EvilSatellites/Menu/MenuEntry.cs +++ b/EvilSatellites/Menu/MenuEntry.cs @@ -9,5 +9,11 @@ namespace EvilSatellites.Menu public class MenuEntry { public string Name; + public string Description; + public MenuEntry(string name, string description = "") + { + Name = name; + Description = description; + } } } diff --git a/EvilSatellites/ScreenManager.cs b/EvilSatellites/ScreenManager.cs index 71c425b..68bff7d 100644 --- a/EvilSatellites/ScreenManager.cs +++ b/EvilSatellites/ScreenManager.cs @@ -26,7 +26,7 @@ namespace EvilSatellites EnvironmentEffect = Sound.CreateReverb(); EnvironmentEffect.Delay = 0.03; EnvironmentEffect.Wet = 30; - EnvironmentEffect.T60 = 5; + EnvironmentEffect.T60 = 1; EnvironmentEffect.Defusion = 1f; EnvironmentEffect.FreePath = 0.02; diff --git a/EvilSatellites/Screens/MenuScreen.cs b/EvilSatellites/Screens/MenuScreen.cs new file mode 100644 index 0000000..fb65861 --- /dev/null +++ b/EvilSatellites/Screens/MenuScreen.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using EvilSatellites.Menu; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; +using DavyKager; + +namespace EvilSatellites.Screens +{ + public class MenuScreen : IScreen + { + public MenuContainer MenuOptions; + public int CursorPosition; + public ScreenManager _Manager; + public ScreenState _State; + public InputManager Inputs = new InputManager(); + public MenuScreen(ScreenManager manager, MenuContainer options) + { + _Manager = manager; + MenuOptions = options; + } + + ScreenManager IScreen.Manager { get => _Manager; set => _Manager = value; } + ScreenState IScreen.State { get => _State; set => _State = value; } + + void IScreen.Activate() + { + CursorPosition = 0; + Tolk.Output(MenuOptions.Title, true); + Tolk.Output(MenuOptions.Description, false); + Tolk.Output(MenuOptions.Entries[CursorPosition].Name); + } + + void IScreen.Deactivate() + { + return; + } + + void IScreen.HandleInput(GameTime gameTime, KeyboardState inputs) + { + Inputs.Update(); + if (Inputs.IsJustPressed(Keys.Down)) + { + NextItem(); + } + if (Inputs.IsJustPressed(Keys.Down)) + { + PreviousItem(); + } + if (Inputs.IsJustPressed(Keys.Enter)) + { + SelectItem(); + } + } + + void IScreen.Update(GameTime gameTime) + { + return; + } + + public void PreviousItem() + { + CursorPosition--; + CheckMenuBounds(); + ReadMenuItem(); + } + + public void NextItem() + { + CursorPosition++; + CheckMenuBounds(); + ReadMenuItem(); + } + + public void CheckMenuBounds() + { + if (CursorPosition > MenuOptions.Entries.Count-1) + { + CursorPosition = 0; + } + if (CursorPosition < 0) + { + CursorPosition = MenuOptions.Entries.Count - 1; + } + } + + public void ReadMenuItem() + { + Tolk.Output(MenuOptions.Entries[CursorPosition].Name, true); + } + + public void SelectItem() + { + return; + } + } +}