From 9db319b23f3b92099fe6ea47969b36e6d418f0f2 Mon Sep 17 00:00:00 2001 From: lemz1 Date: Mon, 18 Nov 2024 21:35:08 +0100 Subject: [PATCH] rank animation data class --- assets | 2 +- .../components/dialogs/ResultsAnimDialog.hx | 88 +++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/assets b/assets index b91a69336a..491c11dca3 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit b91a69336adcc1f478ebb4c85bf1af612e8dd9dc +Subproject commit 491c11dca36d6fc509f32aa1f7305f3d62d97945 diff --git a/source/funkin/ui/debug/char/components/dialogs/ResultsAnimDialog.hx b/source/funkin/ui/debug/char/components/dialogs/ResultsAnimDialog.hx index 4c58e340bc..9552dfbef7 100644 --- a/source/funkin/ui/debug/char/components/dialogs/ResultsAnimDialog.hx +++ b/source/funkin/ui/debug/char/components/dialogs/ResultsAnimDialog.hx @@ -1,5 +1,9 @@ package funkin.ui.debug.char.components.dialogs; +import haxe.ui.containers.VBox; +import haxe.ui.containers.HBox; +import haxe.ui.components.Button; + @:build(haxe.ui.macros.ComponentMacros.build("assets/exclude/data/ui/char-creator/dialogs/results-anim-dialog.xml")) class ResultsAnimDialog extends DefaultPageDialog { @@ -10,6 +14,90 @@ class ResultsAnimDialog extends DefaultPageDialog rankDropdown.onChange = function(_) { } + rankAnimationView.addComponent(new AddRankAnimationDataBox()); + } +} + +private class AddRankAnimationDataBox extends HBox +{ + public function new() + { + super(); + + styleString = "border:1px solid $normal-border-color"; + percentWidth = 100; + height = 25; + verticalAlign = "center"; + + var addButton = new Button(); + addButton.text = "Add New Box"; + var removeButton = new Button(); + removeButton.text = "Remove Last Box"; + + addButton.percentWidth = removeButton.percentWidth = 50; + addButton.percentHeight = removeButton.percentHeight = 100; + + addButton.onClick = function(_) { + var parentList = this.parentComponent; + if (parentList == null) return; + + parentList.addComponentAt(new RankAnimationData(), parentList.childComponents.length - 1); // considering this box is last + removeButton.disabled = false; + } + + removeButton.disabled = true; + removeButton.onClick = function(_) { + var parentList = this.parentComponent; + if (parentList == null) return; + + parentList.removeComponentAt(parentList.childComponents.length - 2); + if (parentList.childComponents.length <= 2) removeButton.disabled = true; + } + + addComponent(addButton); + addComponent(removeButton); + } +} + +@:xml(' + + + + + + + + + + + + + + + + + + + + + + + + + + + +') +private class RankAnimationData extends VBox +{ + public function new() + { + super(); + animStartFrameLabelCheck.onClick = function(_) { animStartFrameLabel.disabled = !animStartFrameLabelCheck.selected; }