Translatable Character Editor

This commit is contained in:
Ne_Eo
2024-08-17 02:32:29 +02:00
parent c1a743265e
commit 809deed4f3
9 changed files with 248 additions and 96 deletions
+133 -5
View File
@@ -12,8 +12,8 @@
<group name="CharterSelection" prefix="charterSelection.">
<str id="desc">Select a song to modify the charts from."</str>
<str id="accept-song">Press ACCEPT to choose a difficulty to edit.</str>
<str id="accept-difficulty">Press ACCEPT to edit the chart for the selected difficulty.</str>
<str id="acceptSong">Press ACCEPT to choose a difficulty to edit.</str>
<str id="acceptDifficulty">Press ACCEPT to edit the chart for the selected difficulty.</str>
<str id="selectDifficulty">Select a difficulty to continue.</str>
<str id="newDifficulty">New Difficulty</str>
<str id="newSong">New Song</str>
@@ -246,13 +246,141 @@
</group>
</group>
<group name="CharacterEditor">
<str id="charEditor.name">Character Editor</str>
<!-- Character Editor -->
<group name="CharacterSelection" prefix="characterSelection.">
<str id="acceptCharacter">Press ACCEPT to edit this character.</str>
<str id="newCharacter">New Character</str>
<str id="desc">Select a character to edit</str>
<group name="Warnings" prefix="warnings.">
<str id="notImplemented-title">New Character: Feature Not Implemented!</str>
<str id="notImplemented-body">This feature isn't implemented yet. Please wait for more cne updates to have this functional.\n\n\n- Codename Devs</str>
</group>
</group>
<group name="CharacterAnimScreen" prefix="characterAnimScreen.">
<str id="win-title-creating">Creating Animation</str>
<str id="win-title-editing">Animation {0} properties</str>
<str id="title-creating">Create New Animation</str>
<str id="title-editing">Edit Animation Properties</str>
<str id="name">Name</str>
<str id="anim">Animation</str>
<str id="fps">FPS</str>
<str id="looped">Looped</str>
<str id="looping">Looping</str>
<str id="indices">Indices</str>
<str id="offset">Offset (X,Y)</str>
</group>
<group name="CharacterInfoScreen" prefix="characterInfoScreen.">
<str id="win-title">Editing Character</str>
<str id="spriteData">Sprite Data</str>
<str id="sprite">Sprite</str>
<str id="icon">Icon</str>
<str id="gameOverChar">Game Over Character</str>
<str id="antialiasing">Antialiasing</str>
<str id="antialiased">Antialiased</str>
<str id="flipX">Flip X</str>
<str id="flipped">Flipped</str>
<str id="iconColor">Icon Color</str>
<str id="characterData">Character Data</str>
<str id="position">Position (X,Y)</str>
<str id="cameraPosition">Camera Position (X,Y)</str>
<str id="scale">Scale</str>
<str id="singDuration">Sing Duration (Steps)</str>
<str id="customValues">Custom Values (Advanced)</str>
<str id="isPlayer">Is Player</str>
<str id="isGF">Is GF</str>
</group>
<group name="CharacterEditor" prefix="characterEditor.">
<str id="name">Character Editor</str>
<group name="TopBar">
<str id="topBar.file">File</str>
<group name="FileMenu" prefix="file.">
<str id="new">New</str>
<str id="save">Save</str>
<str id="saveAs">Save As...</str>
<str id="exit">Exit</str>
</group>
<str id="topBar.edit">Edit</str>
<group name="EditMenu" prefix="edit.">
<str id="undo">Undo</str>
<str id="redo">Redo</str>
</group>
<str id="topBar.character">Character</str>
<group name="CharacterMenu" prefix="character.">
<str id="newAnim">New Animation</str>
<str id="editAnim">Edit Animation</str>
<str id="deleteAnim">Delete Animation</str>
<str id="editInfo">Edit Info</str>
</group>
<str id="topBar.playback">Playback</str>
<group name="PlaybackMenu" prefix="playback.">
<str id="play">Play Animation</str>
<str id="stop">Stop Animation</str>
</group>
<str id="topBar.offset">Offsets</str>
<group name="OffsetsMenu" prefix="offset.">
<str id="moveLeft">Move Left</str>
<str id="moveUp">Move Up</str>
<str id="moveDown">Move Down</str>
<str id="moveRight">Move Right</str>
<str id="moveExtraLeft">Move Extra Left</str>
<str id="moveExtraUp">Move Extra Up</str>
<str id="moveExtraDown">Move Extra Down</str>
<str id="moveExtraRight">Move Extra Right</str>
<str id="clearOffsets">Clear Offsets</str>
</group>
<str id="topBar.view">View</str>
<group name="ViewMenu" prefix="view.">
<str id="zoomIn">Zoom in</str>
<str id="zoomOut">Zoom out</str>
<str id="resetZoom">Reset Zoom</str>
</group>
</group>
<group prefix="characterAnimsWindow.">
<str id="name">Character Animations</str>
</group>
<group prefix="characterPropertiesWindow.">
<str id="name">Character Properties</str>
<str id="newCharacter">New Character</str>
<str id="editCharacter">Edit Character Info</str>
</group>
<str id="info.animations">{0} Animations</str>
<str id="info.flipped">Flipped: {0}</str>
<str id="info.sprite">Sprite: {0}</str>
<str id="info.anim">Anim: {0}</str>
<str id="info.offset">Offset: ({0}, {1})</str>
<str id="info.invalidCharacter">Invalid Character</str>
</group>
<group name="StageEditor">
<str id="stageEditor.name">Stage Editor</str>
</group>
<!-- Debug Options here maybe?-->
<group name="UIDebugState">
<str id="uiDebug.name">UI Debug State</str>
</group>
<group name="DebugOptions">
<str id="debugOptions.name">Debug Options</str>
</group>
</language>
@@ -258,6 +258,7 @@ final class TranslationUtil
if(leMap.exists(id)) continue;
var value:String = node.has.string ? node.att.string : node.innerData;
if(node.getAtt("notrim").getDefault("true") != "true") value = value.trim();
// make it so you can escape the backslash
value = value.replace("\\n", "\n").replace("\r", ""); // remove stupid windows line breaks and convert newline literals to newlines
leMap.set(id, FormatUtil.get(value));
//leMap.set(id, FormatUtil.getStr("{" + id + "}"));
+6 -5
View File
@@ -15,27 +15,27 @@ class EditorPicker extends MusicBeatSubstate {
},
{
name: "Character Editor",
id: "character",
id: "characterEditor",
iconID: 1,
state: funkin.editors.character.CharacterSelection
},
{
name: "Stage Editor",
id: "stage",
id: "stageEditor",
iconID: 2,
state: null
},
#if (debug || debug_ui)
{
name: "UI Debug State",
id: "ui-debug",
id: "uiDebug",
iconID: 3,
state: UIDebugState
},
#end
{
name: "Debug Options",
id: "debug-options",
id: "debugOptions",
iconID: 4,
state: DebugOptions
}
@@ -71,7 +71,8 @@ class EditorPicker extends MusicBeatSubstate {
optionHeight = FlxG.height / options.length;
for(k=>o in options) {
var spr = new EditorPickerOption(o.name, o.iconID, optionHeight);
var visualName = o.name;
var spr = new EditorPickerOption(visualName, o.iconID, optionHeight);
spr.y = k * optionHeight;
add(spr);
sprites.push(spr);
@@ -26,6 +26,9 @@ class CharacterAnimScreen extends UISubstateWindow {
super();
}
inline function translate(id:String, ?args:Array<Dynamic>)
return TU.translate("characterAnimScreen." + id, args);
public override function create() {
var creatingAnim:Bool = animData == null;
@@ -41,7 +44,7 @@ class CharacterAnimScreen extends UISubstateWindow {
indices: []
};
winTitle = creatingAnim ? 'Creating Animation' : 'Animation ${animData.name} properties';
winTitle = translate("win-title-" + (creatingAnim ? "creating" : "editing"), [animData.name]);
winWidth = 690; winHeight = 314;
super.create();
@@ -50,45 +53,45 @@ class CharacterAnimScreen extends UISubstateWindow {
add(new UIText(ui.x, ui.y - 24, 0, text));
var title:UIText;
add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, creatingAnim ? "Create New Animation" : "Edit Animation Properties", 28));
add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, translate("title-" + (creatingAnim ? "creating" : "editing")), 28));
nameTextBox = new UITextBox(title.x, title.y + title.height + 38, animData.name, 160);
add(nameTextBox);
addLabelOn(nameTextBox, "Name");
addLabelOn(nameTextBox, translate("name"));
animTextBox = new UITextBox(nameTextBox.x + 160 + 26, nameTextBox.y, animData.anim, 200);
add(animTextBox);
addLabelOn(animTextBox, "Animation");
addLabelOn(animTextBox, translate("anim"));
fpsStepper = new UINumericStepper(animTextBox.x + 200 + 26, animTextBox.y, animData.fps, 0.1, 2, 1, 100, 82);
add(fpsStepper);
addLabelOn(fpsStepper, "FPS");
addLabelOn(fpsStepper, translate("fps"));
loopedCheckbox = new UICheckbox(fpsStepper.x + 82 - 32 + 26, fpsStepper.y, "Looped", animData.loop);
loopedCheckbox = new UICheckbox(fpsStepper.x + 82 - 32 + 26, fpsStepper.y, translate("looped"), animData.loop);
add(loopedCheckbox);
addLabelOn(loopedCheckbox, "Looping");
addLabelOn(loopedCheckbox, translate("looping"));
loopedCheckbox.x += 8; loopedCheckbox.y += 6;
indicesTextBox = new UITextBox(nameTextBox.x, nameTextBox.y + 32 + 40, animData.indices.join(", "), 270);
add(indicesTextBox);
addLabelOn(indicesTextBox, "Indices");
addLabelOn(indicesTextBox, translate("indices"));
offsetXStepper = new UINumericStepper(indicesTextBox.x + 270 + 26, indicesTextBox.y, animData.x, 0.001, 2, null, null, 84);
add(offsetXStepper);
addLabelOn(offsetXStepper, "Offset (X,Y)");
addLabelOn(offsetXStepper, translate("offset"));
add(new UIText(offsetXStepper.x + 84 - 32 + 0, offsetXStepper.y + 9, 0, ",", 22));
offsetYStepper = new UINumericStepper(offsetXStepper.x + 84 - 32 + 26, offsetXStepper.y, animData.y, 0.001, 2, null, null, 84);
add(offsetYStepper);
saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, "Save & Close", function() {
saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, TU.translate("editor.saveClose"), function() {
saveAnimData();
close();
}, 125);
add(saveButton);
closeButton = new UIButton(saveButton.x - 20, saveButton.y, creatingAnim ? "Cancel" : "Close", function() {
closeButton = new UIButton(saveButton.x - 20, saveButton.y, TU.translate("editor." + (creatingAnim ? "cancel" : "close")), function() {
if (creatingAnim && onSave != null) onSave(null);
close();
}, 125);
@@ -109,7 +112,7 @@ class CharacterAnimScreen extends UISubstateWindow {
animType: NONE,
x: offsetXStepper.value,
y: offsetYStepper.value,
indices: []
indices: []
};
var indicesSplit = indicesTextBox.label.text.split(",");
for(indice in indicesSplit) {
@@ -29,7 +29,7 @@ class CharacterEditor extends UIState {
public var uiGroup:FlxTypedGroup<FlxSprite> = new FlxTypedGroup<FlxSprite>();
// WINDOWS
public var characterPropertiresWindow:CharacterPropertiesWindow;
public var characterPropertiesWindow:CharacterPropertiesWindow;
public var characterAnimsWindow:UIButtonList<CharacterAnimButtons>;
// camera for the character itself so that it can be unzoomed/zoomed in again
@@ -46,159 +46,162 @@ class CharacterEditor extends UIState {
if (character != null) __character = character;
}
inline function translate(id:String, ?args:Array<Dynamic>)
return TU.translate("characterEditor." + id, args);
public override function create() {
super.create();
WindowUtils.suffix = " (Character Editor)";
WindowUtils.suffix = " (" + translate("name") + ")";
SaveWarning.selectionClass = CharacterSelection;
SaveWarning.saveFunc = () -> {_file_save(null);};
topMenu = [
{
label: "File",
label: translate("topBar.file"),
childs: [
{
label: "New",
label: translate("file.new"),
onSelect: _file_new,
},
null,
{
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"),
keybinds: [[CONTROL, Y], [CONTROL, SHIFT, Z]],
onSelect: _edit_redo
}
]
},
{
label: "Character",
label: translate("topBar.character"),
childs: [
{
label: "New Animation",
label: translate("character.newAnim"),
keybind: [CONTROL, N],
onSelect: _char_add_anim,
},
{
label: "Edit Animation",
label: translate("character.editAnim"),
onSelect: _char_edit_anim,
},
{
label: "Delete Animation",
label: translate("character.deleteAnim"),
keybind: [DELETE],
onSelect: _char_remove_anim,
},
null,
{
label: "Edit Info",
label: translate("character.editInfo"),
onSelect: _char_edit_info,
}
]
},
{
label: "Playback",
label: translate("topBar.playback"),
childs: [
{
label: "Play Animation",
label: translate("playback.play"),
keybind: [SPACE],
onSelect: _playback_play_anim,
},
{
label: "Stop Animation",
label: translate("playback.stop"),
onSelect: _playback_stop_anim
}
]
},
{
label: "Offsets",
label: translate("topBar.offset"),
childs: [
{
label: "Move Left",
label: translate("offset.moveLeft"),
keybind: [LEFT],
onSelect: _offsets_left,
},
{
label: "Move Up",
label: translate("offset.moveUp"),
keybind: [UP],
onSelect: _offsets_up,
},
{
label: "Move Down",
label: translate("offset.moveDown"),
keybind: [DOWN],
onSelect: _offsets_down,
},
{
label: "Move Right",
label: translate("offset.moveRight"),
keybind: [RIGHT],
onSelect: _offsets_right,
},
null,
{
label: "Move Extra Left",
label: translate("offset.moveExtraLeft"),
keybind: [SHIFT, LEFT],
onSelect: _offsets_extra_left,
},
{
label: "Move Extra Up",
label: translate("offset.moveExtraUp"),
keybind: [SHIFT, UP],
onSelect: _offsets_extra_up,
},
{
label: "Move Extra Down",
label: translate("offset.moveExtraDown"),
keybind: [SHIFT, DOWN],
onSelect: _offsets_extra_down,
},
{
label: "Move Extra Right",
label: translate("offset.moveExtraRight"),
keybind: [SHIFT, RIGHT],
onSelect: _offsets_extra_right,
},
null,
{
label: "Clear Offsets",
label: translate("offset.clearOffsets"),
keybind: [CONTROL, R],
onSelect: _offsets_clear,
}
]
},
{
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.resetZoom"),
keybind: [CONTROL, NUMPADZERO],
onSelect: _view_zoomreset
},
@@ -237,10 +240,10 @@ class CharacterEditor extends UIState {
topMenuSpr = new UITopMenu(topMenu);
topMenuSpr.cameras = uiGroup.cameras = [uiCamera];
characterPropertiresWindow = new CharacterPropertiesWindow();
uiGroup.add(characterPropertiresWindow);
characterPropertiesWindow = new CharacterPropertiesWindow();
uiGroup.add(characterPropertiesWindow);
characterAnimsWindow = new UIButtonList<CharacterAnimButtons>(777, 209, 473, 488, "Character Animations", FlxPoint.get(429, 32));
characterAnimsWindow = new UIButtonList<CharacterAnimButtons>(777, 209, 473, 488, translate("characterAnimsWindow.name"), FlxPoint.get(429, 32));
characterAnimsWindow.addButton.callback = function() CharacterEditor.instance.createAnimWithUI();
var animOrder = character.getAnimOrder();
for (i=>anim in animOrder)
@@ -284,9 +287,16 @@ class CharacterEditor extends UIState {
}
if (character != null)
characterPropertiresWindow.characterInfo.text = '${character.getNameList().length} Animations\nFlipped: ${character.flipX}\nSprite: ${character.sprite}\nAnim: ${character.getAnimName()}\nOffset: (${character.frameOffset.x}, ${character.frameOffset.y})';
characterPropertiesWindow.characterInfo.text = [
translate("info.animations", [character.getNameList().length]),
translate("info.flipped", [character.flipX]),
translate("info.sprite", [character.sprite]),
translate("info.anim", [character.getAnimName()]),
translate("info.offset", [character.frameOffset.x, character.frameOffset.y])
].join('\n');
else characterPropertiesWindow.characterInfo.text = translate("info.invalidCharacter");
if (!(characterPropertiresWindow.hovered || characterAnimsWindow.hovered) && !characterAnimsWindow.dragging) {
if (!(characterPropertiesWindow.hovered || characterAnimsWindow.hovered) && !characterAnimsWindow.dragging) {
if (FlxG.mouse.wheel != 0) {
zoom += 0.25 * FlxG.mouse.wheel;
__camZoom = Math.pow(2, zoom);
@@ -36,8 +36,11 @@ class CharacterInfoScreen extends UISubstateWindow {
super();
}
inline function translate(id:String, ?args:Array<Dynamic>)
return TU.translate("characterInfoScreen." + id, args);
public override function create() {
winTitle = "Editing Character";
winTitle = translate("win-title");
winWidth = 1014;
winHeight = 600;
@@ -47,40 +50,40 @@ class CharacterInfoScreen extends UISubstateWindow {
add(new UIText(ui.x, ui.y - 24, 0, text));
var title:UIText;
add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, "Sprite Data", 28));
add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, translate("spriteData"), 28));
spriteTextBox = new UITextBox(title.x, title.y + title.height + 38, character.sprite, 200);
add(spriteTextBox);
addLabelOn(spriteTextBox, "Sprite");
addLabelOn(spriteTextBox, translate("sprite"));
iconTextBox = new UITextBox(spriteTextBox.x + 200 + 26, spriteTextBox.y, character.getIcon(), 150);
iconTextBox.onChange = (newIcon:String) -> {updateIcon(newIcon);}
add(iconTextBox);
addLabelOn(iconTextBox, "Icon");
addLabelOn(iconTextBox, translate("icon"));
updateIcon(character.getIcon());
gameOverCharTextBox = new UITextBox(iconTextBox.x + 150 + (75 + 12), iconTextBox.y, character.gameOverCharacter, 200);
add(gameOverCharTextBox);
addLabelOn(gameOverCharTextBox, "Game Over Character");
addLabelOn(gameOverCharTextBox, translate("gameOverChar"));
antialiasingCheckbox = new UICheckbox(spriteTextBox.x, spriteTextBox.y + 10 + 32 + 28, "Antialiasing", character.antialiasing);
antialiasingCheckbox = new UICheckbox(spriteTextBox.x, spriteTextBox.y + 10 + 32 + 28, translate("antialiasing"), character.antialiasing);
add(antialiasingCheckbox);
addLabelOn(antialiasingCheckbox, "Antialiased");
addLabelOn(antialiasingCheckbox, translate("antialiased"));
flipXCheckbox = new UICheckbox(antialiasingCheckbox.x + 172, spriteTextBox.y + 10 + 32 + 28, "FlipX", character.flipX);
flipXCheckbox = new UICheckbox(antialiasingCheckbox.x + 172, spriteTextBox.y + 10 + 32 + 28, translate("flipX"), character.flipX);
add(flipXCheckbox);
addLabelOn(flipXCheckbox, "Flipped");
addLabelOn(flipXCheckbox, translate("flipped"));
iconColorWheel = new UIColorwheel(gameOverCharTextBox.x + 200 + 20, gameOverCharTextBox.y, character.iconColor);
add(iconColorWheel);
addLabelOn(iconColorWheel, "Icon Color");
addLabelOn(iconColorWheel, translate("iconColor"));
add(title = new UIText(spriteTextBox.x, spriteTextBox.y + 10 + 46 + 84, 0, "Character Data", 28));
add(title = new UIText(spriteTextBox.x, spriteTextBox.y + 10 + 46 + 84, 0, translate("characterData"), 28));
positionXStepper = new UINumericStepper(title.x, title.y + title.height + 36, character.globalOffset.x, 0.001, 2, null, null, 84);
add(positionXStepper);
addLabelOn(positionXStepper, "Position (X,Y)");
addLabelOn(positionXStepper, translate("position"));
add(new UIText(positionXStepper.x + 84 - 32 + 0, positionXStepper.y + 9, 0, ",", 22));
@@ -89,7 +92,7 @@ class CharacterInfoScreen extends UISubstateWindow {
cameraXStepper = new UINumericStepper(positionYStepper.x + 36 + 84 - 32, positionYStepper.y, character.cameraOffset.x, 0.001, 2, null, null, 84);
add(cameraXStepper);
addLabelOn(cameraXStepper, "Camera Position (X,Y)");
addLabelOn(cameraXStepper, translate("cameraPosition"));
add(new UIText(cameraXStepper.x + 84 - 32 + 0, cameraXStepper.y + 9, 0, ",", 22));
@@ -98,11 +101,11 @@ class CharacterInfoScreen extends UISubstateWindow {
scaleStepper = new UINumericStepper(cameraYStepper.x + 84 - 32 + 90, cameraYStepper.y, character.scale.x, 0.001, 2, null, null, 74);
add(scaleStepper);
addLabelOn(scaleStepper, "Scale");
addLabelOn(scaleStepper, translate("scale"));
singTimeStepper = new UINumericStepper(scaleStepper.x + 74 - 32 + 36, scaleStepper.y, character.holdTime, 0.001, 2, null, null, 74);
add(singTimeStepper);
addLabelOn(singTimeStepper, "Sing Duration (Steps)");
addLabelOn(singTimeStepper, translate("singDuration"));
customPropertiesButtonList = new UIButtonList<PropertyButton>(singTimeStepper.x + singTimeStepper.width + 200, singTimeStepper.y, 290, 200, '', FlxPoint.get(280, 35), null, 5);
customPropertiesButtonList.frames = Paths.getFrames('editors/ui/inputbox');
@@ -113,27 +116,25 @@ class CharacterInfoScreen extends UISubstateWindow {
for (prop=>val in character.extra)
customPropertiesButtonList.add(new PropertyButton(prop, val, customPropertiesButtonList));
add(customPropertiesButtonList);
addLabelOn(customPropertiesButtonList, "Custom Values (Advanced)");
addLabelOn(customPropertiesButtonList, translate("customValues"));
isPlayerCheckbox = new UICheckbox(positionXStepper.x, positionXStepper.y + 10 + 32 + 28, "isPlayer", character.playerOffsets);
isPlayerCheckbox = new UICheckbox(positionXStepper.x, positionXStepper.y + 10 + 32 + 28, translate("isPlayer"), character.playerOffsets);
add(isPlayerCheckbox);
addLabelOn(isPlayerCheckbox, "Is Player");
isGFCheckbox = new UICheckbox(isPlayerCheckbox.x + 128, positionXStepper.y + 10 + 32 + 28, "isGF", false);
isGFCheckbox = new UICheckbox(isPlayerCheckbox.x + 128, positionXStepper.y + 10 + 32 + 28, translate("isGF"), false);
add(isGFCheckbox);
addLabelOn(isGFCheckbox, "Is GF");
for (checkbox in [isPlayerCheckbox, isGFCheckbox, antialiasingCheckbox, flipXCheckbox])
{checkbox.y += 4; checkbox.x += 6;}
saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20, windowSpr.y + windowSpr.bHeight- 20, "Save & Close", function() {
saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20, windowSpr.y + windowSpr.bHeight- 20, TU.translate("editor.saveClose"), function() {
saveCharacterInfo();
close();
}, 125);
saveButton.x -= saveButton.bWidth;
saveButton.y -= saveButton.bHeight;
closeButton = new UIButton(saveButton.x - 20, saveButton.y, "Close", function() {
closeButton = new UIButton(saveButton.x - 20, saveButton.y, TU.translate("editor.close"), function() {
if (onSave != null) onSave(null);
close();
}, 125);
@@ -1,3 +1,4 @@
package funkin.editors.character;
import flixel.util.FlxColor;
@@ -8,19 +9,22 @@ class CharacterPropertiesWindow extends UIWindow {
public var characterInfo:UIText;
public function new() {
super(800-23,23 + 23, 450 + 23, 140, "Character Properties");
inline function translate(id:String, ?args:Array<Dynamic>)
return TU.translate("characterEditor.characterPropertiesWindow." + id, args);
newButton = new UIButton( x +(450 + 23)- 25 - 3 - 200, y + 12 + 31, "New Character", null, 200);
public function new() {
super(800-23,23 + 23, 450 + 23, 140, translate("name"));
newButton = new UIButton( x +(450 + 23)- 25 - 3 - 200, y + 12 + 31, translate("newCharacter"), null, 200);
members.push(newButton);
newButton.color = FlxColor.GREEN;
editButton = new UIButton(newButton.x, newButton.y + 12 + 30 + 4, "Edit Character Info", function () {
editButton = new UIButton(newButton.x, newButton.y + 12 + 30 + 4, translate("editCharacter"), function () {
CharacterEditor.instance.editInfoWithUI();
}, 200);
members.push(editButton);
characterInfo = new UIText(x + 450 + 20 - 42 - 400, y + 36 + 10, 400, "0 Animations:\nFlipped:\nSprite:\nAnim:\nOffset: (,)");
characterInfo = new UIText(x + 450 + 20 - 42 - 400, y + 36 + 10, 400, "");
characterInfo.alignment = LEFT;
members.push(characterInfo);
}
@@ -8,6 +8,9 @@ import funkin.options.type.OptionType;
class CharacterSelection extends EditorTreeMenu
{
inline function translate(id:String, ?args:Array<Dynamic>)
return TU.translate("characterSelection." + id, args);
public override function create()
{
bgType = "charter";
@@ -17,19 +20,20 @@ class CharacterSelection extends EditorTreeMenu
var list:Array<OptionType> = [
for (char in (modsList.length == 0 ? Character.getList(false) : modsList))
new IconOption(char, "Press ACCEPT to edit this character.", Character.getIconFromCharName(char),
new IconOption(char, translate("acceptCharacter"), Character.getIconFromCharName(char),
function() {
FlxG.switchState(new CharacterEditor(char));
})
];
list.insert(0, new NewOption("New Character", "New Character", function() {
openSubState(new UIWarningSubstate("New Character: Feature Not Implemented!", "This feature isnt implemented yet. Please wait for more cne updates to have this functional.\n\n\n- Codename Devs", [
{label: "Ok", color: 0xFFFF0000, onClick: function(t) {}}
var newChar = translate("newCharacter");
list.insert(0, new NewOption(newChar, newChar, function() {
openSubState(new UIWarningSubstate(translate("warnings.notImplemented-title"), translate("warnings.notImplemented-body"), [
{label: TU.translate("editor.ok"), color: 0xFFFF0000, onClick: function(t) {}}
]));
}));
main = new OptionsScreen("Character Editor", "Select a character to edit", list);
main = new OptionsScreen(TU.translate("characterEditor.name"), translate("desc"), list);
DiscordUtil.call("onEditorTreeLoaded", ["Character Editor"]);
}
@@ -26,11 +26,11 @@ class CharterSelection extends EditorTreeMenu {
freeplayList = FreeplaySonglist.get(false);
var list:Array<OptionType> = [
for(s in freeplayList.songs) new EditorIconOption(s.name, TU.translate("charterSelection.accept-song"), s.icon, function() {
for(s in freeplayList.songs) new EditorIconOption(s.name, TU.translate("charterSelection.acceptSong"), s.icon, function() {
curSong = s;
var list:Array<OptionType> = [
for(d in s.difficulties) if (d != "")
new TextOption(d, TU.translate("charterSelection.accept-difficulty"), function() {
new TextOption(d, TU.translate("charterSelection.acceptDifficulty"), function() {
FlxG.switchState(new Charter(s.name, d));
})
];
@@ -117,11 +117,11 @@ class CharterSelection extends EditorTreeMenu {
#end
// duplicated code, todo: fix this
var option = new EditorIconOption(creation.meta.name, TU.translate("charterSelection.accept-song"), creation.meta.icon, function() {
var option = new EditorIconOption(creation.meta.name, TU.translate("charterSelection.acceptSong"), creation.meta.icon, function() {
curSong = creation.meta;
var list:Array<OptionType> = [
for(d in creation.meta.difficulties)
if (d != "") new TextOption(d, TU.translate("charterSelection.accept-difficulty"), function() {
if (d != "") new TextOption(d, TU.translate("charterSelection.acceptDifficulty"), function() {
FlxG.switchState(new Charter(creation.meta.name, d));
})
];
@@ -156,7 +156,7 @@ class CharterSelection extends EditorTreeMenu {
// Add to List
// duplicated code, todo: fix this
curSong.difficulties.push(name);
var option = new TextOption(name, TU.translate("charterSelection.accept-difficulty"), function() {
var option = new TextOption(name, TU.translate("charterSelection.acceptDifficulty"), function() {
FlxG.switchState(new Charter(curSong.name, name));
});
optionsTree.members[optionsTree.members.length-1].insert(optionsTree.members[optionsTree.members.length-1].length-1, option);