Added XML Editing of anything

This commit is contained in:
NeeEoo
2024-04-17 22:20:55 +02:00
parent 75e3ab79c5
commit 7c60a4e632
8 changed files with 126 additions and 7 deletions
@@ -1210,4 +1210,25 @@ enum abstract StageEditorEdge(Int) {
case BOTTOM_RIGHT: "BOTTOM_RIGHT";
}
}
}
class StageXMLEditScreen extends UISoftcodedWindow {
public var xml:Access;
public var saveCallback:Void->Void;
public function new(xml:Access, saveCallback:Void->Void, type:String = "Unknown") {
this.xml = xml;
this.saveCallback = saveCallback;
super("layouts/stage/xmlEditScreen", [
"stage" => StageEditor.instance.stage,
"xml" => xml,
"exID" => StageEditor.exID,
"type" => type
]);
}
override function saveData() {
super.saveData();
if(saveCallback != null) saveCallback();
}
}
@@ -3,7 +3,6 @@ package funkin.editors.stage;
import funkin.editors.stage.StageCreationScreen.StageCreationData;
import funkin.game.Stage;
import funkin.options.OptionsScreen;
import funkin.options.type.IconOption;
import funkin.options.type.NewOption;
import funkin.options.type.OptionType;
import funkin.options.type.TextOption;
@@ -1,5 +1,6 @@
package funkin.editors.stage.elements;
import funkin.editors.stage.StageEditor.StageXMLEditScreen;
import funkin.game.Character;
import funkin.game.Stage.StageCharPos;
import haxe.xml.Access;
@@ -44,7 +45,11 @@ class StageCharacterButton extends StageElementButton {
}*/
public override function onEdit() {
FlxG.state.openSubState(new StageCharacterEditScreen(this));
if(!FlxG.keys.pressed.SHIFT) {
FlxG.state.openSubState(new StageCharacterEditScreen(this));
} else {
FlxG.state.openSubState(new StageXMLEditScreen(this.xml, updateInfo, "Character"));
}
}
//public override function onEdit() {
@@ -1,7 +1,7 @@
package funkin.editors.stage.elements;
import haxe.xml.Access;
import flixel.util.FlxColor;
import haxe.xml.Access;
using flixel.util.FlxColorTransformUtil;
@@ -1,7 +1,7 @@
package funkin.editors.stage.elements;
import haxe.xml.Access;
import flixel.util.FlxColor;
import haxe.xml.Access;
class StageSolidButton extends StageSpriteButton {
@@ -1,6 +1,6 @@
package funkin.editors.stage.elements;
import flixel.util.FlxColor;
import funkin.editors.stage.StageEditor.StageXMLEditScreen;
import funkin.editors.stage.elements.StageElementButton;
import funkin.editors.ui.UISoftcodedWindow;
import haxe.xml.Access;
@@ -40,7 +40,11 @@ class StageSpriteButton extends StageElementButton {
}
public override function onEdit() {
FlxG.state.openSubState(new StageSpriteEditScreen(this));
if(!FlxG.keys.pressed.SHIFT) {
FlxG.state.openSubState(new StageSpriteEditScreen(this));
} else {
FlxG.state.openSubState(new StageXMLEditScreen(this.xml, updateInfo, "Sprite"));
}
}
public override function onDelete() {