mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 11:22:55 +00:00
allow controls to get dialouge name from control + ignore brackets
This commit is contained in:
parent
bfb19cc67e
commit
5f60be6d75
|
@ -395,9 +395,11 @@ class Controls extends FlxActionSet
|
|||
return result;
|
||||
}
|
||||
|
||||
public function getDialogueName(action:FlxActionDigital):String
|
||||
public function getDialogueName(action:FlxActionDigital, ?ignoreSurrounding:Bool = false):String
|
||||
{
|
||||
var input = action.inputs[0];
|
||||
if (ignoreSurrounding == false)
|
||||
{
|
||||
return switch (input.device)
|
||||
{
|
||||
case KEYBOARD: return '[${(input.inputID : FlxKey)}]';
|
||||
|
@ -405,10 +407,25 @@ class Controls extends FlxActionSet
|
|||
case device: throw 'unhandled device: $device';
|
||||
}
|
||||
}
|
||||
|
||||
public function getDialogueNameFromToken(token:String):String
|
||||
else
|
||||
{
|
||||
return getDialogueName(getActionFromControl(Control.createByName(token.toUpperCase())));
|
||||
return switch (input.device)
|
||||
{
|
||||
case KEYBOARD: return '${(input.inputID : FlxKey)}';
|
||||
case GAMEPAD: return '${(input.inputID : FlxGamepadInputID)}';
|
||||
case device: throw 'unhandled device: $device';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getDialogueNameFromToken(token:String, ?ignoreSurrounding:Bool = false):String
|
||||
{
|
||||
return getDialogueName(getActionFromControl(Control.createByName(token.toUpperCase())), ignoreSurrounding);
|
||||
}
|
||||
|
||||
public function getDialogueNameFromControl(control:Control, ?ignoreSurrounding:Bool = false):String
|
||||
{
|
||||
return getDialogueName(getActionFromControl(control), ignoreSurrounding);
|
||||
}
|
||||
|
||||
function getActionFromControl(control:Control):FlxActionDigital
|
||||
|
|
Loading…
Reference in a new issue