Translatable keybinds + fixed typos

This commit is contained in:
Ne_Eo
2024-10-04 19:49:20 +02:00
parent 75241a5b90
commit 1dc2604749
6 changed files with 124 additions and 94 deletions
+25 -3
View File
@@ -24,6 +24,28 @@
<!-- cant have debug here -->
</group>
<group name="KeybindOptions" prefix="KeybindsOptions.">
<str id="left">Left</str>
<str id="down">Down</str>
<str id="up">Up</str>
<str id="right">Right</str>
<str id="category.notes">Notes</str>
<str id="category.ui">UI</str>
<group name="ui" prefix="ui.">
<str id="accept">Accept</str>
<str id="back">Back</str>
<str id="reset">Reset</str>
<str id="pause">Pause</str>
</group>
<str id="category.engine">Engine</str>
<group name="engine" prefix="engine.">
<str id="switchMod">Switch Mod</str>
</group>
</group>
<group name="AppearanceOptions" prefix="AppearanceOptions.">
<str id="framerate-name">Framerate</str>
<str id="framerate-desc">Pretty self explanatory, isn't it?</str>
@@ -32,7 +54,7 @@
<str id="antialiasing-desc">If unchecked, will disable antialiasing on every sprite. Can boost performances at the cost of sharper, more pixely sprites.</str>
<str id="colorHealthBar-name">Colored Healthbar</str>
<str id="colorHealthBar-desc">If unchecked, the game will use the orginal red/green health bar from the week 6 fnf game.</str>
<str id="colorHealthBar-desc">If unchecked, the game will use the original red/green health bar from the week 6 fnf game.</str>
<str id="week6PixelPerfect-name">Pixel Perfect Effect</str>
<str id="week6PixelPerfect-desc">If checked, Week 6 will have a pixel perfect effect to it enabled, aligning every pixel on the screen.</str>
@@ -115,8 +137,8 @@
<str id="charterAutoSaveWarningTime-name">Save Warning Time</str>
<str id="charterAutoSaveWarningTime-desc">This controls how long the editor will warn you before it autosaves (in seconds..., 0 to disable)</str>
<str id="charterAutoSavesSeperateFolder-name">Autosaves Folder</str>
<str id="charterAutoSavesSeperateFolder-desc">If checked, this will autosave your file in a seperate folder with a time stamp instead of overriding your current file. (song/autosaves/)</str>
<str id="charterAutoSavesSeparateFolder-name">Autosaves Folder</str>
<str id="charterAutoSavesSeparateFolder-desc">If checked, this will autosave your file in a separate folder with a time stamp instead of overriding your current file. (song/autosaves/)</str>
</group>
</language>
+3 -3
View File
@@ -65,8 +65,8 @@ class DebugOptionsScreen extends OptionsScreen {
"charterAutoSaveWarningTime"
));
add(new Checkbox(
getName("charterAutoSavesSeperateFolder"),
getDesc("charterAutoSavesSeperateFolder"),
"charterAutoSavesSeperateFolder"));
getName("charterAutoSavesSeparateFolder"),
getDesc("charterAutoSavesSeparateFolder"),
"charterAutoSavesSeparateFolder"));
}
}
+3 -3
View File
@@ -695,9 +695,9 @@ class Charter extends UIState {
autoSaveTimer -= elapsed;
if (autoSaveTimer < Options.charterAutoSaveWarningTime && !autoSaveNotif.cancelled && !autoSaveNotif.showedAnimation) {
if (Options.charterAutoSavesSeperateFolder)
if (Options.charterAutoSavesSeparateFolder)
__autoSaveLocation = __diff.toLowerCase() + DateTools.format(Date.now(), "%m-%d_%H-%M");
var filename = !Options.charterAutoSavesSeperateFolder ? '${__diff.toLowerCase()}.json' : '${__autoSaveLocation}.json';
var filename = !Options.charterAutoSavesSeparateFolder ? '${__diff.toLowerCase()}.json' : '${__autoSaveLocation}.json';
autoSaveNotif.startAutoSave(autoSaveTimer,
TU.translate("charter.popup.savedChartAt", [filename])
);
@@ -708,7 +708,7 @@ class Charter extends UIState {
buildChart();
var songPath:String = '${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}';
if (Options.charterAutoSavesSeperateFolder)
if (Options.charterAutoSavesSeparateFolder)
Chart.save(songPath, PlayState.SONG, __autoSaveLocation, {saveMetaInChart: false, folder: "autosaves", prettyPrint: Options.editorPrettyPrint});
else
Chart.save(songPath, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: false, prettyPrint: Options.editorPrettyPrint});
+1 -1
View File
@@ -67,7 +67,7 @@ class Options
public static var charterAutoSaves:Bool = true;
public static var charterAutoSaveTime:Float = 60*5;
public static var charterAutoSaveWarningTime:Float = 5;
public static var charterAutoSavesSeperateFolder:Bool = false;
public static var charterAutoSavesSeparateFolder:Bool = false;
/**
* PLAYER 1 CONTROLS
@@ -94,7 +94,7 @@ class KeybindSetting extends FlxTypedSpriteGroup<FlxSprite> {
}
public function updateText() {
bind1.text = '${CoolUtil.keyToString(option1)}';
bind2.text = '${CoolUtil.keyToString(option2)}';
bind1.text = CoolUtil.keyToString(option1);
bind2.text = CoolUtil.keyToString(option2);
}
}
@@ -4,78 +4,22 @@ import flixel.util.FlxColor;
using StringTools;
typedef KeybindCategory = {
var name:String;
var settings:Array<{
var name:String;
var control:String;
var ?icon:Array<String>;
}>;
}
class KeybindsOptions extends MusicBeatSubstate {
public static var instance:KeybindsOptions;
public var categories = [
{
name: 'Notes',
settings: [
{
name: '{noteLeft}',
control: 'NOTE_LEFT'
},
{
name: '{noteDown}',
control: 'NOTE_DOWN'
},
{
name: '{noteUp}',
control: 'NOTE_UP'
},
{
name: '{noteRight}',
control: 'NOTE_RIGHT'
},
]
},
{
name: 'UI',
settings: [
{
name: 'Left',
control: 'LEFT'
},
{
name: 'Down',
control: 'DOWN'
},
{
name: 'Up',
control: 'UP'
},
{
name: 'Right',
control: 'RIGHT'
},
{
name: 'Accept',
control: 'ACCEPT'
},
{
name: 'Back',
control: 'BACK'
},
{
name: 'Reset',
control: 'RESET'
},
{
name: 'Pause',
control: 'PAUSE'
},
]
},
{
name: 'Engine',
settings: [
{
name: 'Switch Mod',
control: 'SWITCHMOD'
},
]
}
];
public var categories:Array<KeybindCategory> = [];
public function translate(id:String, ?args:Array<Dynamic>)
return TU.translate("Keybinds." + id, args);
public var settingCam:FlxCamera;
@@ -96,6 +40,80 @@ class KeybindsOptions extends MusicBeatSubstate {
var isSubState:Bool = false;
public override function create() {
categories = [
{
name: translate("category.notes"),
settings: [
{
icon: ["game/notes/default", "purple0"],
name: translate("left"),
control: 'NOTE_LEFT'
},
{
icon: ['game/notes/default', 'blue0'],
name: translate("down"),
control: 'NOTE_DOWN'
},
{
icon: ['game/notes/default', 'green0'],
name: translate("up"),
control: 'NOTE_UP'
},
{
icon: ['game/notes/default', 'red0'],
name: translate("right"),
control: 'NOTE_RIGHT'
},
]
},
{
name: translate("category.ui"),
settings: [
{
name: translate("left"),
control: 'LEFT'
},
{
name: translate("down"),
control: 'DOWN'
},
{
name: translate("up"),
control: 'UP'
},
{
name: translate("right"),
control: 'RIGHT'
},
{
name: translate("ui.accept"),
control: 'ACCEPT'
},
{
name: translate("ui.back"),
control: 'BACK'
},
{
name: translate("ui.reset"),
control: 'RESET'
},
{
name: translate("ui.pause"),
control: 'PAUSE'
},
]
},
{
name: translate("category.engine"),
settings: [
{
name: translate("engine.switchMod"),
control: 'SWITCHMOD'
},
]
}
];
super.create();
instance = this;
@@ -138,19 +156,9 @@ class KeybindsOptions extends MusicBeatSubstate {
for(e in category.settings) {
var sparrowIcon:String = null;
var sparrowAnim:String = null;
if (e.name.startsWith('{note')) {// is actually a note!!
sparrowIcon = "game/notes/default";
sparrowAnim = switch(e.name) {
case '{noteLeft}':
"purple0";
case '{noteDown}':
"blue0";
case '{noteUp}':
"green0";
default:
"red0";
};
e.name = e.name.substring(5, e.name.length - 1);
if(e.icon != null) {
sparrowIcon = e.icon[0];
sparrowAnim = e.icon[1];
}
var text = new KeybindSetting(100, k * 75, e.name, e.control, sparrowIcon, sparrowAnim);