-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81c738b
commit c6d3282
Showing
4 changed files
with
137 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
package options; | ||
|
||
import states.MainMenuState; | ||
import backend.StageData; | ||
|
||
class PrefsMenu extends MusicBeatState | ||
{ | ||
var options:Array<String> = ['Graphics', 'Visuals and UI', 'Gameplay']; | ||
private var grpOptions:FlxTypedGroup<Alphabet>; | ||
private static var curSelected:Int = 0; | ||
public static var menuBG:FlxSprite; | ||
public static var onPlayState:Bool = false; | ||
|
||
function openSelectedSubstate(label:String) { | ||
switch(label) { | ||
case 'Graphics': | ||
openSubState(new options.GraphicsSettingsSubState()); | ||
case 'Visuals and UI': | ||
openSubState(new options.VisualsUISubState()); | ||
case 'Gameplay': | ||
openSubState(new options.GameplaySettingsSubState()); | ||
} | ||
} | ||
|
||
var selectorLeft:Alphabet; | ||
var selectorRight:Alphabet; | ||
|
||
override function create() { | ||
#if desktop | ||
DiscordClient.changePresence("Preferences Menu", null); | ||
#end | ||
|
||
var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat')); | ||
bg.antialiasing = ClientPrefs.data.antialiasing; | ||
bg.color = 0xFFea71fd; | ||
bg.updateHitbox(); | ||
|
||
bg.screenCenter(); | ||
add(bg); | ||
|
||
var grid:FlxBackdrop = new FlxBackdrop(FlxGridOverlay.createGrid(80, 80, 160, 160, true, 0x33FFFFFF, 0x0)); | ||
grid.velocity.set(40, 40); | ||
grid.alpha = 0; | ||
FlxTween.tween(grid, {alpha: 1}, 0.5, {ease: FlxEase.quadOut}); | ||
add(grid); | ||
|
||
grpOptions = new FlxTypedGroup<Alphabet>(); | ||
add(grpOptions); | ||
|
||
for (i in 0...options.length) | ||
{ | ||
var optionText:Alphabet = new Alphabet(0, 0, options[i], true); | ||
optionText.screenCenter(); | ||
optionText.y += (100 * (i - (options.length / 2))) + 50; | ||
grpOptions.add(optionText); | ||
} | ||
|
||
selectorLeft = new Alphabet(0, 0, '>', true); | ||
add(selectorLeft); | ||
selectorRight = new Alphabet(0, 0, '<', true); | ||
add(selectorRight); | ||
|
||
changeSelection(); | ||
ClientPrefs.saveSettings(); | ||
|
||
super.create(); | ||
} | ||
|
||
override function closeSubState() { | ||
super.closeSubState(); | ||
ClientPrefs.saveSettings(); | ||
} | ||
|
||
override function update(elapsed:Float) { | ||
super.update(elapsed); | ||
|
||
if (controls.UI_UP_P) { | ||
changeSelection(-1); | ||
} | ||
if (controls.UI_DOWN_P) { | ||
changeSelection(1); | ||
} | ||
if (controls.BACK) { | ||
FlxG.sound.play(Paths.sound('cancelMenu')); | ||
MusicBeatState.switchState(new OptionsState()); | ||
} | ||
else if (controls.ACCEPT) openSelectedSubstate(options[curSelected]); | ||
} | ||
|
||
function changeSelection(change:Int = 0) { | ||
curSelected += change; | ||
if (curSelected < 0) | ||
curSelected = options.length - 1; | ||
if (curSelected >= options.length) | ||
curSelected = 0; | ||
|
||
var bullShit:Int = 0; | ||
|
||
for (item in grpOptions.members) { | ||
item.targetY = bullShit - curSelected; | ||
bullShit++; | ||
|
||
item.alpha = 0.6; | ||
if (item.targetY == 0) { | ||
item.alpha = 1; | ||
selectorLeft.x = item.x - 63; | ||
selectorLeft.y = item.y; | ||
selectorRight.x = item.x + item.width + 15; | ||
selectorRight.y = item.y; | ||
} | ||
} | ||
FlxG.sound.play(Paths.sound('scrollMenu')); | ||
} | ||
|
||
override function destroy() | ||
{ | ||
ClientPrefs.loadPrefs(); | ||
super.destroy(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters