diff --git a/source/funkin/ui/debug/char/components/dialogs/FreeplayDJSettingsDialog.hx b/source/funkin/ui/debug/char/components/dialogs/freeplay/FreeplayDJSettingsDialog.hx similarity index 97% rename from source/funkin/ui/debug/char/components/dialogs/FreeplayDJSettingsDialog.hx rename to source/funkin/ui/debug/char/components/dialogs/freeplay/FreeplayDJSettingsDialog.hx index d4c95d6314..d986a30dd0 100644 --- a/source/funkin/ui/debug/char/components/dialogs/FreeplayDJSettingsDialog.hx +++ b/source/funkin/ui/debug/char/components/dialogs/freeplay/FreeplayDJSettingsDialog.hx @@ -1,4 +1,4 @@ -package funkin.ui.debug.char.components.dialogs; +package funkin.ui.debug.char.components.dialogs.freeplay; import funkin.ui.debug.char.pages.CharCreatorFreeplayPage; import funkin.data.freeplay.player.PlayerRegistry; diff --git a/source/funkin/ui/debug/char/components/dialogs/FreeplayStyleDialog.hx b/source/funkin/ui/debug/char/components/dialogs/freeplay/FreeplayStyleDialog.hx similarity index 99% rename from source/funkin/ui/debug/char/components/dialogs/FreeplayStyleDialog.hx rename to source/funkin/ui/debug/char/components/dialogs/freeplay/FreeplayStyleDialog.hx index ea323d40b4..2049c02286 100644 --- a/source/funkin/ui/debug/char/components/dialogs/FreeplayStyleDialog.hx +++ b/source/funkin/ui/debug/char/components/dialogs/freeplay/FreeplayStyleDialog.hx @@ -1,4 +1,4 @@ -package funkin.ui.debug.char.components.dialogs; +package funkin.ui.debug.char.components.dialogs.freeplay; import funkin.data.freeplay.style.FreeplayStyleRegistry; import funkin.data.freeplay.player.PlayerRegistry; diff --git a/source/funkin/ui/debug/char/components/dialogs/AddAnimDialog.hx b/source/funkin/ui/debug/char/components/dialogs/gameplay/AddAnimDialog.hx similarity index 98% rename from source/funkin/ui/debug/char/components/dialogs/AddAnimDialog.hx rename to source/funkin/ui/debug/char/components/dialogs/gameplay/AddAnimDialog.hx index a70b16d4c7..40a5bf52a7 100644 --- a/source/funkin/ui/debug/char/components/dialogs/AddAnimDialog.hx +++ b/source/funkin/ui/debug/char/components/dialogs/gameplay/AddAnimDialog.hx @@ -1,4 +1,4 @@ -package funkin.ui.debug.char.components.dialogs; +package funkin.ui.debug.char.components.dialogs.gameplay; import funkin.ui.debug.char.pages.CharCreatorGameplayPage.CharDialogType; import funkin.data.character.CharacterData.CharacterRenderType; diff --git a/source/funkin/ui/debug/char/components/dialogs/CharMetadataDialog.hx b/source/funkin/ui/debug/char/components/dialogs/gameplay/CharMetadataDialog.hx similarity index 98% rename from source/funkin/ui/debug/char/components/dialogs/CharMetadataDialog.hx rename to source/funkin/ui/debug/char/components/dialogs/gameplay/CharMetadataDialog.hx index 291996fbcd..d3863d0143 100644 --- a/source/funkin/ui/debug/char/components/dialogs/CharMetadataDialog.hx +++ b/source/funkin/ui/debug/char/components/dialogs/gameplay/CharMetadataDialog.hx @@ -1,4 +1,4 @@ -package funkin.ui.debug.char.components.dialogs; +package funkin.ui.debug.char.components.dialogs.gameplay; @:xml(' diff --git a/source/funkin/ui/debug/char/components/dialogs/GhostSettingsDialog.hx b/source/funkin/ui/debug/char/components/dialogs/gameplay/GhostSettingsDialog.hx similarity index 98% rename from source/funkin/ui/debug/char/components/dialogs/GhostSettingsDialog.hx rename to source/funkin/ui/debug/char/components/dialogs/gameplay/GhostSettingsDialog.hx index 716c347b72..c3d9fb775f 100644 --- a/source/funkin/ui/debug/char/components/dialogs/GhostSettingsDialog.hx +++ b/source/funkin/ui/debug/char/components/dialogs/gameplay/GhostSettingsDialog.hx @@ -1,4 +1,4 @@ -package funkin.ui.debug.char.components.dialogs; +package funkin.ui.debug.char.components.dialogs.gameplay; import haxe.ui.core.Screen; import haxe.ui.containers.Grid; diff --git a/source/funkin/ui/debug/char/components/dialogs/HealthIconDialog.hx b/source/funkin/ui/debug/char/components/dialogs/gameplay/HealthIconDialog.hx similarity index 99% rename from source/funkin/ui/debug/char/components/dialogs/HealthIconDialog.hx rename to source/funkin/ui/debug/char/components/dialogs/gameplay/HealthIconDialog.hx index 7361738e2d..500c388f09 100644 --- a/source/funkin/ui/debug/char/components/dialogs/HealthIconDialog.hx +++ b/source/funkin/ui/debug/char/components/dialogs/gameplay/HealthIconDialog.hx @@ -1,4 +1,4 @@ -package funkin.ui.debug.char.components.dialogs; +package funkin.ui.debug.char.components.dialogs.gameplay; import funkin.play.components.HealthIcon; import funkin.util.FileUtil; diff --git a/source/funkin/ui/debug/char/components/dialogs/ResultsAnimDialog.hx b/source/funkin/ui/debug/char/components/dialogs/results/ResultsAnimDialog.hx similarity index 99% rename from source/funkin/ui/debug/char/components/dialogs/ResultsAnimDialog.hx rename to source/funkin/ui/debug/char/components/dialogs/results/ResultsAnimDialog.hx index e2717d3b30..201f0503db 100644 --- a/source/funkin/ui/debug/char/components/dialogs/ResultsAnimDialog.hx +++ b/source/funkin/ui/debug/char/components/dialogs/results/ResultsAnimDialog.hx @@ -1,4 +1,4 @@ -package funkin.ui.debug.char.components.dialogs; +package funkin.ui.debug.char.components.dialogs.results; import haxe.ui.containers.VBox; import haxe.ui.containers.HBox; diff --git a/source/funkin/ui/debug/char/components/dialogs/PlayableCharacterSettingsDialog.hx b/source/funkin/ui/debug/char/components/dialogs/select/PlayableCharacterSettingsDialog.hx similarity index 97% rename from source/funkin/ui/debug/char/components/dialogs/PlayableCharacterSettingsDialog.hx rename to source/funkin/ui/debug/char/components/dialogs/select/PlayableCharacterSettingsDialog.hx index a5e67bc535..322ee52975 100644 --- a/source/funkin/ui/debug/char/components/dialogs/PlayableCharacterSettingsDialog.hx +++ b/source/funkin/ui/debug/char/components/dialogs/select/PlayableCharacterSettingsDialog.hx @@ -1,4 +1,4 @@ -package funkin.ui.debug.char.components.dialogs; +package funkin.ui.debug.char.components.dialogs.select; import haxe.ui.containers.HBox; import haxe.ui.components.Button; diff --git a/source/funkin/ui/debug/char/pages/CharCreatorFreeplayPage.hx b/source/funkin/ui/debug/char/pages/CharCreatorFreeplayPage.hx index 478514d598..3324700d2a 100644 --- a/source/funkin/ui/debug/char/pages/CharCreatorFreeplayPage.hx +++ b/source/funkin/ui/debug/char/pages/CharCreatorFreeplayPage.hx @@ -1,6 +1,7 @@ package funkin.ui.debug.char.pages; import haxe.ui.components.Label; +import haxe.ui.components.VerticalRule; import haxe.ui.containers.Box; import haxe.ui.containers.HBox; import haxe.ui.containers.menus.Menu; @@ -10,7 +11,8 @@ import funkin.ui.freeplay.LetterSort; import funkin.ui.freeplay.CapsuleText; import flixel.text.FlxText; import funkin.ui.freeplay.FreeplayState.DifficultySprite; -import funkin.ui.debug.char.components.dialogs.*; +import funkin.ui.debug.char.components.dialogs.freeplay.*; +import funkin.ui.debug.char.components.dialogs.DefaultPageDialog; import funkin.graphics.FunkinSprite; import funkin.ui.freeplay.FreeplayStyle; import funkin.data.animation.AnimationData; @@ -93,6 +95,8 @@ class CharCreatorFreeplayPage extends CharCreatorDefaultPage dj = new CharSelectAtlasSprite(640, 366, null, playuh?.getFreeplayDJData()?.getAtlasPath() != null ? playuh.getFreeplayDJData().getAtlasPath() : null); add(dj); + generateUI(); + if (playuh != null) { @:privateAccess @@ -108,10 +112,16 @@ class CharCreatorFreeplayPage extends CharCreatorDefaultPage { super.update(elapsed); + // no need for handleKeybinds function since these are the only functions in update methinks if (FlxG.keys.justPressed.SPACE) playDJAnimation(); if (FlxG.keys.justPressed.W) changeDJAnimation(-1); if (FlxG.keys.justPressed.S) changeDJAnimation(1); + + if (FlxG.keys.justPressed.UP) changeDJAnimationOffsets(0, 5); + if (FlxG.keys.justPressed.DOWN) changeDJAnimationOffsets(0, -5); + if (FlxG.keys.justPressed.LEFT) changeDJAnimationOffsets(5); + if (FlxG.keys.justPressed.RIGHT) changeDJAnimationOffsets(-5); } public function changeDJAnimation(change:Int = 0) @@ -126,10 +136,25 @@ class CharCreatorFreeplayPage extends CharCreatorDefaultPage function playDJAnimation() { - dj.playAnimation(djAnims[currentDJAnimation].prefix); + labelAnimName.text = djAnims[currentDJAnimation].name; + labelAnimOffsetX.text = "" + (djAnims[currentDJAnimation].offsets[0] ?? 0.0); + labelAnimOffsetY.text = "" + (djAnims[currentDJAnimation].offsets[1] ?? 0.0); + + dj.playAnimation(djAnims[currentDJAnimation].prefix, true); dj.offset.set(djAnims[currentDJAnimation].offsets[0] ?? 0.0, djAnims[currentDJAnimation].offsets[1] ?? 0.0); } + function changeDJAnimationOffsets(xOff:Float = 0, yOff:Float = 0) + { + if (currentDJAnimation >= djAnims.length) return; // this should in theory detect if we have dj animations loaded from an imported character + if (djAnims[currentDJAnimation].offsets.length < 2) djAnims[currentDJAnimation].offsets = [0.0, 0.0]; + + djAnims[currentDJAnimation].offsets[0] += xOff; + djAnims[currentDJAnimation].offsets[1] += yOff; + + playDJAnimation(); + } + override public function fillUpPageSettings(menu:Menu) { var settingsDialog = new MenuCheckBox(); @@ -149,6 +174,44 @@ class CharCreatorFreeplayPage extends CharCreatorDefaultPage } } + var labelAnimName:Label = new Label(); + var labelAnimOffsetX:Label = new Label(); + var labelAnimOffsetY:Label = new Label(); + + function generateUI() + { + labelAnimName.styleNames = labelAnimOffsetX.styleNames = labelAnimOffsetY.styleNames = "infoText"; + labelAnimName.verticalAlign = labelAnimOffsetX.verticalAlign = labelAnimOffsetY.verticalAlign = "center"; + + labelAnimName.tooltip = "Left/Right Click to play the Next/Previous Animation"; + labelAnimOffsetX.tooltip = "Left/Right Click to Increase/Decrease the Horizontal Offset."; + labelAnimOffsetY.tooltip = "Left/Right Click to Increase/Decrease the Vertical Offset."; + + labelAnimName.text = "None"; + labelAnimOffsetX.text = labelAnimOffsetY.text = "0"; + + labelAnimName.onClick = _ -> changeDJAnimation(1); + labelAnimName.onRightClick = _ -> changeDJAnimation(-1); + + labelAnimOffsetX.onClick = _ -> changeDJAnimationOffsets(5); + labelAnimOffsetX.onRightClick = _ -> changeDJAnimationOffsets(-5); + labelAnimOffsetY.onClick = _ -> changeDJAnimationOffsets(0, 5); + labelAnimOffsetY.onRightClick = _ -> changeDJAnimationOffsets(0, -5); + } + + override public function fillUpBottomBar(left:Box, middle:Box, right:Box) + { + var rule1 = new VerticalRule(); + var rule2 = new VerticalRule(); + rule1.percentHeight = rule2.percentHeight = 80; + + middle.addComponent(labelAnimName); + middle.addComponent(rule1); + middle.addComponent(labelAnimOffsetX); + middle.addComponent(rule2); + middle.addComponent(labelAnimOffsetY); + } + var pinkBack:FunkinSprite; var orangeBackShit:FunkinSprite; diff --git a/source/funkin/ui/debug/char/pages/CharCreatorGameplayPage.hx b/source/funkin/ui/debug/char/pages/CharCreatorGameplayPage.hx index e3912a793c..1e834a4599 100644 --- a/source/funkin/ui/debug/char/pages/CharCreatorGameplayPage.hx +++ b/source/funkin/ui/debug/char/pages/CharCreatorGameplayPage.hx @@ -14,7 +14,8 @@ import funkin.data.character.CharacterRegistry; import funkin.play.character.BaseCharacter.CharacterType; import funkin.play.stage.StageProp; import funkin.data.stage.StageRegistry; -import funkin.ui.debug.char.components.dialogs.*; +import funkin.ui.debug.char.components.dialogs.gameplay.*; +import funkin.ui.debug.char.components.dialogs.DefaultPageDialog; import flixel.util.FlxColor; using StringTools; diff --git a/source/funkin/ui/debug/char/pages/CharCreatorResultsPage.hx b/source/funkin/ui/debug/char/pages/CharCreatorResultsPage.hx index 718055e311..500215828a 100644 --- a/source/funkin/ui/debug/char/pages/CharCreatorResultsPage.hx +++ b/source/funkin/ui/debug/char/pages/CharCreatorResultsPage.hx @@ -10,7 +10,8 @@ import haxe.ui.containers.menus.MenuItem; import haxe.ui.containers.menus.MenuCheckBox; import funkin.graphics.adobeanimate.FlxAtlasSprite; import funkin.graphics.FunkinSprite; -import funkin.ui.debug.char.components.dialogs.*; +import funkin.ui.debug.char.components.dialogs.results.*; +import funkin.ui.debug.char.components.dialogs.DefaultPageDialog; import funkin.data.freeplay.player.PlayerRegistry; import funkin.play.components.TallyCounter; import funkin.play.components.ClearPercentCounter; diff --git a/source/funkin/ui/debug/char/pages/CharCreatorSelectPage.hx b/source/funkin/ui/debug/char/pages/CharCreatorSelectPage.hx index e507fac692..cde3695fcf 100644 --- a/source/funkin/ui/debug/char/pages/CharCreatorSelectPage.hx +++ b/source/funkin/ui/debug/char/pages/CharCreatorSelectPage.hx @@ -13,7 +13,8 @@ import funkin.graphics.FunkinSprite; import funkin.graphics.shaders.MosaicEffect; import funkin.ui.debug.char.animate.CharSelectAtlasSprite; import funkin.ui.debug.char.pages.subpages.CharSelectIndexSubPage; -import funkin.ui.debug.char.components.dialogs.*; +import funkin.ui.debug.char.components.dialogs.select.*; +import funkin.ui.debug.char.components.dialogs.DefaultPageDialog; import funkin.util.FileUtil; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import flixel.group.FlxSpriteGroup;