cancel button on the create strum thing
This commit is contained in:
@@ -54,7 +54,7 @@ class Charter extends UIState {
|
||||
public var topLimit:FlxSprite;
|
||||
|
||||
public var strumlineInfoBG:FlxSprite;
|
||||
public var strumlineAddButton:CharterStrumlineAddButton;
|
||||
public var strumlineAddButton:CharterStrumlineExtraButton;
|
||||
|
||||
public var hitsound:FlxSound;
|
||||
public var metronome:FlxSound;
|
||||
@@ -388,7 +388,8 @@ class Charter extends UIState {
|
||||
strumlineInfoBG.y = 23;
|
||||
strumlineInfoBG.scrollFactor.set();
|
||||
|
||||
strumlineAddButton = new CharterStrumlineAddButton();
|
||||
strumlineAddButton = new CharterStrumlineExtraButton("editors/charter/add-strumline", "Add New");
|
||||
strumlineAddButton.onClick = createStrumWithUI;
|
||||
|
||||
strumlineAddButton.cameras = [charterCamera];
|
||||
strumlineInfoBG.cameras = [charterCamera];
|
||||
@@ -752,7 +753,7 @@ class Charter extends UIState {
|
||||
|
||||
public function createStrumWithUI() {
|
||||
FlxG.state.openSubState(new CharterStrumlineScreen(strumLines.members.length, null, (_) -> {
|
||||
createStrumline(strumLines.members.length, _);
|
||||
if (_ != null) createStrumline(strumLines.members.length, _);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import flixel.math.FlxPoint;
|
||||
|
||||
class CharterStrumlineAddButton extends UISprite {
|
||||
public var addButton:UISprite;
|
||||
public var addText:UIText;
|
||||
|
||||
public override function new(?x:Float, ?y:Float) {
|
||||
super();
|
||||
|
||||
scrollFactor.set(1, 0);
|
||||
alpha = 0;
|
||||
|
||||
addButton = new UISprite();
|
||||
addButton.loadGraphic(Paths.image("editors/charter/add-strumline"));
|
||||
addButton.scale.set(0.75,0.75);
|
||||
addButton.updateHitbox();
|
||||
addButton.antialiasing = false;
|
||||
members.push(addButton);
|
||||
|
||||
addText = new UIText(0,0, 160, "Add New");
|
||||
addText.alignment = CENTER;
|
||||
members.push(addText);
|
||||
}
|
||||
|
||||
var addButtonScale:FlxPoint = FlxPoint.get(0,0);
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
addButton.follow(this, ((40 * 4) - addButton.width) / 2, 18);
|
||||
addText.follow(this, 0, 84);
|
||||
|
||||
super.update(elapsed);
|
||||
|
||||
addButton.__rect.x = addButton.x;
|
||||
addButton.__rect.y = addButton.y;
|
||||
addButton.__rect.width = addButton.width;
|
||||
addButton.__rect.height = addButton.height;
|
||||
if(UIState.state.isOverlapping(addButton, addButton.__rect)) {
|
||||
addButtonScale.set(0.85, 0.85);
|
||||
if (FlxG.mouse.justReleased) Charter.instance.createStrumWithUI();
|
||||
}
|
||||
else addButtonScale.set(0.75, 0.75);
|
||||
|
||||
addButton.scale.set(
|
||||
FlxMath.lerp(addButton.scale.x, addButtonScale.x, 1/6),
|
||||
FlxMath.lerp(addButton.scale.y, addButtonScale.y, 1/6)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import flixel.math.FlxPoint;
|
||||
|
||||
class CharterStrumlineExtraButton extends UISprite {
|
||||
public var button:UISprite;
|
||||
public var text:UIText;
|
||||
|
||||
public var onClick:Void->Void;
|
||||
|
||||
public override function new(imagePath:String, text:String) {
|
||||
super();
|
||||
|
||||
scrollFactor.set(1, 0);
|
||||
alpha = 0;
|
||||
|
||||
button = new UISprite();
|
||||
button.loadGraphic(Paths.image(imagePath));
|
||||
button.scale.set(0.75,0.75);
|
||||
button.updateHitbox();
|
||||
button.antialiasing = false;
|
||||
members.push(button);
|
||||
|
||||
this.text = new UIText(0,0, 160, text);
|
||||
this.text.alignment = CENTER;
|
||||
members.push(this.text);
|
||||
}
|
||||
|
||||
var buttonScale:FlxPoint = FlxPoint.get(0,0);
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
button.follow(this, ((40 * 4) - button.width) / 2, 18);
|
||||
text.follow(this, 0, 84);
|
||||
|
||||
super.update(elapsed);
|
||||
|
||||
button.__rect.x = button.x;
|
||||
button.__rect.y = button.y;
|
||||
button.__rect.width = button.width;
|
||||
button.__rect.height = button.height;
|
||||
if(UIState.state.isOverlapping(button, button.__rect)) {
|
||||
buttonScale.set(0.85, 0.85);
|
||||
if (FlxG.mouse.justReleased && onClick != null) onClick();
|
||||
}
|
||||
else buttonScale.set(0.75, 0.75);
|
||||
|
||||
button.scale.set(
|
||||
FlxMath.lerp(button.scale.x, buttonScale.x, 1/6),
|
||||
FlxMath.lerp(button.scale.y, buttonScale.y, 1/6)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -100,13 +100,12 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
}, 125);
|
||||
add(saveButton);
|
||||
|
||||
if (!creatingStrumLine) {
|
||||
closeButton = new UIButton(saveButton.x - 20, saveButton.y, "Close", function() {
|
||||
close();
|
||||
}, 125);
|
||||
add(closeButton);
|
||||
closeButton.x -= closeButton.bWidth;
|
||||
}
|
||||
closeButton = new UIButton(saveButton.x - 20, saveButton.y, creatingStrumLine ? "Cancel" : "Close", function() {
|
||||
if (creatingStrumLine) onSave(null);
|
||||
close();
|
||||
}, 125);
|
||||
add(closeButton);
|
||||
closeButton.x -= closeButton.bWidth;
|
||||
}
|
||||
|
||||
function updateCharacterIcons(characters:Array<String>) {
|
||||
|
||||
Reference in New Issue
Block a user