diff --git a/source/funkin/backend/scripting/events/GameOverCreationEvent.hx b/source/funkin/backend/scripting/events/GameOverCreationEvent.hx index c314d501..8536e16e 100644 --- a/source/funkin/backend/scripting/events/GameOverCreationEvent.hx +++ b/source/funkin/backend/scripting/events/GameOverCreationEvent.hx @@ -16,6 +16,8 @@ final class GameOverCreationEvent extends CancellableEvent public var gameOverSong:String; + public var bpm:Int; + public var lossSFX:String; public var retrySFX:String; diff --git a/source/funkin/editors/character/CharacterInfoScreen.hx b/source/funkin/editors/character/CharacterInfoScreen.hx index 13e847e6..27673c2b 100644 --- a/source/funkin/editors/character/CharacterInfoScreen.hx +++ b/source/funkin/editors/character/CharacterInfoScreen.hx @@ -108,10 +108,10 @@ class CharacterInfoScreen extends UISubstateWindow { customPropertiesButtonList.frames = Paths.getFrames('editors/ui/inputbox'); customPropertiesButtonList.cameraSpacing = 0; customPropertiesButtonList.addButton.callback = function() { - customPropertiesButtonList.add(new PropertyButton("New Property", "Value Here")); + customPropertiesButtonList.add(new PropertyButton("New Property", "Value Here", customPropertiesButtonList)); } for (prop=>val in character.extra) - customPropertiesButtonList.add(new PropertyButton(prop, val)); + customPropertiesButtonList.add(new PropertyButton(prop, val, customPropertiesButtonList)); add(customPropertiesButtonList); addLabelOn(customPropertiesButtonList, "Custom Values (Advanced)"); diff --git a/source/funkin/editors/charter/MetaDataScreen.hx b/source/funkin/editors/charter/MetaDataScreen.hx index 0ed13325..63ff614d 100644 --- a/source/funkin/editors/charter/MetaDataScreen.hx +++ b/source/funkin/editors/charter/MetaDataScreen.hx @@ -101,10 +101,10 @@ class MetaDataScreen extends UISubstateWindow { customPropertiesButtonList.frames = Paths.getFrames('editors/ui/inputbox'); customPropertiesButtonList.cameraSpacing = 0; customPropertiesButtonList.addButton.callback = function() { - customPropertiesButtonList.add(new PropertyButton("Property", "Value Here")); + customPropertiesButtonList.add(new PropertyButton("Property", "Value Here", customPropertiesButtonList)); } for (val in Reflect.fields(metadata.customValues)) - customPropertiesButtonList.add(new PropertyButton(val, Reflect.field(metadata.customValues, val))); + customPropertiesButtonList.add(new PropertyButton(val, Reflect.field(metadata.customValues, val), customPropertiesButtonList)); add(customPropertiesButtonList); addLabelOn(customPropertiesButtonList, "Custom Values (Advanced)"); diff --git a/source/funkin/editors/extra/PropertyButton.hx b/source/funkin/editors/extra/PropertyButton.hx index ff76f93f..0ffad946 100644 --- a/source/funkin/editors/extra/PropertyButton.hx +++ b/source/funkin/editors/extra/PropertyButton.hx @@ -3,16 +3,31 @@ package funkin.editors.extra; class PropertyButton extends UIButton { public var propertyText:UITextBox; public var valueText:UITextBox; + public var deleteButton:UIButton; + public var deleteIcon:FlxSprite; - public function new(property, value) { + public function new(property, value, parent) { super(0, 0, '', function () {}, 280, 35); members.push(propertyText = new UITextBox(5, 5, property, 100, 25)); - members.push(valueText = new UITextBox(propertyText.x + propertyText.bWidth + 10, 5, value, 165, 25)); + members.push(valueText = new UITextBox(propertyText.x + propertyText.bWidth + 10, 5, value, 135, 25)); + + deleteButton = new UIButton(valueText.x + 135, bHeight/2 - (25/2), "", function () { + parent.remove(this); + }, 25, 25); + deleteButton.color = 0xFFFF0000; + deleteButton.autoAlpha = false; + members.push(deleteButton); + + deleteIcon = new FlxSprite(deleteButton.x + (15/2), deleteButton.y + 8).loadGraphic(Paths.image('editors/delete-button')); + deleteIcon.antialiasing = false; + members.push(deleteIcon); } public override function update(elapsed) { super.update(elapsed); propertyText.follow(this, 5, 5); valueText.follow(this, propertyText.x + propertyText.bWidth, 5); + deleteButton.follow(this, valueText.x + 135, bHeight/2 - (25/2)); + deleteIcon.follow(deleteButton, 5, 5); } } \ No newline at end of file diff --git a/source/funkin/game/GameOverSubstate.hx b/source/funkin/game/GameOverSubstate.hx index 8c51046e..89479dcf 100644 --- a/source/funkin/game/GameOverSubstate.hx +++ b/source/funkin/game/GameOverSubstate.hx @@ -19,6 +19,7 @@ class GameOverSubstate extends MusicBeatSubstate public var characterName:String; public var gameOverSong:String; + public var gameOverSongBPM:Int; public var lossSFXName:String; public var retrySFX:String; public var player:Bool; @@ -37,8 +38,7 @@ class GameOverSubstate extends MusicBeatSubstate public var lossSFX:FlxSound; - public function new(x:Float, y:Float, character:String = "bf-dead", player:Bool = true, gameOverSong:String = "gameOver", lossSFX:String = "gameOverSFX", - retrySFX:String = "gameOverEnd") + public function new(x:Float, y:Float, character:String = "bf-dead", player:Bool = true, gameOverSong:String = "gameOver", lossSFX:String = "gameOverSFX", retrySFX:String = "gameOverEnd") { super(); this.x = x; @@ -61,7 +61,7 @@ class GameOverSubstate extends MusicBeatSubstate gameoverScript.setParent(this); gameoverScript.load(); - var event = EventManager.get(GameOverCreationEvent).recycle(x, y, characterName, player, gameOverSong, lossSFXName, retrySFX); + var event = EventManager.get(GameOverCreationEvent).recycle(x, y, characterName, player, gameOverSong, gameOverSongBPM, lossSFXName, retrySFX); gameoverScript.call('create', [event]); x = event.x; @@ -69,6 +69,7 @@ class GameOverSubstate extends MusicBeatSubstate characterName = event.character; player = event.player; gameOverSong = event.gameOverSong; + gameOverSongBPM = event.bpm; lossSFXName = event.lossSFX; retrySFX = event.retrySFX; @@ -86,7 +87,7 @@ class GameOverSubstate extends MusicBeatSubstate FlxG.camera.target = camFollow; lossSFX = FlxG.sound.play(Paths.sound(lossSFXName)); - Conductor.changeBPM(100); + Conductor.changeBPM(gameOverSongBPM); DiscordUtil.changePresence('Game Over', PlayState.SONG.meta.displayName + " (" + PlayState.difficulty + ")"); @@ -119,9 +120,7 @@ class GameOverSubstate extends MusicBeatSubstate FlxG.switchState(new FreeplayState()); } - if (!isEnding - && ((!lossSFX.playing) || (character.getAnimName() == "firstDeath" && character.isAnimFinished())) - && (FlxG.sound.music == null || !FlxG.sound.music.playing)) + if (!isEnding && ((!lossSFX.playing) || (character.getAnimName() == "firstDeath" && character.isAnimFinished())) && (FlxG.sound.music == null || !FlxG.sound.music.playing)) { CoolUtil.playMusic(Paths.music(gameOverSong), false, 1, true, 100); beatHit(0); @@ -189,4 +188,4 @@ class GameOverSubstate extends MusicBeatSubstate super.destroy(); } -} +} \ No newline at end of file