This commit is contained in:
lunarcleint
2024-04-23 19:44:43 -07:00
parent f0ef31313c
commit ef532885ce
5 changed files with 62 additions and 13 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

@@ -20,6 +20,17 @@ class CharacterAnimButton extends UIButton {
public var indicesTextBox:UITextBox;
public var XYComma:UIText;
public var editButton:FlxSprite;
public var editIcon:FlxSprite;
public var deleteButton:UIButton;
public var deleteIcon:FlxSprite;
public var ghostButton:UIButton;
public var ghostIcon:FlxSprite;
public var tempOpenButton:UIButton;
public var labels:Map<UISprite, UIText> = [];
public function new(x:Float, y:Float, animData:AnimData, parent:CharacterAnimsWindow) {
@@ -28,7 +39,7 @@ class CharacterAnimButton extends UIButton {
this.parent = parent;
super(x,y, '${animData.name} (${animData.x}, ${animData.y})', function () {
CharacterEditor.instance.playAnimation(this.anim);
}, Std.int(500-16-32), 184);
}, Std.int(500-16-32), 208);
function addLabelOn(ui:UISprite, text:String, ?size:Int):UIText {
var uiText:UIText = new UIText(ui.x, ui.y-18, 0, text, size);
@@ -40,7 +51,8 @@ class CharacterAnimButton extends UIButton {
frames = Paths.getFrames('editors/ui/inputbox');
field.fieldWidth = 0; framesOffset = 9;
field.visible = false;
field.size = 14;
// field.visible = false;
animationDisplayBG = new UISliceSprite(x+12, y+12+18+12, 128, 128, 'editors/ui/inputbox-small');
members.push(animationDisplayBG);
@@ -75,23 +87,60 @@ class CharacterAnimButton extends UIButton {
indicesTextBox = new UITextBox(nameTextBox.x, nameTextBox.y, animData.indices.getDefault([]).join(","), 278, 22, false, true);
members.push(indicesTextBox);
addLabelOn(indicesTextBox, "Indices (frames)", 12);
editIcon = new FlxSprite().loadGraphic(Paths.image('editors/character/edit-button'), true, 16, 16);
editIcon.animation.add("open", [0]);
editIcon.animation.add("closed", [1]);
editIcon.animation.play("closed");
editIcon.antialiasing = false;
editIcon.updateHitbox();
members.push(editIcon);
deleteButton = new UIButton(0, 0, "", null, 28*2,24);
deleteButton.color = 0xFFAC3D3D;
members.push(deleteButton);
deleteIcon = new FlxSprite(x-(10+16), y+8).loadGraphic(Paths.image("editors/deleter"));
deleteIcon.color = 0xFFD60E0E;
deleteIcon.antialiasing = false;
members.push(deleteIcon);
ghostButton = new UIButton(0, 0, "", null, 28,24);
ghostButton.color = 0xFFADADAD;
ghostButton.alpha = 0.5;
members.push(ghostButton);
ghostIcon = new FlxSprite(x-(10+16), y+8).loadGraphic(Paths.image('editors/character/ghost'), true, 16, 12);
ghostIcon.animation.add("alive", [0]);
ghostIcon.animation.add("dead", [1]);
ghostIcon.animation.play("dead");
ghostIcon.antialiasing = false;
ghostIcon.updateHitbox();
members.push(ghostIcon);
}
public override function update(elapsed:Float) {
field.follow(this, 20, 12);
editIcon.follow(this, 22, 18);
field.follow(this, 22+16+8, 17);
animationDisplayBG.follow(this, 16, 12+18+11);
nameTextBox.follow(this, 14+128+16, 12+18+8+14);
animTextBox.follow(this, 14+128+12+116+20, 12+18+8+14);
deleteButton.follow(this, (500-16-32)-16-(28*2), 14);
deleteIcon.follow(deleteButton, (deleteButton.bWidth/2)-6.5, (deleteButton.bHeight/2)-6);
positionXStepper.follow(this, 14+128+16, 12+18+8+10+24+26);
positionYStepper.follow(this, 14+128+16+64-32+28, 12+18+8+10+24+26);
ghostButton.follow(this, (500-16-32)-16-(28*2)-16-28, 14);
ghostIcon.follow(ghostButton, (ghostButton.bWidth/2)-8, (ghostButton.bHeight/2)-6);
animationDisplayBG.follow(this, 16, 8+32+8+2+11);
nameTextBox.follow(this, 14+128+16, 8+32+8+2+8+14);
animTextBox.follow(this, 14+128+12+116+20, 8+32+8+2+8+14);
positionXStepper.follow(this, 14+128+16, 8+32+8+2+8+10+24+26);
positionYStepper.follow(this, 14+128+16+64-32+28, 8+32+8+2+8+10+24+26);
XYComma.follow(positionXStepper, 64-24, 6);
fpsStepper.follow(this, 14+128+16+64-32+28+64-22+20, 12+18+8+10+24+26);
loopedCheckbox.follow(this, 14+128+16+64-32+28+64-22+20+52-22+18+8, 12+18+8+10+24+32);
fpsStepper.follow(this, 14+128+16+64-32+28+64-22+20, 8+32+8+2+8+10+24+26);
loopedCheckbox.follow(this, 14+128+16+64-32+28+64-22+20+52-22+18+8, 8+32+8+2+8+10+24+32);
indicesTextBox.follow(this, 14+128+16, 12+18+8+10+24+26+24+22);
indicesTextBox.follow(this, 14+128+16, 8+32+8+2+8+10+24+26+24+22);
for (ui => text in labels)
text.follow(ui, -(2+(ui is UICheckbox?12:0)), -(18+(ui is UICheckbox?6:0)));
@@ -113,7 +162,7 @@ class CharacterAnimButton extends UIButton {
parent.displayWindowSprite.follow(
this, 16+(128/2)-((parent.displayWindowSprite.frame.sourceSize.x*displayData.scale)/2),
12+18+11+(128/2)-((parent.displayWindowSprite.frame.sourceSize.y*displayData.scale)/2)
8+32+8+2+11+(128/2)-((parent.displayWindowSprite.frame.sourceSize.y*displayData.scale)/2)
);
parent.displayWindowSprite.draw();
}
@@ -15,7 +15,7 @@ class CharacterAnimsWindow extends UIButtonList<CharacterAnimButton> {
public var displayAnimsFramesList:Map<String, {scale:Float, animBounds:Rectangle, frame:Int}> = [];
public function new(x:Float, y:Float, character:Character) {
super(x, y, Std.int(500-16), 419, "", FlxPoint.get(Std.int(500-16-32), 184));
super(x, y, Std.int(500-16), 419, "", FlxPoint.get(Std.int(500-16-32), 208));
cameraSpacing = 0;
frames = Paths.getFrames('editors/ui/inputbox');