Initial options screen
This commit is contained in:
@@ -223,6 +223,18 @@ namespace EvilSatellites.Screens
|
||||
{
|
||||
DavyKager.Tolk.Output(Objects.Count.ToString());
|
||||
}
|
||||
if (Input.IsJustPressed(Keys.PageUp))
|
||||
{
|
||||
Manager.Music.Volume = Manager.Music.Volume + 0.05f;
|
||||
}
|
||||
if (Input.IsJustPressed(Keys.PageDown))
|
||||
{
|
||||
Manager.Music.Volume = Manager.Music.Volume - 0.05f;
|
||||
}
|
||||
if (Input.IsJustPressed(Keys.Escape))
|
||||
{
|
||||
EndGame();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckCollisions()
|
||||
|
||||
@@ -15,20 +15,29 @@ namespace EvilSatellites.Screens
|
||||
|
||||
MenuOptions = new MenuContainer("Main Menu", "Navigate with up and down arrows,, and enter to select.");
|
||||
MenuOptions.Add(new MenuEntry("Start", "Start the game"))
|
||||
.Add(new MenuEntry("Exit", "Exit the game"))
|
||||
.Add(new MenuEntry("Something Else", "Do something else"));
|
||||
.Add(new MenuEntry("Options", "Change game options"))
|
||||
.Add(new MenuEntry("Exit", "Exit the game"));
|
||||
base.Activate();
|
||||
}
|
||||
|
||||
public override void SelectItem()
|
||||
{
|
||||
Manager.Sound.PlayOneshot(@"sfx/ui/menuChoose.wav");
|
||||
base.SelectItem();
|
||||
if (CursorPosition == 0)
|
||||
{
|
||||
Manager.AddScreen(new GameScreen());
|
||||
Manager.RemoveScreen(this);
|
||||
Manager.Game.ResetElapsedTime();
|
||||
}
|
||||
if (CursorPosition == 2)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
if (CursorPosition == 1)
|
||||
{
|
||||
Manager.RemoveScreen(this);
|
||||
Manager.AddScreen(new OptionsScreen());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ namespace EvilSatellites.Screens
|
||||
|
||||
public virtual void SelectItem()
|
||||
{
|
||||
Manager.Sound.PlayOneshot(@"sfx/ui/menuChoose.wav");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using EvilSatellites.Menu;
|
||||
using DavyKager;
|
||||
|
||||
namespace EvilSatellites.Screens
|
||||
{
|
||||
public class OptionsScreen : MenuScreen
|
||||
{
|
||||
public override void Activate()
|
||||
{
|
||||
MenuOptions = new MenuContainer("Options", "Set global options for the game.");
|
||||
MenuOptions.Add(new MenuEntry("Music Volume", "Toggle between music volumes"))
|
||||
.Add(new MenuEntry("Use screen reader", "Use screen reader speech instead of SAPI"))
|
||||
.Add(new MenuEntry("Back", "Go Back to previous screen"));
|
||||
base.Activate();
|
||||
}
|
||||
|
||||
public override void SelectItem()
|
||||
{
|
||||
base.SelectItem();
|
||||
if (CursorPosition == 0)
|
||||
{
|
||||
ChangeVolume();
|
||||
}
|
||||
if (CursorPosition == 1)
|
||||
{
|
||||
ChangeSpeech();
|
||||
}
|
||||
if (CursorPosition == 2)
|
||||
{
|
||||
Manager.RemoveScreen(this);
|
||||
Manager.AddScreen(new MainMenuScreen());
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeSpeech()
|
||||
{
|
||||
if (GameSettings.PreferSAPI)
|
||||
{
|
||||
Tolk.PreferSAPI(false);
|
||||
Tolk.TrySAPI(false);
|
||||
Tolk.Output("Prefering screen reader");
|
||||
} else
|
||||
{
|
||||
Tolk.PreferSAPI(true);
|
||||
Tolk.TrySAPI(true);
|
||||
Tolk.Output("Prefering SAPI");
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeVolume()
|
||||
{
|
||||
Inputs.Update();
|
||||
if (Manager.Music.Volume > 0.9)
|
||||
{
|
||||
Manager.Music.Volume = 0f;
|
||||
return;
|
||||
}
|
||||
if (Manager.Music.Volume < 0)
|
||||
{
|
||||
Manager.Music.Volume = 1;
|
||||
}
|
||||
if (Inputs.IsPressed(Microsoft.Xna.Framework.Input.Keys.LeftShift))
|
||||
{
|
||||
Manager.Music.Volume = Manager.Music.Volume - 0.1f;
|
||||
} else
|
||||
{
|
||||
Manager.Music.Volume = Manager.Music.Volume + 0.1f;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,10 +19,12 @@ namespace EvilSatellites.Screens
|
||||
.Add(new MenuEntry("Satellite collisions: " + GameStats.SatelliteCollisions.ToString(), "How many satellites you crashed into"))
|
||||
.Add(new MenuEntry("Total play time: " + GameStats.TotalPlayTime.ToString(), "How much time you spent on this run"))
|
||||
.Add(new MenuEntry("OK", "Go back to main menu"));
|
||||
base.Activate();
|
||||
}
|
||||
|
||||
public override void SelectItem()
|
||||
{
|
||||
base.SelectItem();
|
||||
if (CursorPosition == MenuOptions.Entries.Count-1)
|
||||
{
|
||||
Manager.RemoveScreen(this);
|
||||
|
||||
Reference in New Issue
Block a user