-
Notifications
You must be signed in to change notification settings - Fork 6
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
fe9d9c3
commit 4e3fb3a
Showing
5 changed files
with
201 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
package; | ||
|
||
import flixel.tweens.FlxTween; | ||
import flixel.tweens.FlxEase; | ||
import Controls.KeyboardScheme; | ||
import Controls.Control; | ||
import flash.text.TextField; | ||
import flixel.FlxG; | ||
import flixel.FlxSprite; | ||
import flixel.addons.display.FlxGridOverlay; | ||
import flixel.group.FlxGroup.FlxTypedGroup; | ||
import flixel.input.keyboard.FlxKey; | ||
import flixel.math.FlxMath; | ||
import flixel.text.FlxText; | ||
import flixel.util.FlxColor; | ||
import lime.utils.Assets; | ||
import flixel.util.FlxTimer; | ||
#if desktop | ||
import Discord.DiscordClient; | ||
#end | ||
|
||
class AdminOptionsMenu extends MusicBeatState | ||
{ | ||
var selector:FlxText; | ||
var curSelected:Int = 0; | ||
|
||
var controlsStrings:Array<String> = []; | ||
|
||
private var grpControls:FlxTypedGroup<Alphabet>; | ||
|
||
override function create() | ||
{ | ||
#if desktop | ||
DiscordClient.changePresence("In the Admin Options Menu", null); | ||
#end | ||
var menuBG:FlxSprite = new FlxSprite(); | ||
menuBG.color = 0xff373737; | ||
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1)); | ||
menuBG.updateHitbox(); | ||
menuBG.antialiasing = true; | ||
menuBG.loadGraphic(MainMenuState.randomizeBG()); | ||
add(menuBG); | ||
|
||
controlsStrings = CoolUtil.coolStringFile( | ||
(FlxG.save.data.adminMode ? 'Admin Mode ON' : 'Admin Mode OFF') | ||
+ "\n" + (FlxG.save.data.botplay ? 'Bot Play ON' : 'Bot Play OFF') | ||
+ "\n" + (FlxG.save.data.practiceMode ? 'Practice Mode ON' : 'Practice Mode OFF') | ||
); | ||
|
||
grpControls = new FlxTypedGroup<Alphabet>(); | ||
add(grpControls); | ||
|
||
for (i in 0...controlsStrings.length) | ||
{ | ||
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i], true, false); | ||
controlLabel.screenCenter(X); | ||
controlLabel.itemType = 'Vertical'; | ||
controlLabel.isMenuItem = true; | ||
controlLabel.targetY = i; | ||
grpControls.add(controlLabel); | ||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! | ||
} | ||
|
||
super.create(); | ||
} | ||
|
||
override function update(elapsed:Float) | ||
{ | ||
super.update(elapsed); | ||
|
||
if (controls.BACK) | ||
{ | ||
FlxG.save.flush(); | ||
FlxG.switchState(new OptionsMenu()); | ||
} | ||
if (controls.UP_P) | ||
changeSelection(-1); | ||
if (controls.DOWN_P) | ||
changeSelection(1); | ||
|
||
if (controls.ACCEPT) | ||
{ | ||
grpControls.remove(grpControls.members[curSelected]); | ||
switch(curSelected) | ||
{ | ||
case 0: | ||
FlxG.save.data.adminMode = !FlxG.save.data.adminMode; | ||
updateGroupControls((FlxG.save.data.adminMode ? 'Admin Mode ON' : 'Admin Mode OFF'), 1, 'Vertical'); | ||
case 1: | ||
FlxG.save.data.botplay = !FlxG.save.data.botplay; | ||
updateGroupControls(FlxG.save.data.botplay ? 'Bot Play ON' : 'Bot Play OFF', 13, 'Vertical'); | ||
case 2: | ||
FlxG.save.data.practiceMode = !FlxG.save.data.practiceMode; | ||
updateGroupControls(FlxG.save.data.practiceMode ? 'Practice Mode ON' : 'Practice Mode OFF', 13, 'Vertical'); | ||
} | ||
} | ||
} | ||
|
||
var isSettingControl:Bool = false; | ||
|
||
override function beatHit() | ||
{ | ||
super.beatHit(); | ||
FlxTween.tween(FlxG.camera, {zoom:1.05}, 0.3, {ease: FlxEase.quadOut, type: BACKWARD}); | ||
} | ||
function updateGroupControls(controlText:String, yIndex:Int, controlTextItemType:String) | ||
{ | ||
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, controlText, true, false); | ||
ctrl.screenCenter(X); | ||
ctrl.isMenuItem = true; | ||
ctrl.targetY = curSelected - yIndex; | ||
ctrl.itemType = controlTextItemType; | ||
grpControls.add(ctrl); | ||
} | ||
|
||
function changeSelection(change:Int = 0) | ||
{ | ||
#if !switch | ||
// NGio.logEvent('Fresh'); | ||
#end | ||
|
||
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); | ||
|
||
curSelected += change; | ||
|
||
if (curSelected < 0) | ||
curSelected = grpControls.length - 1; | ||
if (curSelected >= grpControls.length) | ||
curSelected = 0; | ||
|
||
// selector.y = (70 * curSelected) + 30; | ||
|
||
var bullShit:Int = 0; | ||
|
||
for (item in grpControls.members) | ||
{ | ||
item.targetY = bullShit - curSelected; | ||
bullShit++; | ||
|
||
item.alpha = 0.6; | ||
// item.setGraphicSize(Std.int(item.width * 0.8)); | ||
|
||
if (item.targetY == 0) | ||
{ | ||
item.alpha = 1; | ||
// item.setGraphicSize(Std.int(item.width)); | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.