Add initial menu system
This commit is contained in:
Binary file not shown.
@@ -9,5 +9,19 @@ namespace EvilSatellites.Menu
|
|||||||
public class MenuContainer
|
public class MenuContainer
|
||||||
{
|
{
|
||||||
public List<MenuEntry> Entries;
|
public List<MenuEntry> Entries;
|
||||||
|
public string Title;
|
||||||
|
public string Description;
|
||||||
|
public MenuContainer(string title, string description)
|
||||||
|
{
|
||||||
|
Entries = new List<MenuEntry>();
|
||||||
|
Title = title;
|
||||||
|
Description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MenuContainer Add(MenuEntry entry)
|
||||||
|
{
|
||||||
|
Entries.Add(entry);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,5 +9,11 @@ namespace EvilSatellites.Menu
|
|||||||
public class MenuEntry
|
public class MenuEntry
|
||||||
{
|
{
|
||||||
public string Name;
|
public string Name;
|
||||||
|
public string Description;
|
||||||
|
public MenuEntry(string name, string description = "")
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Description = description;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace EvilSatellites
|
|||||||
EnvironmentEffect = Sound.CreateReverb();
|
EnvironmentEffect = Sound.CreateReverb();
|
||||||
EnvironmentEffect.Delay = 0.03;
|
EnvironmentEffect.Delay = 0.03;
|
||||||
EnvironmentEffect.Wet = 30;
|
EnvironmentEffect.Wet = 30;
|
||||||
EnvironmentEffect.T60 = 5;
|
EnvironmentEffect.T60 = 1;
|
||||||
EnvironmentEffect.Defusion = 1f;
|
EnvironmentEffect.Defusion = 1f;
|
||||||
EnvironmentEffect.FreePath = 0.02;
|
EnvironmentEffect.FreePath = 0.02;
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user