keybindings and other shit
This commit is contained in:
parent
af3e47be07
commit
4226f95baf
@ -11,7 +11,7 @@ import flixel.input.gamepad.FlxGamepadButton;
|
|||||||
import flixel.input.gamepad.FlxGamepadInputID;
|
import flixel.input.gamepad.FlxGamepadInputID;
|
||||||
import flixel.input.keyboard.FlxKey;
|
import flixel.input.keyboard.FlxKey;
|
||||||
|
|
||||||
#if (haxe >= "4.1.0")
|
#if (haxe >= "4.0.0")
|
||||||
enum abstract Action(String) to String from String
|
enum abstract Action(String) to String from String
|
||||||
{
|
{
|
||||||
var UP = "up";
|
var UP = "up";
|
||||||
@ -489,7 +489,9 @@ class Controls extends FlxActionSet
|
|||||||
|
|
||||||
public function setKeyboardScheme(scheme:KeyboardScheme, reset = true)
|
public function setKeyboardScheme(scheme:KeyboardScheme, reset = true)
|
||||||
{
|
{
|
||||||
if (reset)
|
|
||||||
|
loadKeyBinds();
|
||||||
|
/*if (reset)
|
||||||
removeKeyboard();
|
removeKeyboard();
|
||||||
|
|
||||||
keyboardScheme = scheme;
|
keyboardScheme = scheme;
|
||||||
@ -498,21 +500,22 @@ class Controls extends FlxActionSet
|
|||||||
switch (scheme)
|
switch (scheme)
|
||||||
{
|
{
|
||||||
case Solo:
|
case Solo:
|
||||||
inline bindKeys(Control.UP, [J, FlxKey.UP]);
|
inline bindKeys(Control.UP, [FlxKey.fromString("W"), FlxKey.UP]);
|
||||||
inline bindKeys(Control.DOWN, [F, FlxKey.DOWN]);
|
inline bindKeys(Control.DOWN, [FlxKey.fromString("S"), FlxKey.DOWN]);
|
||||||
inline bindKeys(Control.LEFT, [D, FlxKey.LEFT]);
|
inline bindKeys(Control.LEFT, [FlxKey.fromString("A"), FlxKey.LEFT]);
|
||||||
inline bindKeys(Control.RIGHT, [K, FlxKey.RIGHT]);
|
inline bindKeys(Control.RIGHT, [FlxKey.fromString("D"), FlxKey.RIGHT]);
|
||||||
inline bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
|
inline bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
|
||||||
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
||||||
inline bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
|
inline bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
|
||||||
inline bindKeys(Control.RESET, [R]);
|
inline bindKeys(Control.RESET, [FlxKey.fromString("R")]);
|
||||||
case Duo(true):
|
case Duo(true):
|
||||||
inline bindKeys(Control.UP, [W, FlxKey.UP]);
|
inline bindKeys(Control.UP, [W, K]);
|
||||||
inline bindKeys(Control.DOWN, [S, FlxKey.DOWN]);
|
inline bindKeys(Control.DOWN, [S, J]);
|
||||||
inline bindKeys(Control.LEFT, [A, FlxKey.LEFT]);
|
inline bindKeys(Control.LEFT, [A, H]);
|
||||||
inline bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]);
|
inline bindKeys(Control.RIGHT, [D, L]);
|
||||||
inline bindKeys(Control.ACCEPT, [G, Z, SPACE, ENTER]);
|
inline bindKeys(Control.ACCEPT, [Z]);
|
||||||
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
inline bindKeys(Control.BACK, [X]);
|
||||||
|
inline bindKeys(Control.PAUSE, [ONE]);
|
||||||
inline bindKeys(Control.RESET, [R]);
|
inline bindKeys(Control.RESET, [R]);
|
||||||
case Duo(false):
|
case Duo(false):
|
||||||
inline bindKeys(Control.UP, [FlxKey.UP]);
|
inline bindKeys(Control.UP, [FlxKey.UP]);
|
||||||
@ -530,21 +533,21 @@ class Controls extends FlxActionSet
|
|||||||
switch (scheme)
|
switch (scheme)
|
||||||
{
|
{
|
||||||
case Solo:
|
case Solo:
|
||||||
bindKeys(Control.UP, [W, FlxKey.UP]);
|
bindKeys(Control.UP, [W, K, FlxKey.UP]);
|
||||||
bindKeys(Control.DOWN, [S, FlxKey.DOWN]);
|
bindKeys(Control.DOWN, [S, J, FlxKey.DOWN]);
|
||||||
bindKeys(Control.LEFT, [A, FlxKey.LEFT]);
|
bindKeys(Control.LEFT, [A, H, FlxKey.LEFT]);
|
||||||
bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]);
|
bindKeys(Control.RIGHT, [D, L, FlxKey.RIGHT]);
|
||||||
bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
|
bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
|
||||||
bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
||||||
bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
|
bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
|
||||||
bindKeys(Control.RESET, [R]);
|
bindKeys(Control.RESET, [R]);
|
||||||
case Duo(true):
|
case Duo(true):
|
||||||
bindKeys(Control.UP, [W]);
|
bindKeys(Control.UP, [W, K]);
|
||||||
bindKeys(Control.DOWN, [S]);
|
bindKeys(Control.DOWN, [S, J]);
|
||||||
bindKeys(Control.LEFT, [A]);
|
bindKeys(Control.LEFT, [A, H]);
|
||||||
bindKeys(Control.RIGHT, [D]);
|
bindKeys(Control.RIGHT, [D, L]);
|
||||||
bindKeys(Control.ACCEPT, [G, Z]);
|
bindKeys(Control.ACCEPT, [Z]);
|
||||||
bindKeys(Control.BACK, [H, X]);
|
bindKeys(Control.BACK, [X]);
|
||||||
bindKeys(Control.PAUSE, [ONE]);
|
bindKeys(Control.PAUSE, [ONE]);
|
||||||
bindKeys(Control.RESET, [R]);
|
bindKeys(Control.RESET, [R]);
|
||||||
case Duo(false):
|
case Duo(false):
|
||||||
@ -559,7 +562,24 @@ class Controls extends FlxActionSet
|
|||||||
case None: // nothing
|
case None: // nothing
|
||||||
case Custom: // nothing
|
case Custom: // nothing
|
||||||
}
|
}
|
||||||
#end
|
#end*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadKeyBinds()
|
||||||
|
{
|
||||||
|
|
||||||
|
//trace(FlxKey.fromString(FlxG.save.data.upBind));
|
||||||
|
|
||||||
|
removeKeyboard();
|
||||||
|
|
||||||
|
inline bindKeys(Control.UP, [FlxKey.fromString(FlxG.save.data.upBind), FlxKey.UP]);
|
||||||
|
inline bindKeys(Control.DOWN, [FlxKey.fromString(FlxG.save.data.downBind), FlxKey.DOWN]);
|
||||||
|
inline bindKeys(Control.LEFT, [FlxKey.fromString(FlxG.save.data.leftBind), FlxKey.LEFT]);
|
||||||
|
inline bindKeys(Control.RIGHT, [FlxKey.fromString(FlxG.save.data.rightBind), FlxKey.RIGHT]);
|
||||||
|
inline bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
|
||||||
|
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
||||||
|
inline bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
|
||||||
|
inline bindKeys(Control.RESET, [FlxKey.fromString(FlxG.save.data.killBind)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeKeyboard()
|
function removeKeyboard()
|
||||||
|
@ -76,6 +76,8 @@ class KadeEngineData
|
|||||||
FlxG.save.data.cpuStrums = false;
|
FlxG.save.data.cpuStrums = false;
|
||||||
|
|
||||||
Conductor.recalculateTimings();
|
Conductor.recalculateTimings();
|
||||||
|
PlayerSettings.player1.controls.loadKeyBinds();
|
||||||
|
KeyBinds.keyCheck();
|
||||||
|
|
||||||
Main.watermarks = FlxG.save.data.watermark;
|
Main.watermarks = FlxG.save.data.watermark;
|
||||||
|
|
||||||
|
271
source/KeyBindMenu.hx
Normal file
271
source/KeyBindMenu.hx
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
package;
|
||||||
|
|
||||||
|
/// Code created by Rozebud for FPS Plus (thanks rozebud)
|
||||||
|
// modified by KadeDev for use in Kade Engine/Tricky
|
||||||
|
|
||||||
|
import flixel.FlxSubState;
|
||||||
|
import Options.Option;
|
||||||
|
import flixel.input.FlxInput;
|
||||||
|
import flixel.input.keyboard.FlxKey;
|
||||||
|
import flixel.FlxG;
|
||||||
|
import flixel.FlxObject;
|
||||||
|
import flixel.FlxSprite;
|
||||||
|
import flixel.effects.FlxFlicker;
|
||||||
|
import flixel.graphics.frames.FlxAtlasFrames;
|
||||||
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||||
|
import flixel.text.FlxText;
|
||||||
|
import flixel.tweens.FlxEase;
|
||||||
|
import flixel.tweens.FlxTween;
|
||||||
|
import flixel.util.FlxColor;
|
||||||
|
import io.newgrounds.NG;
|
||||||
|
import lime.app.Application;
|
||||||
|
import lime.utils.Assets;
|
||||||
|
import flixel.math.FlxMath;
|
||||||
|
import flixel.text.FlxText;
|
||||||
|
import flixel.input.FlxKeyManager;
|
||||||
|
|
||||||
|
|
||||||
|
using StringTools;
|
||||||
|
|
||||||
|
class KeyBindMenu extends FlxSubState
|
||||||
|
{
|
||||||
|
|
||||||
|
var keyTextDisplay:FlxText;
|
||||||
|
var keyWarning:FlxText;
|
||||||
|
var warningTween:FlxTween;
|
||||||
|
var keyText:Array<String> = ["LEFT", "DOWN", "UP", "RIGHT"];
|
||||||
|
var defaultKeys:Array<String> = ["A", "S", "W", "D", "R"];
|
||||||
|
var curSelected:Int = 0;
|
||||||
|
|
||||||
|
var keys:Array<String> = [FlxG.save.data.leftBind,
|
||||||
|
FlxG.save.data.downBind,
|
||||||
|
FlxG.save.data.upBind,
|
||||||
|
FlxG.save.data.rightBind];
|
||||||
|
|
||||||
|
var tempKey:String = "";
|
||||||
|
var blacklist:Array<String> = ["ESCAPE", "ENTER", "BACKSPACE", "SPACE"];
|
||||||
|
|
||||||
|
var blackBox:FlxSprite;
|
||||||
|
var infoText:FlxText;
|
||||||
|
|
||||||
|
var state:String = "select";
|
||||||
|
|
||||||
|
override function create()
|
||||||
|
{
|
||||||
|
|
||||||
|
for (i in 0...keys.length)
|
||||||
|
{
|
||||||
|
var k = keys[i];
|
||||||
|
if (k == null)
|
||||||
|
keys[i] = defaultKeys[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
//FlxG.sound.playMusic('assets/music/configurator' + TitleState.soundExt);
|
||||||
|
|
||||||
|
persistentUpdate = persistentDraw = true;
|
||||||
|
|
||||||
|
keyTextDisplay = new FlxText(-10, 0, 1280, "", 72);
|
||||||
|
keyTextDisplay.scrollFactor.set(0, 0);
|
||||||
|
keyTextDisplay.setFormat("VCR OSD Mono", 42, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||||
|
keyTextDisplay.borderSize = 2;
|
||||||
|
keyTextDisplay.borderQuality = 3;
|
||||||
|
|
||||||
|
blackBox = new FlxSprite(0,0).makeGraphic(FlxG.width,FlxG.height,FlxColor.BLACK);
|
||||||
|
add(blackBox);
|
||||||
|
|
||||||
|
infoText = new FlxText(-10, 580, 1280, "(Escape to save, backspace to leave without saving)", 72);
|
||||||
|
infoText.scrollFactor.set(0, 0);
|
||||||
|
infoText.setFormat("VCR OSD Mono", 24, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||||
|
infoText.borderSize = 2;
|
||||||
|
infoText.borderQuality = 3;
|
||||||
|
infoText.alpha = 0;
|
||||||
|
add(infoText);
|
||||||
|
add(keyTextDisplay);
|
||||||
|
|
||||||
|
blackBox.alpha = 0;
|
||||||
|
keyTextDisplay.alpha = 0;
|
||||||
|
|
||||||
|
FlxTween.tween(keyTextDisplay, {alpha: 1}, 1, {ease: FlxEase.expoInOut});
|
||||||
|
FlxTween.tween(infoText, {alpha: 1}, 1.4, {ease: FlxEase.expoInOut});
|
||||||
|
FlxTween.tween(blackBox, {alpha: 0.7}, 1, {ease: FlxEase.expoInOut});
|
||||||
|
|
||||||
|
OptionsMenu.instance.acceptInput = false;
|
||||||
|
|
||||||
|
textUpdate();
|
||||||
|
|
||||||
|
super.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
override function update(elapsed:Float)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch(state){
|
||||||
|
|
||||||
|
case "select":
|
||||||
|
if (FlxG.keys.justPressed.UP)
|
||||||
|
{
|
||||||
|
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||||
|
changeItem(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FlxG.keys.justPressed.DOWN)
|
||||||
|
{
|
||||||
|
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||||
|
changeItem(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FlxG.keys.justPressed.ENTER){
|
||||||
|
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||||
|
state = "input";
|
||||||
|
}
|
||||||
|
else if(FlxG.keys.justPressed.ESCAPE){
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
else if (FlxG.keys.justPressed.BACKSPACE){
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
case "input":
|
||||||
|
tempKey = keys[curSelected];
|
||||||
|
keys[curSelected] = "?";
|
||||||
|
textUpdate();
|
||||||
|
state = "waiting";
|
||||||
|
|
||||||
|
case "waiting":
|
||||||
|
if(FlxG.keys.justPressed.ESCAPE){
|
||||||
|
keys[curSelected] = tempKey;
|
||||||
|
state = "select";
|
||||||
|
FlxG.sound.play(Paths.sound('confirmMenu'));
|
||||||
|
}
|
||||||
|
else if(FlxG.keys.justPressed.ENTER){
|
||||||
|
addKey(defaultKeys[curSelected]);
|
||||||
|
save();
|
||||||
|
state = "select";
|
||||||
|
}
|
||||||
|
else if(FlxG.keys.justPressed.ANY){
|
||||||
|
addKey(FlxG.keys.getIsDown()[0].ID.toString());
|
||||||
|
save();
|
||||||
|
state = "select";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case "exiting":
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
state = "select";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(FlxG.keys.justPressed.ANY)
|
||||||
|
textUpdate();
|
||||||
|
|
||||||
|
super.update(elapsed);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function textUpdate(){
|
||||||
|
|
||||||
|
keyTextDisplay.text = "\n\n";
|
||||||
|
|
||||||
|
for(i in 0...4){
|
||||||
|
|
||||||
|
var textStart = (i == curSelected) ? "> " : " ";
|
||||||
|
keyTextDisplay.text += textStart + keyText[i] + ": " + ((keys[i] != keyText[i]) ? (keys[i] + " / ") : "" ) + keyText[i] + " ARROW\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
keyTextDisplay.screenCenter();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function save(){
|
||||||
|
|
||||||
|
FlxG.save.data.upBind = keys[2];
|
||||||
|
FlxG.save.data.downBind = keys[1];
|
||||||
|
FlxG.save.data.leftBind = keys[0];
|
||||||
|
FlxG.save.data.rightBind = keys[3];
|
||||||
|
|
||||||
|
FlxG.save.flush();
|
||||||
|
|
||||||
|
PlayerSettings.player1.controls.loadKeyBinds();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset(){
|
||||||
|
|
||||||
|
for(i in 0...5){
|
||||||
|
keys[i] = defaultKeys[i];
|
||||||
|
}
|
||||||
|
quit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function quit(){
|
||||||
|
|
||||||
|
state = "exiting";
|
||||||
|
|
||||||
|
save();
|
||||||
|
|
||||||
|
OptionsMenu.instance.acceptInput = true;
|
||||||
|
|
||||||
|
FlxTween.tween(keyTextDisplay, {alpha: 0}, 1, {ease: FlxEase.expoInOut});
|
||||||
|
FlxTween.tween(blackBox, {alpha: 0}, 1.1, {ease: FlxEase.expoInOut, onComplete: function(flx:FlxTween){close();}});
|
||||||
|
FlxTween.tween(infoText, {alpha: 0}, 1, {ease: FlxEase.expoInOut});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function addKey(r:String){
|
||||||
|
|
||||||
|
var shouldReturn:Bool = true;
|
||||||
|
|
||||||
|
var notAllowed:Array<String> = [];
|
||||||
|
|
||||||
|
for(x in keys){
|
||||||
|
if(x != tempKey){notAllowed.push(x);}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(x in blacklist){notAllowed.push(x);}
|
||||||
|
|
||||||
|
if(curSelected != 4){
|
||||||
|
|
||||||
|
for(x in keyText){
|
||||||
|
if(x != keyText[curSelected]){notAllowed.push(x);}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {for(x in keyText){notAllowed.push(x);}}
|
||||||
|
|
||||||
|
trace(notAllowed);
|
||||||
|
|
||||||
|
for(x in 0...keys.length)
|
||||||
|
{
|
||||||
|
var oK = keys[x];
|
||||||
|
if(oK == r)
|
||||||
|
keys[x] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(shouldReturn){
|
||||||
|
keys[curSelected] = r;
|
||||||
|
FlxG.sound.play(Paths.sound('Hover','clown'));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
keys[curSelected] = tempKey;
|
||||||
|
FlxG.sound.play(Paths.sound('confirm','clown'));
|
||||||
|
keyWarning.alpha = 1;
|
||||||
|
warningTween.cancel();
|
||||||
|
warningTween = FlxTween.tween(keyWarning, {alpha: 0}, 0.5, {ease: FlxEase.circOut, startDelay: 2});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeItem(_amount:Int = 0)
|
||||||
|
{
|
||||||
|
curSelected += _amount;
|
||||||
|
|
||||||
|
if (curSelected > 3)
|
||||||
|
curSelected = 0;
|
||||||
|
if (curSelected < 0)
|
||||||
|
curSelected = 3;
|
||||||
|
}
|
||||||
|
}
|
50
source/KeyBinds.hx
Normal file
50
source/KeyBinds.hx
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import flixel.FlxG;
|
||||||
|
import flixel.input.FlxInput;
|
||||||
|
import flixel.input.actions.FlxAction;
|
||||||
|
import flixel.input.actions.FlxActionInput;
|
||||||
|
import flixel.input.actions.FlxActionInputDigital;
|
||||||
|
import flixel.input.actions.FlxActionManager;
|
||||||
|
import flixel.input.actions.FlxActionSet;
|
||||||
|
import flixel.input.gamepad.FlxGamepadButton;
|
||||||
|
import flixel.input.gamepad.FlxGamepadInputID;
|
||||||
|
import flixel.input.keyboard.FlxKey;
|
||||||
|
|
||||||
|
class KeyBinds
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function resetBinds():Void{
|
||||||
|
|
||||||
|
FlxG.save.data.upBind = "W";
|
||||||
|
FlxG.save.data.downBind = "S";
|
||||||
|
FlxG.save.data.leftBind = "A";
|
||||||
|
FlxG.save.data.rightBind = "D";
|
||||||
|
FlxG.save.data.killBind = "R";
|
||||||
|
PlayerSettings.player1.controls.loadKeyBinds();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function keyCheck():Void
|
||||||
|
{
|
||||||
|
if(FlxG.save.data.upBind == null){
|
||||||
|
FlxG.save.data.upBind = "W";
|
||||||
|
trace("No UP");
|
||||||
|
}
|
||||||
|
if(FlxG.save.data.downBind == null){
|
||||||
|
FlxG.save.data.downBind = "S";
|
||||||
|
trace("No DOWN");
|
||||||
|
}
|
||||||
|
if(FlxG.save.data.leftBind == null){
|
||||||
|
FlxG.save.data.leftBind = "A";
|
||||||
|
trace("No LEFT");
|
||||||
|
}
|
||||||
|
if(FlxG.save.data.rightBind == null){
|
||||||
|
FlxG.save.data.rightBind = "D";
|
||||||
|
trace("No RIGHT");
|
||||||
|
}
|
||||||
|
if(FlxG.save.data.killBind == null){
|
||||||
|
FlxG.save.data.killBind = "R";
|
||||||
|
trace("No KILL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -86,20 +86,13 @@ class DFJKOption extends Option
|
|||||||
|
|
||||||
public override function press():Bool
|
public override function press():Bool
|
||||||
{
|
{
|
||||||
FlxG.save.data.dfjk = !FlxG.save.data.dfjk;
|
OptionsMenu.instance.openSubState(new KeyBindMenu());
|
||||||
|
return false;
|
||||||
if (FlxG.save.data.dfjk)
|
|
||||||
controls.setKeyboardScheme(KeyboardScheme.Solo, true);
|
|
||||||
else
|
|
||||||
controls.setKeyboardScheme(KeyboardScheme.Duo(true), true);
|
|
||||||
|
|
||||||
display = updateDisplay();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private override function updateDisplay():String
|
private override function updateDisplay():String
|
||||||
{
|
{
|
||||||
return FlxG.save.data.dfjk ? "DFJK" : "WASD";
|
return "Key Bindings";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ import lime.utils.Assets;
|
|||||||
|
|
||||||
class OptionsMenu extends MusicBeatState
|
class OptionsMenu extends MusicBeatState
|
||||||
{
|
{
|
||||||
|
public static var instance:OptionsMenu;
|
||||||
|
|
||||||
var selector:FlxText;
|
var selector:FlxText;
|
||||||
var curSelected:Int = 0;
|
var curSelected:Int = 0;
|
||||||
|
|
||||||
@ -61,6 +63,8 @@ class OptionsMenu extends MusicBeatState
|
|||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public var acceptInput:Bool = true;
|
||||||
|
|
||||||
private var currentDescription:String = "";
|
private var currentDescription:String = "";
|
||||||
private var grpControls:FlxTypedGroup<Alphabet>;
|
private var grpControls:FlxTypedGroup<Alphabet>;
|
||||||
public static var versionShit:FlxText;
|
public static var versionShit:FlxText;
|
||||||
@ -69,6 +73,7 @@ class OptionsMenu extends MusicBeatState
|
|||||||
var blackBorder:FlxSprite;
|
var blackBorder:FlxSprite;
|
||||||
override function create()
|
override function create()
|
||||||
{
|
{
|
||||||
|
instance = this;
|
||||||
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image("menuDesat"));
|
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image("menuDesat"));
|
||||||
|
|
||||||
menuBG.color = 0xFFea71fd;
|
menuBG.color = 0xFFea71fd;
|
||||||
@ -116,6 +121,8 @@ class OptionsMenu extends MusicBeatState
|
|||||||
{
|
{
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
|
||||||
|
if (acceptInput)
|
||||||
|
{
|
||||||
if (controls.BACK && !isCat)
|
if (controls.BACK && !isCat)
|
||||||
FlxG.switchState(new MainMenuState());
|
FlxG.switchState(new MainMenuState());
|
||||||
else if (controls.BACK)
|
else if (controls.BACK)
|
||||||
@ -225,6 +232,7 @@ class OptionsMenu extends MusicBeatState
|
|||||||
curSelected = 0;
|
curSelected = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
FlxG.save.flush();
|
FlxG.save.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,77 +44,6 @@ class PlayerSettings
|
|||||||
controls.setKeyboardScheme(scheme);
|
controls.setKeyboardScheme(scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
static public function addAvatar(avatar:Player):PlayerSettings
|
|
||||||
{
|
|
||||||
var settings:PlayerSettings;
|
|
||||||
|
|
||||||
if (player1 == null)
|
|
||||||
{
|
|
||||||
player1 = new PlayerSettings(0, Solo);
|
|
||||||
++numPlayers;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player1.avatar == null)
|
|
||||||
settings = player1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (player2 == null)
|
|
||||||
{
|
|
||||||
if (player1.controls.keyboardScheme.match(Duo(true)))
|
|
||||||
player2 = new PlayerSettings(1, Duo(false));
|
|
||||||
else
|
|
||||||
player2 = new PlayerSettings(1, None);
|
|
||||||
++numPlayers;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player2.avatar == null)
|
|
||||||
settings = player2;
|
|
||||||
else
|
|
||||||
throw throw 'Invalid number of players: ${numPlayers + 1}';
|
|
||||||
}
|
|
||||||
++numAvatars;
|
|
||||||
settings.avatar = avatar;
|
|
||||||
avatar.settings = settings;
|
|
||||||
|
|
||||||
splitCameras();
|
|
||||||
|
|
||||||
onAvatarAdd.dispatch(settings);
|
|
||||||
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
static public function removeAvatar(avatar:Player):Void
|
|
||||||
{
|
|
||||||
var settings:PlayerSettings;
|
|
||||||
|
|
||||||
if (player1 != null && player1.avatar == avatar)
|
|
||||||
settings = player1;
|
|
||||||
else if (player2 != null && player2.avatar == avatar)
|
|
||||||
{
|
|
||||||
settings = player2;
|
|
||||||
if (player1.controls.keyboardScheme.match(Duo(_)))
|
|
||||||
player1.setKeyboardScheme(Solo);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw "Cannot remove avatar that is not for a player";
|
|
||||||
|
|
||||||
settings.avatar = null;
|
|
||||||
while (settings.controls.gamepadsAdded.length > 0)
|
|
||||||
{
|
|
||||||
final id = settings.controls.gamepadsAdded.shift();
|
|
||||||
settings.controls.removeGamepad(id);
|
|
||||||
DeviceManager.releaseGamepad(FlxG.gamepads.getByID(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
--numAvatars;
|
|
||||||
|
|
||||||
splitCameras();
|
|
||||||
|
|
||||||
onAvatarRemove.dispatch(avatar.settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
static public function init():Void
|
static public function init():Void
|
||||||
{
|
{
|
||||||
if (player1 == null)
|
if (player1 == null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user