Skip to content

Commit

Permalink
rank animation data class
Browse files Browse the repository at this point in the history
  • Loading branch information
lemz1 committed Nov 18, 2024
1 parent 31ce73f commit 9db319b
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assets
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -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('
<?xml version="1.0" encoding="utf-8"?>
<vbox width="100%" style="border:1px solid $normal-border-color; padding: 5px">
<dropdown id="animRenderType" width="100%" height="25" dropdownHeight="50">
<data>
<item text="Animate Atlas" value="animateatlas"/>
<item text="Sparrow" value="sparrow"/>
</data>
</dropdown>
<textfield id="animAssetPath" placeholder="Asset Path" width="100%"/>
<hbox width="100%" verticalAlign="center">
<label text="Delay" verticalAlign="center"/>
<number-stepper id="animDelay" min="0" step="0.1" verticalAlign="center"/>
</hbox>
<hbox width="100%" verticalAlign="center">
<label text="Scale" verticalAlign="center"/>
<number-stepper id="animScale" min="0" step="0.1" pos="1" verticalAlign="center"/>
</hbox>
<checkbox id="animLooped" text="Looped"/>
<hbox width="100%" verticalAlign="center">
<checkbox id="animStartFrameLabelCheck" text="Start Frame Label" verticalAlign="center"/>
<textfield id="animStartFrameLabel" placeholder="Frame Label" disabled="true" verticalAlign="center"/>
</hbox>
<hbox width="100%" verticalAlign="center">
<checkbox id="animLoopFrameCheck" text="Loop Frame" verticalAlign="center"/>
<number-stepper id="animLoopFrame" min="0" step="1" disabled="true" verticalAlign="center"/>
</hbox>
<hbox width="100%" verticalAlign="center">
<checkbox id="animLoopFrameLabelCheck" text="Loop Frame Label" verticalAlign="center"/>
<textfield id="animLoopFrameLabel" placeholder="Loop Frame Label" disabled="true" verticalAlign="center"/>
</hbox>
</vbox>
')
private class RankAnimationData extends VBox
{
public function new()
{
super();

animStartFrameLabelCheck.onClick = function(_) {
animStartFrameLabel.disabled = !animStartFrameLabelCheck.selected;
}
Expand Down

0 comments on commit 9db319b

Please sign in to comment.