Inital Kade Engine Commit
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import Controls.KeyboardScheme;
|
||||
import Controls.Control;
|
||||
import flash.text.TextField;
|
||||
import flixel.FlxG;
|
||||
@ -20,11 +21,23 @@ class OptionsMenu extends MusicBeatState
|
||||
var controlsStrings:Array<String> = [];
|
||||
|
||||
private var grpControls:FlxTypedGroup<Alphabet>;
|
||||
|
||||
var versionShit:FlxText;
|
||||
override function create()
|
||||
{
|
||||
if (FlxG.save.data.newInput == null)
|
||||
FlxG.save.data.newInput = true;
|
||||
|
||||
if (FlxG.save.data.downscroll == null)
|
||||
FlxG.save.data.downscroll = false;
|
||||
|
||||
if (FlxG.save.data.dfjk == null)
|
||||
FlxG.save.data.dfjk = false;
|
||||
|
||||
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
|
||||
controlsStrings = CoolUtil.coolTextFile(Paths.txt('controls'));
|
||||
controlsStrings = CoolUtil.coolStringFile((FlxG.save.data.dfjk ? 'DFJK' : 'WASD') + "\n" + (FlxG.save.data.newInput ? "New input" : "Old Input") + "\n" + (FlxG.save.data.downscroll ? 'Downscroll' : 'Upscroll') + "\nLoad replays");
|
||||
|
||||
trace(controlsStrings);
|
||||
|
||||
menuBG.color = 0xFFea71fd;
|
||||
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
|
||||
menuBG.updateHitbox();
|
||||
@ -32,77 +45,95 @@ class OptionsMenu extends MusicBeatState
|
||||
menuBG.antialiasing = true;
|
||||
add(menuBG);
|
||||
|
||||
/*
|
||||
grpControls = new FlxTypedGroup<Alphabet>();
|
||||
add(grpControls);
|
||||
grpControls = new FlxTypedGroup<Alphabet>();
|
||||
add(grpControls);
|
||||
|
||||
for (i in 0...controlsStrings.length)
|
||||
{
|
||||
if (controlsStrings[i].indexOf('set') != -1)
|
||||
{
|
||||
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i].substring(3) + ': ' + controlsStrings[i + 1], true, false);
|
||||
controlLabel.isMenuItem = true;
|
||||
controlLabel.targetY = i;
|
||||
grpControls.add(controlLabel);
|
||||
}
|
||||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
||||
}
|
||||
*/
|
||||
for (i in 0...controlsStrings.length)
|
||||
{
|
||||
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i], true, false);
|
||||
controlLabel.isMenuItem = true;
|
||||
controlLabel.targetY = i;
|
||||
grpControls.add(controlLabel);
|
||||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
||||
}
|
||||
|
||||
|
||||
versionShit = new FlxText(5, FlxG.height - 18, 0, "Offset (Left, Right): " + FlxG.save.data.offset, 12);
|
||||
versionShit.scrollFactor.set();
|
||||
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||
add(versionShit);
|
||||
|
||||
super.create();
|
||||
|
||||
openSubState(new OptionsSubState());
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
|
||||
/*
|
||||
if (controls.BACK)
|
||||
FlxG.switchState(new MainMenuState());
|
||||
if (controls.UP_P)
|
||||
changeSelection(-1);
|
||||
if (controls.DOWN_P)
|
||||
changeSelection(1);
|
||||
|
||||
if (controls.RIGHT_R)
|
||||
{
|
||||
FlxG.save.data.offset++;
|
||||
versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset;
|
||||
}
|
||||
|
||||
if (controls.LEFT_R)
|
||||
{
|
||||
FlxG.save.data.offset--;
|
||||
versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset;
|
||||
}
|
||||
|
||||
|
||||
if (controls.ACCEPT)
|
||||
{
|
||||
changeBinding();
|
||||
if (curSelected != 3)
|
||||
grpControls.remove(grpControls.members[curSelected]);
|
||||
switch(curSelected)
|
||||
{
|
||||
case 0:
|
||||
FlxG.save.data.dfjk = !FlxG.save.data.dfjk;
|
||||
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, (FlxG.save.data.dfjk ? 'DFJK' : 'WASD'), true, false);
|
||||
ctrl.isMenuItem = true;
|
||||
ctrl.targetY = curSelected;
|
||||
grpControls.add(ctrl);
|
||||
if (FlxG.save.data.dfjk)
|
||||
controls.setKeyboardScheme(KeyboardScheme.Solo, true);
|
||||
else
|
||||
controls.setKeyboardScheme(KeyboardScheme.Duo(true), true);
|
||||
|
||||
case 1:
|
||||
FlxG.save.data.newInput = !FlxG.save.data.newInput;
|
||||
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, (FlxG.save.data.newInput ? "New input" : "Old Input"), true, false);
|
||||
ctrl.isMenuItem = true;
|
||||
ctrl.targetY = curSelected - 1;
|
||||
grpControls.add(ctrl);
|
||||
case 2:
|
||||
FlxG.save.data.downscroll = !FlxG.save.data.downscroll;
|
||||
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, (FlxG.save.data.downscroll ? 'Downscroll' : 'Upscroll'), true, false);
|
||||
ctrl.isMenuItem = true;
|
||||
ctrl.targetY = curSelected - 2;
|
||||
grpControls.add(ctrl);
|
||||
case 3:
|
||||
trace('switch');
|
||||
FlxG.switchState(new LoadReplayState());
|
||||
}
|
||||
}
|
||||
|
||||
if (isSettingControl)
|
||||
waitingInput();
|
||||
else
|
||||
{
|
||||
if (controls.BACK)
|
||||
FlxG.switchState(new MainMenuState());
|
||||
if (controls.UP_P)
|
||||
changeSelection(-1);
|
||||
if (controls.DOWN_P)
|
||||
changeSelection(1);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
function waitingInput():Void
|
||||
{
|
||||
if (FlxG.keys.getIsDown().length > 0)
|
||||
{
|
||||
PlayerSettings.player1.controls.replaceBinding(Control.LEFT, Keys, FlxG.keys.getIsDown()[0].ID, null);
|
||||
}
|
||||
// PlayerSettings.player1.controls.replaceBinding(Control)
|
||||
}
|
||||
|
||||
var isSettingControl:Bool = false;
|
||||
|
||||
function changeBinding():Void
|
||||
{
|
||||
if (!isSettingControl)
|
||||
{
|
||||
isSettingControl = true;
|
||||
}
|
||||
}
|
||||
|
||||
function changeSelection(change:Int = 0)
|
||||
{
|
||||
#if !switch
|
||||
NGio.logEvent('Fresh');
|
||||
// NGio.logEvent('Fresh');
|
||||
#end
|
||||
|
||||
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
|
||||
|
||||
curSelected += change;
|
||||
|
Reference in New Issue
Block a user