2020-11-06 04:57:00 -05:00
|
|
|
package;
|
|
|
|
|
2021-03-24 18:41:54 -04:00
|
|
|
import Controls.Control;
|
2021-02-24 18:32:51 -05:00
|
|
|
import flixel.FlxG;
|
|
|
|
import flixel.FlxSprite;
|
|
|
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
|
|
|
import flixel.text.FlxText;
|
|
|
|
import flixel.util.FlxColor;
|
2021-03-24 18:41:54 -04:00
|
|
|
import polymod.Polymod;
|
|
|
|
#if desktop
|
|
|
|
import sys.FileSystem;
|
|
|
|
#end
|
2021-02-24 18:32:51 -05:00
|
|
|
|
2020-11-06 04:57:00 -05:00
|
|
|
class OptionsSubState extends MusicBeatSubstate
|
|
|
|
{
|
2021-03-21 16:29:47 -04:00
|
|
|
var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume', 'Controls', 'Colors', 'Back'];
|
2021-02-24 18:32:51 -05:00
|
|
|
|
|
|
|
var selector:FlxSprite;
|
|
|
|
var curSelected:Int = 0;
|
|
|
|
|
|
|
|
var grpOptionsTexts:FlxTypedGroup<FlxText>;
|
2020-11-06 04:57:00 -05:00
|
|
|
|
2021-03-13 13:37:59 -05:00
|
|
|
// public static var isDownscroll:Bool = false;
|
|
|
|
|
2020-11-06 04:57:00 -05:00
|
|
|
public function new()
|
|
|
|
{
|
|
|
|
super();
|
2021-02-24 18:32:51 -05:00
|
|
|
|
2021-03-09 19:41:03 -05:00
|
|
|
#if desktop
|
|
|
|
textMenuItems.push('Mods');
|
|
|
|
#end
|
|
|
|
|
2021-02-24 18:32:51 -05:00
|
|
|
grpOptionsTexts = new FlxTypedGroup<FlxText>();
|
|
|
|
add(grpOptionsTexts);
|
|
|
|
|
|
|
|
selector = new FlxSprite().makeGraphic(5, 5, FlxColor.RED);
|
|
|
|
add(selector);
|
|
|
|
|
|
|
|
for (i in 0...textMenuItems.length)
|
|
|
|
{
|
|
|
|
var optionText:FlxText = new FlxText(20, 20 + (i * 50), 0, textMenuItems[i], 32);
|
|
|
|
optionText.ID = i;
|
|
|
|
grpOptionsTexts.add(optionText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override function update(elapsed:Float)
|
|
|
|
{
|
|
|
|
super.update(elapsed);
|
|
|
|
|
2021-03-24 16:44:58 -04:00
|
|
|
if (controls.UI_UP_P)
|
2021-02-24 18:32:51 -05:00
|
|
|
curSelected -= 1;
|
|
|
|
|
2021-03-24 16:44:58 -04:00
|
|
|
if (controls.UI_DOWN_P)
|
2021-02-24 18:32:51 -05:00
|
|
|
curSelected += 1;
|
|
|
|
|
|
|
|
if (curSelected < 0)
|
|
|
|
curSelected = textMenuItems.length - 1;
|
|
|
|
|
|
|
|
if (curSelected >= textMenuItems.length)
|
|
|
|
curSelected = 0;
|
|
|
|
|
|
|
|
grpOptionsTexts.forEach(function(txt:FlxText)
|
|
|
|
{
|
|
|
|
txt.color = FlxColor.WHITE;
|
|
|
|
|
|
|
|
if (txt.ID == curSelected)
|
|
|
|
txt.color = FlxColor.YELLOW;
|
|
|
|
});
|
|
|
|
|
2021-03-21 16:29:47 -04:00
|
|
|
if (controls.BACK)
|
|
|
|
FlxG.switchState(new MainMenuState());
|
|
|
|
|
2021-02-24 18:32:51 -05:00
|
|
|
if (controls.ACCEPT)
|
|
|
|
{
|
|
|
|
switch (textMenuItems[curSelected])
|
|
|
|
{
|
2021-03-21 14:45:46 -04:00
|
|
|
case "Colors":
|
|
|
|
FlxG.state.closeSubState();
|
2021-03-24 18:41:54 -04:00
|
|
|
|
2021-02-24 18:32:51 -05:00
|
|
|
case "Controls":
|
|
|
|
FlxG.state.closeSubState();
|
|
|
|
FlxG.state.openSubState(new ControlsSubState());
|
2021-03-09 19:41:03 -05:00
|
|
|
case "Mods":
|
|
|
|
FlxG.state.closeSubState();
|
2021-03-24 18:41:54 -04:00
|
|
|
// FlxG.state.openSubState(new ModdingSubstate());
|
2021-03-21 16:29:47 -04:00
|
|
|
case "Back":
|
|
|
|
FlxG.switchState(new MainMenuState());
|
2021-02-24 18:32:51 -05:00
|
|
|
}
|
|
|
|
}
|
2020-11-06 04:57:00 -05:00
|
|
|
}
|
|
|
|
}
|