Stage Editor Translatable
This commit is contained in:
@@ -73,7 +73,7 @@ class CharacterEditor extends UIState {
|
||||
|
||||
undos = new UndoList<CharacterEditorChange>();
|
||||
|
||||
WindowUtils.suffix = " (" + translate("name") + ")";
|
||||
WindowUtils.suffix = " (" + TU.translate("editor.character.name") + ")";
|
||||
SaveWarning.selectionClass = CharacterSelection;
|
||||
SaveWarning.saveFunc = () -> {_file_save(null);};
|
||||
|
||||
|
||||
@@ -20,8 +20,11 @@ class StageCreationScreen extends UISubstateWindow {
|
||||
if (onSave != null) this.onSave = onSave;
|
||||
}
|
||||
|
||||
inline function translate(id:String, ?args:Array<Dynamic>)
|
||||
return TU.translate("stageCreationScreen." + id, args);
|
||||
|
||||
public override function create() {
|
||||
winTitle = "Creating New Stage";
|
||||
winTitle = translate("win-title");
|
||||
|
||||
winWidth = 748 - 32 + 40;
|
||||
winHeight = 220;
|
||||
@@ -35,13 +38,13 @@ class StageCreationScreen extends UISubstateWindow {
|
||||
}
|
||||
|
||||
var stageInfo:UIText;
|
||||
add(stageInfo = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, "Stage Info", 28));
|
||||
add(stageInfo = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, translate("title"), 28));
|
||||
|
||||
add(stageNameTextBox = new UITextBox(stageInfo.x, stageInfo.y + stageInfo.height + 36, "Stage Name"));
|
||||
addLabelOn(stageNameTextBox, "Stage Name");
|
||||
add(stageNameTextBox = new UITextBox(stageInfo.x, stageInfo.y + stageInfo.height + 36, translate("stage-name")));
|
||||
addLabelOn(stageNameTextBox, translate("stage-name"));
|
||||
|
||||
add(stagePathTextBox = new UITextBox(stageNameTextBox.x + 320 + 26, stageNameTextBox.y, "Stage Path"));
|
||||
addLabelOn(stagePathTextBox, "Stage Path");
|
||||
add(stagePathTextBox = new UITextBox(stageNameTextBox.x + 320 + 26, stageNameTextBox.y, translate("stage-path")));
|
||||
addLabelOn(stagePathTextBox, translate("stage-path"));
|
||||
|
||||
add(saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, TU.translate("editor.saveClose"), function() {
|
||||
saveStageInfo();
|
||||
|
||||
@@ -71,6 +71,9 @@ class StageEditor extends UIState {
|
||||
return "stageEditor." + id;
|
||||
}
|
||||
|
||||
inline function translate(id:String, ?args:Array<Dynamic>)
|
||||
return TU.translate("stageEditor." + id, args);
|
||||
|
||||
public function new(stage:String) {
|
||||
super();
|
||||
if (stage != null) __stage = stage;
|
||||
@@ -79,47 +82,47 @@ class StageEditor extends UIState {
|
||||
public override function create() {
|
||||
super.create();
|
||||
|
||||
WindowUtils.suffix = " (Stage Editor)";
|
||||
WindowUtils.suffix = " (" + TU.translate("editor.stage.name") + ")";
|
||||
SaveWarning.selectionClass = StageSelection;
|
||||
SaveWarning.saveFunc = () -> {_file_save(null);};
|
||||
|
||||
topMenu = [
|
||||
{
|
||||
label: "File",
|
||||
label: translate("topBar.file"),
|
||||
childs: [
|
||||
{
|
||||
label: "Save",
|
||||
label: translate("file.save"),
|
||||
keybind: [CONTROL, S],
|
||||
onSelect: _file_save,
|
||||
},
|
||||
{
|
||||
label: "Save As...",
|
||||
label: translate("file.saveAs"),
|
||||
keybind: [CONTROL, SHIFT, S],
|
||||
onSelect: _file_saveas,
|
||||
},
|
||||
null,
|
||||
{
|
||||
label: "Exit",
|
||||
label: translate("file.exit"),
|
||||
onSelect: _file_exit
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Edit",
|
||||
label: translate("topBar.edit"),
|
||||
childs: [
|
||||
{
|
||||
label: "Undo",
|
||||
label: translate("edit.undo"),
|
||||
keybind: [CONTROL, Z],
|
||||
onSelect: _edit_undo,
|
||||
},
|
||||
{
|
||||
label: "Redo",
|
||||
label: translate("edit.redo"),
|
||||
keybind: [CONTROL, SHIFT, Z],
|
||||
onSelect: _edit_redo,
|
||||
},
|
||||
null,
|
||||
{
|
||||
label: "Edit Stage Info",
|
||||
label: translate("edit.editStageInfo"),
|
||||
onSelect: (_) -> {
|
||||
openSubState(new UISoftcodedWindow(
|
||||
"layouts/stage/stageInfoScreen",
|
||||
@@ -130,7 +133,10 @@ class StageEditor extends UIState {
|
||||
"stage" => stage,
|
||||
"Stage" => Stage,
|
||||
"exID" => exID,
|
||||
"CEditInfo" => StageChange.CEditInfo
|
||||
"CEditInfo" => StageChange.CEditInfo,
|
||||
"translate" => function (id:String, ?args:Array<Dynamic>) {
|
||||
return TU.translate("stageInfoScreen." + id, args);
|
||||
}
|
||||
]
|
||||
));
|
||||
},
|
||||
@@ -138,56 +144,56 @@ class StageEditor extends UIState {
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Select",
|
||||
label: translate("topBar.select"),
|
||||
childs: [
|
||||
{
|
||||
label: "All",
|
||||
label: translate("select.all"),
|
||||
keybind: [CONTROL, A],
|
||||
onSelect: (_) -> _select_all(_),
|
||||
},
|
||||
{
|
||||
label: "Deselect",
|
||||
label: translate("select.deselect"),
|
||||
keybind: [CONTROL, D],
|
||||
onSelect: (_) -> _select_deselect(_),
|
||||
},
|
||||
{
|
||||
label: "Inverse",
|
||||
label: translate("select.inverse"),
|
||||
keybind: [CONTROL, SHIFT, I],
|
||||
onSelect: (_) -> _select_inverse(_),
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "View",
|
||||
label: translate("topBar.view"),
|
||||
childs: [
|
||||
{
|
||||
label: "Zoom in",
|
||||
label: translate("view.zoomIn"),
|
||||
keybind: [CONTROL, NUMPADPLUS],
|
||||
onSelect: _view_zoomin
|
||||
},
|
||||
{
|
||||
label: "Zoom out",
|
||||
label: translate("view.zoomOut"),
|
||||
keybind: [CONTROL, NUMPADMINUS],
|
||||
onSelect: _view_zoomout
|
||||
},
|
||||
{
|
||||
label: "Reset zoom",
|
||||
label: translate("view.zoomReset"),
|
||||
keybind: [CONTROL, NUMPADZERO],
|
||||
onSelect: _view_zoomreset
|
||||
},
|
||||
null,
|
||||
{
|
||||
label: "Focus Dad",
|
||||
label: translate("view.focusDad"),
|
||||
//keybind: [CONTROL, NUMPADZERO],
|
||||
onSelect: _view_focusdad
|
||||
},
|
||||
{
|
||||
label: "Focus Gf",
|
||||
label: translate("view.focusGF"),
|
||||
//keybind: [CONTROL, NUMPADZERO],
|
||||
onSelect: _view_focusgf
|
||||
},
|
||||
{
|
||||
label: "Focus BF",
|
||||
label: translate("view.focusBF"),
|
||||
//keybind: [CONTROL, NUMPADZERO],
|
||||
onSelect: _view_focusbf
|
||||
},
|
||||
@@ -195,10 +201,10 @@ class StageEditor extends UIState {
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Editor",
|
||||
label: translate("topBar.editor"),
|
||||
childs: [
|
||||
{
|
||||
label: "Show Characters",
|
||||
label: translate("editor.showCharacters"),
|
||||
//keybind: [CONTROL, NUMPADMINUS],
|
||||
onSelect: _editor_showCharacters,
|
||||
icon: showCharacters ? 1 : 0
|
||||
@@ -808,7 +814,7 @@ class StageEditor extends UIState {
|
||||
var sprite:FunkinSprite = cast sprite;
|
||||
sprite.extra.set(exID("selected"), true);
|
||||
sprite.extra.get(exID("button")).selected = true;
|
||||
Logs.trace("Selected " + sprite.name);
|
||||
//Logs.trace("Selected " + sprite.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1350,6 +1356,9 @@ class StageXMLEditScreen extends UISoftcodedWindow {
|
||||
public var xml:Access;
|
||||
public var saveCallback:Void->Void;
|
||||
|
||||
inline function translate(id:String, ?args:Array<Dynamic>)
|
||||
return TU.translate("stageXMLEditScreen." + id, args);
|
||||
|
||||
public function new(xml:Access, saveCallback:Void->Void, type:String = "Unknown") {
|
||||
this.xml = xml;
|
||||
this.saveCallback = saveCallback;
|
||||
@@ -1357,7 +1366,8 @@ class StageXMLEditScreen extends UISoftcodedWindow {
|
||||
"stage" => StageEditor.instance.stage,
|
||||
"xml" => xml,
|
||||
"exID" => StageEditor.exID,
|
||||
"type" => type
|
||||
"type" => type,
|
||||
"translate" => translate
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,20 +21,20 @@ class StageSelection extends EditorTreeMenu
|
||||
var list:Array<OptionType> = [
|
||||
for (stage in (modsList.length == 0 ? Stage.getList(false, true) : modsList)) {
|
||||
stages.push(stage);
|
||||
new TextOption(stage, "Press ACCEPT to edit this stage.",
|
||||
new TextOption(stage, TU.translate("stageSelection.acceptStage"),
|
||||
function() {
|
||||
FlxG.switchState(new StageEditor(stage));
|
||||
});
|
||||
}
|
||||
];
|
||||
|
||||
list.insert(0, new NewOption("New Stage", "Press ACCEPT to create a new stage.", function() {
|
||||
list.insert(0, new NewOption(TU.translate("stageSelection.newStage"), TU.translate("stageSelection.acceptNewStage"), function() {
|
||||
FlxG.state.openSubState(new StageCreationScreen(saveStage));
|
||||
}));
|
||||
|
||||
main = new OptionsScreen("Stage Editor", "Select a stage to edit. HSCRIPT only stages are not supported.", list);
|
||||
main = new OptionsScreen(TU.translate("editor.stage.name"), TU.translate("stageSelection.desc"), list);
|
||||
|
||||
//DiscordUtil.call("onEditorTreeLoaded", ["Stage Editor"]);
|
||||
DiscordUtil.call("onEditorTreeLoaded", ["Stage Editor"]);
|
||||
}
|
||||
|
||||
public function saveStage(creation:StageCreationData) {
|
||||
@@ -51,7 +51,7 @@ class StageSelection extends EditorTreeMenu
|
||||
#end
|
||||
|
||||
// Add to List
|
||||
var option = new TextOption(creation.name, "Press ACCEPT to edit this stage.", function() {
|
||||
var option = new TextOption(creation.name, TU.translate("stageSelection.acceptStage"), function() {
|
||||
FlxG.switchState(new StageEditor(creation.name));
|
||||
});
|
||||
optionsTree.members[optionsTree.members.length-1].insert(1, option);
|
||||
|
||||
@@ -4,8 +4,12 @@ import funkin.editors.stage.elements.StageElementButton;
|
||||
import funkin.editors.stage.elements.*;
|
||||
|
||||
class StageSpritesWindow extends UIButtonList<StageElementButton> {
|
||||
|
||||
inline function translate(id:String, ?args:Array<Dynamic>)
|
||||
return TU.translate("stageSprites." + id, args);
|
||||
|
||||
public function new(x:Float, y:Float) {
|
||||
super(x, y, 400, FlxG.height-25, "Stage Sprites", FlxPoint.get(400, 64));
|
||||
super(x, y, 400, FlxG.height-25, translate("win-title"), FlxPoint.get(400, 64));
|
||||
|
||||
collapsable = true;
|
||||
topAlpha = 0.9;
|
||||
@@ -23,22 +27,22 @@ class StageSpritesWindow extends UIButtonList<StageElementButton> {
|
||||
var screenPos = addButton.getScreenPosition(null, lastDrawCam == null ? FlxG.camera : lastDrawCam);
|
||||
StageEditor.instance.openContextMenu([
|
||||
{
|
||||
label: "Sprite",
|
||||
label: translate("sprite"),
|
||||
onSelect: StageEditor.instance._sprite_new,
|
||||
color: 0xFF00FF00,
|
||||
icon: 2
|
||||
},
|
||||
{
|
||||
label: "Box",
|
||||
label: translate("box"),
|
||||
onSelect: function(_) {
|
||||
UIState.state.displayNotification(new UIBaseNotification("Creating a box isnt implemented yet!", 2, BOTTOM_LEFT));
|
||||
UIState.state.displayNotification(new UIBaseNotification(translate("warnings.not-implemented"), 2, BOTTOM_LEFT));
|
||||
CoolUtil.playMenuSFX(WARNING, 0.45);
|
||||
},
|
||||
color: 0xFF00FF00,
|
||||
icon: 2
|
||||
},
|
||||
{
|
||||
label: "Character",
|
||||
label: translate("character"),
|
||||
onSelect: StageEditor.instance._character_new,
|
||||
color: 0xFF00FF00,
|
||||
icon: 2
|
||||
|
||||
@@ -12,6 +12,9 @@ class StageCharacterButton extends StageElementButton {
|
||||
public var char:Character;
|
||||
public var charScale(get, null):Float;
|
||||
|
||||
inline function translate(id:String, ?args:Array<Dynamic>)
|
||||
return TU.translate("stageCharacters." + id, args);
|
||||
|
||||
public function new(x:Float,y:Float, char:Character, xml:Access) {
|
||||
this.char = char;
|
||||
super(x,y, xml);
|
||||
@@ -61,9 +64,9 @@ class StageCharacterButton extends StageElementButton {
|
||||
|
||||
public override function onDelete() {
|
||||
if (char.name.startsWith("NO_DELETE_")) {
|
||||
var text = "This character position is required in stages!";
|
||||
if (char.name == "NO_DELTE_girlfriend" && FlxG.random.bool(1))
|
||||
text = "You can't delete Girlfriend";
|
||||
var text = translate("requiredPosition");
|
||||
if (char.name == "NO_DELETE_girlfriend" && FlxG.random.bool(1))
|
||||
text = translate("noDeleteGirlfriend");
|
||||
UIState.state.displayNotification(new UIBaseNotification(text, 2, BOTTOM_LEFT));
|
||||
return;
|
||||
}
|
||||
@@ -100,6 +103,9 @@ class StageCharacterEditScreen extends UISoftcodedWindow {
|
||||
public var button:StageCharacterButton;
|
||||
public var char:Character;
|
||||
|
||||
inline function translate(id:String, ?args:Array<Dynamic>)
|
||||
return TU.translate("stageElementEditScreen." + id, args);
|
||||
|
||||
public function new(button:StageCharacterButton) {
|
||||
this.button = button;
|
||||
this.char = button.char;
|
||||
@@ -117,6 +123,7 @@ class StageCharacterEditScreen extends UISoftcodedWindow {
|
||||
"setEx" => function(name:String, value:Dynamic) {
|
||||
char.extra.set(StageEditor.exID(name), value);
|
||||
},
|
||||
"translate" => translate,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -209,8 +209,10 @@ class StageElementButton extends UIButton {
|
||||
var text = '${getName()} (${CoolUtil.quantize(pos.x, 100)}, ${CoolUtil.quantize(pos.y, 100)})';
|
||||
var sprite = getSprite();
|
||||
if(sprite != null) {
|
||||
text += '\nScale: (${CoolUtil.quantize(sprite.scale.x, 100)}, ${CoolUtil.quantize(sprite.scale.y, 100)})';
|
||||
text += '\nScroll: (${CoolUtil.quantize(sprite.scrollFactor.x, 100)}, ${CoolUtil.quantize(sprite.scrollFactor.y, 100)})';
|
||||
var scaleText = TU.getRaw("stageElement.scale");
|
||||
var scrollText = TU.getRaw("stageElement.scroll");
|
||||
text += '\n${scaleText.format([CoolUtil.quantize(sprite.scale.x, 100), CoolUtil.quantize(sprite.scale.y, 100)])}';
|
||||
text += '\n${scrollText.format([CoolUtil.quantize(sprite.scrollFactor.x, 100), CoolUtil.quantize(sprite.scrollFactor.y, 100)])}';
|
||||
}
|
||||
pos.put();
|
||||
return text;
|
||||
|
||||
@@ -76,6 +76,9 @@ class StageSpriteEditScreen extends UISoftcodedWindow {
|
||||
public var sprite:FunkinSprite;
|
||||
var isSaving:Bool = false;
|
||||
|
||||
inline function translate(id:String, ?args:Array<Dynamic>)
|
||||
return TU.translate("stageElementEditScreen." + id, args);
|
||||
|
||||
public function new(button:StageSpriteButton) {
|
||||
this.button = button;
|
||||
this.sprite = button.getSprite();
|
||||
@@ -91,6 +94,7 @@ class StageSpriteEditScreen extends UISoftcodedWindow {
|
||||
"setEx" => function(name:String, value:Dynamic) {
|
||||
sprite.extra.set(StageEditor.exID(name), value);
|
||||
},
|
||||
"translate" => translate,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class StageUnknownButton extends StageElementButton {
|
||||
}
|
||||
|
||||
public override function getInfoText():String {
|
||||
return 'Unknown\n<${getName()} />';
|
||||
return TU.translate("stageElement.unknown", [getName()]);
|
||||
}
|
||||
|
||||
public override function updatePos() {
|
||||
@@ -86,13 +86,17 @@ class StageUnknownButton extends StageElementButton {
|
||||
class StageUnknownEditScreen extends UISoftcodedWindow {
|
||||
public var button:StageUnknownButton;
|
||||
|
||||
inline function translate(id:String, ?args:Array<Dynamic>)
|
||||
return TU.translate("stageElementEditScreen." + id, args);
|
||||
|
||||
public function new(button:StageUnknownButton) {
|
||||
this.button = button;
|
||||
super("layouts/stage/unknownEditScreen", [
|
||||
"stage" => StageEditor.instance.stage,
|
||||
"button" => button,
|
||||
"xml" => button.xml,
|
||||
"exID" => StageEditor.exID
|
||||
"exID" => StageEditor.exID,
|
||||
"translate" => translate,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user