78 lines
2.1 KiB
C#
78 lines
2.1 KiB
C#
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;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|