diff --git a/assets/data/characters/bf-indieCross.xml b/assets/data/characters/bf-indieCross.xml new file mode 100644 index 00000000..162803e6 --- /dev/null +++ b/assets/data/characters/bf-indieCross.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/images/characters/bf-indieCross.png b/assets/images/characters/bf-indieCross.png new file mode 100644 index 00000000..f9df57af Binary files /dev/null and b/assets/images/characters/bf-indieCross.png differ diff --git a/assets/images/characters/bf-indieCross.xml b/assets/images/characters/bf-indieCross.xml new file mode 100644 index 00000000..bc129e71 --- /dev/null +++ b/assets/images/characters/bf-indieCross.xml @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs.xml b/libs.xml index e4247aca..9bc62e4e 100644 --- a/libs.xml +++ b/libs.xml @@ -5,7 +5,7 @@ - + diff --git a/source/funkin/editors/character/CharacterAnimButton.hx b/source/funkin/editors/character/CharacterAnimButton.hx index 3f0e48da..61182562 100644 --- a/source/funkin/editors/character/CharacterAnimButton.hx +++ b/source/funkin/editors/character/CharacterAnimButton.hx @@ -147,7 +147,10 @@ class CharacterAnimButton extends UIButton { deleteIcon.antialiasing = false; members.push(deleteIcon); - editButton = new UIButton(0, 0, null, () -> {this.closed = !this.closed;}, 28,24); + editButton = new UIButton(0, 0, null, () -> { + if (!this.closed) UIUtil.confirmUISelections(this); + this.closed = !this.closed; + }, 28,24); editButton.frames = Paths.getFrames("editors/ui/grayscale-button"); editButton.color = 0xFFAFAA12; members.push(editButton); diff --git a/source/funkin/editors/character/CharacterAnimsWindow.hx b/source/funkin/editors/character/CharacterAnimsWindow.hx index 91e2d726..a58f790f 100644 --- a/source/funkin/editors/character/CharacterAnimsWindow.hx +++ b/source/funkin/editors/character/CharacterAnimsWindow.hx @@ -7,6 +7,7 @@ import flixel.graphics.FlxGraphic; import openfl.geom.Rectangle; import flixel.graphics.frames.FlxFrame; import funkin.game.Character; +import flixel.animation.FlxPrerotatedAnimation; using funkin.backend.utils.BitmapUtil; @@ -78,7 +79,7 @@ class CharacterAnimsWindow extends UIButtonList { var frameRect:Rectangle = new Rectangle(frame.offset.x, frame.offset.y, frame.sourceSize.x, frame.sourceSize.y); var animBounds:Rectangle = displayWindowGraphic != null ? displayWindowGraphic.bitmap.bounds(frameRect) : frameRect; - displayAnimsFramesList.set(name, {frame: anim.frames.getDefault([0])[0], scale: 104/animBounds.height, animBounds: animBounds}); + displayAnimsFramesList.set(name, {frame: anim.frames.getDefault([0])[0], scale: 104/Math.max(animBounds.width, animBounds.height), animBounds: animBounds}); } else { character.storeAtlasState(); diff --git a/source/funkin/editors/character/CharacterInfoScreen.hx b/source/funkin/editors/character/CharacterInfoScreen.hx index 3296fd15..8241c198 100644 --- a/source/funkin/editors/character/CharacterInfoScreen.hx +++ b/source/funkin/editors/character/CharacterInfoScreen.hx @@ -102,7 +102,7 @@ class CharacterInfoScreen extends UISubstateWindow { } public function saveCharacterInfo() { - @:privateAccess durationStepper.__onChange(durationStepper.label.text); + UIUtil.confirmUISelections(this); if (onSave != null) onSave({ icon: iconColorPicker.iconTextBox.label.text, diff --git a/source/funkin/editors/charter/ChartCreationScreen.hx b/source/funkin/editors/charter/ChartCreationScreen.hx index d5448b00..a93a7b36 100644 --- a/source/funkin/editors/charter/ChartCreationScreen.hx +++ b/source/funkin/editors/charter/ChartCreationScreen.hx @@ -144,8 +144,7 @@ class ChartCreationScreen extends UISubstateWindow { var strumLines:Array = []; for (strline in strumLineList.buttons.members) { - for (stepper in [strline.hudXStepper, strline.hudYStepper, strline.hudScaleStepper]) - @:privateAccess stepper.__onChange(stepper.label.text); + UIUtil.confirmUISelections(strline); strumLines.push({ characters: [for (char in strline.charactersList.buttons.members) char.textBox.label.text], diff --git a/source/funkin/editors/charter/ChartDataScreen.hx b/source/funkin/editors/charter/ChartDataScreen.hx index 510116c3..71219726 100644 --- a/source/funkin/editors/charter/ChartDataScreen.hx +++ b/source/funkin/editors/charter/ChartDataScreen.hx @@ -75,9 +75,8 @@ class ChartDataScreen extends UISubstateWindow { add(previewStrumLine); } - public function saveInfo() - { - @:privateAccess scrollSpeedStepper.__onChange(scrollSpeedStepper.label.text); + public function saveInfo() { + UIUtil.confirmUISelections(this); var oldData:{stage:String, speed:Float} = {stage: PlayState.SONG.stage, speed: PlayState.SONG.scrollSpeed}; diff --git a/source/funkin/editors/charter/CharterMetaDataScreen.hx b/source/funkin/editors/charter/CharterMetaDataScreen.hx index 8dd5f937..6ba0fc62 100644 --- a/source/funkin/editors/charter/CharterMetaDataScreen.hx +++ b/source/funkin/editors/charter/CharterMetaDataScreen.hx @@ -143,8 +143,7 @@ class CharterMetaDataScreen extends UISubstateWindow { } public function saveMeta() { - for (stepper in [bpmStepper, beatsPerMeasureStepper, stepsPerBeatStepper]) - @:privateAccess stepper.__onChange(stepper.label.text); + UIUtil.confirmUISelections(this); var customVals = {}; for (vals in customPropertiesButtonList.buttons.members) { diff --git a/source/funkin/editors/charter/CharterStrumlineScreen.hx b/source/funkin/editors/charter/CharterStrumlineScreen.hx index 9279de6b..8d4517d9 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -190,8 +190,7 @@ class CharterStrumlineScreen extends UISubstateWindow { } function saveStrumline() { - for (stepper in [hudXStepper, hudYStepper, hudScaleStepper, keyCountStepper, hudSpacingStepper]) - @:privateAccess stepper.__onChange(stepper.label.text); + UIUtil.confirmUISelections(this); var newStrumLine:ChartStrumLine = { characters: [ diff --git a/source/funkin/editors/charter/SongCreationScreen.hx b/source/funkin/editors/charter/SongCreationScreen.hx index 79203dd8..3548171d 100644 --- a/source/funkin/editors/charter/SongCreationScreen.hx +++ b/source/funkin/editors/charter/SongCreationScreen.hx @@ -228,8 +228,7 @@ class SongCreationScreen extends UISubstateWindow { } function saveSongInfo() { - for (stepper in [bpmStepper, beatsPerMeasureStepper, stepsPerBeatStepper]) - @:privateAccess stepper.__onChange(stepper.label.text); + UIUtil.confirmUISelections(this); var meta:ChartMetaData = { name: songNameTextBox.label.text, diff --git a/source/funkin/editors/ui/UIUtil.hx b/source/funkin/editors/ui/UIUtil.hx index 26db8f39..3ca1d8e6 100644 --- a/source/funkin/editors/ui/UIUtil.hx +++ b/source/funkin/editors/ui/UIUtil.hx @@ -1,5 +1,6 @@ package funkin.editors.ui; +import flixel.util.typeLimit.OneOfTwo; import flixel.input.FlxInput.FlxInputState; import flixel.input.keyboard.FlxKey; import funkin.editors.ui.UIContextMenu.UIContextMenuOption; @@ -125,4 +126,36 @@ class UIUtil { public static inline function prettify(str:String) { return [for(s in str.split(" ")) [for(k=>l in s.split("")) k == 0 ? l.toUpperCase() : l.toLowerCase()].join("")].join(" "); } + + /** + * For when the user closes out before confriming all ui selections + * @param ui the thingy you wanna check + */ + public static function confirmUISelections(ui:OneOfTwo) { + var members:Array = []; + if (ui is UISprite) + members = cast(ui, UISprite).members; + else if (ui is UIState) + members = cast(ui, UIState).members; + + for (member in members) { + if (member is UINumericStepper) @:privateAccess { + var stepper:UINumericStepper = cast member; + if (stepper.onChange != stepper.__onChange && stepper.__wasFocused) { + stepper.onChange(stepper.label.text); + stepper.__wasFocused = false; + } else stepper.__onChange(stepper.label.text); + + } else if (member is UITextBox) @:privateAccess { + var textbox:UITextBox = cast member; + if (textbox.__wasFocused) { + textbox.onChange(textbox.label.text); + textbox.__wasFocused = false; + } + } + + if (member is UISprite || ui is UIState) + confirmUISelections(cast member); + } + } } \ No newline at end of file