some new assets (not warnings)
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 611 B |
Binary file not shown.
|
Before Width: | Height: | Size: 949 B After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 588 B |
@@ -401,12 +401,17 @@ class Charter extends UIState {
|
||||
strumlineInfoBG.y = 23;
|
||||
strumlineInfoBG.scrollFactor.set();
|
||||
|
||||
strumlineAddButton = new CharterStrumlineButton("editors/charter/add-strumline", "Create New");
|
||||
strumlineAddButton = new CharterStrumlineButton("editors/new", "Create New");
|
||||
strumlineAddButton.onClick = createStrumWithUI;
|
||||
strumlineAddButton.animationOnClick = false;
|
||||
strumlineAddButton.textColorLerp = 0.5;
|
||||
|
||||
strumlineLockButton = new CharterStrumlineButton("editors/charter/lock-strumline", "Lock/Unlock");
|
||||
strumlineLockButton.onClick = function () {
|
||||
if (strumLines != null) strumLines.draggable = !strumLines.draggable;
|
||||
if (strumLines != null) {
|
||||
strumLines.draggable = !strumLines.draggable;
|
||||
strumlineLockButton.textTweenColor.color = strumLines.draggable ? 0xFF5C95CA : 0xFFE16565;
|
||||
}
|
||||
};
|
||||
|
||||
strumlineAddButton.cameras = strumlineLockButton.cameras = [charterCamera];
|
||||
@@ -899,7 +904,12 @@ class Charter extends UIState {
|
||||
|
||||
public function createStrumWithUI() {
|
||||
FlxG.state.openSubState(new CharterStrumlineScreen(strumLines.members.length, null, (_) -> {
|
||||
if (_ != null) createStrumline(strumLines.members.length, _);
|
||||
if (_ != null) {
|
||||
createStrumline(strumLines.members.length, _);
|
||||
|
||||
strumlineAddButton.textTweenColor.color = 0xFF00FF00;
|
||||
strumlineAddButton.pressAnimation(true);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -1025,6 +1035,9 @@ class Charter extends UIState {
|
||||
if (charterCamera.zoom != (charterCamera.zoom = lerp(charterCamera.zoom, __camZoom, __firstFrame ? 1 : 0.125)))
|
||||
updateDisplaySprites();
|
||||
|
||||
if (strumLines != null)
|
||||
strumlineLockButton.button.animation.play(strumLines.draggable ? "1" : "0", true);
|
||||
|
||||
WindowUtils.prefix = undos.unsaved ? "* " : "";
|
||||
SaveWarning.showWarning = undos.unsaved;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import flixel.tweens.FlxTween;
|
||||
import flixel.math.FlxPoint;
|
||||
|
||||
class CharterStrumlineButton extends UISprite {
|
||||
@@ -7,6 +8,7 @@ class CharterStrumlineButton extends UISprite {
|
||||
public var text:UIText;
|
||||
|
||||
public var onClick:Void->Void;
|
||||
public var animationOnClick:Bool = true;
|
||||
|
||||
public override function new(imagePath:String, text:String) {
|
||||
super();
|
||||
@@ -15,7 +17,10 @@ class CharterStrumlineButton extends UISprite {
|
||||
alpha = 0;
|
||||
|
||||
button = new UISprite();
|
||||
button.loadGraphic(Paths.image(imagePath));
|
||||
button.loadGraphic(Paths.image(imagePath), true, 71, 71);
|
||||
for(i in 0...button.frames.frames.length)
|
||||
button.animation.add(Std.string(i), [i]);
|
||||
button.animation.play("0", true);
|
||||
button.scale.set(0.85,0.85);
|
||||
button.updateHitbox();
|
||||
button.antialiasing = false;
|
||||
@@ -25,20 +30,41 @@ class CharterStrumlineButton extends UISprite {
|
||||
this.text = new UIText(0,0, 160, text);
|
||||
this.text.alignment = CENTER;
|
||||
members.push(this.text);
|
||||
|
||||
textTweenColor = new FlxInterpolateColor(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
var buttonScale:FlxPoint = FlxPoint.get(0,0);
|
||||
var buttonScaleOffset:FlxPoint = FlxPoint.get(0,0);
|
||||
|
||||
var buttonYOffset:Float = 0;
|
||||
var jumpTween:FlxTween;
|
||||
var scaleTween:FlxTween;
|
||||
var angleTween:FlxTween;
|
||||
|
||||
var shakeTimer:Float = 0;
|
||||
|
||||
public var textTweenColor:FlxInterpolateColor;
|
||||
public var textColorLerp:Float = 1;
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
button.follow(this, ((40 * 4) - button.width) / 2, 20);
|
||||
button.follow(this, ((40 * 4) - button.width) / 2, 20+buttonYOffset);
|
||||
text.follow(this, 0, 84);
|
||||
|
||||
shakeTimer -= elapsed;
|
||||
if (shakeTimer > 0)
|
||||
for (spr in [button, text])
|
||||
{spr.x += FlxG.random.float(0, 3); spr.y += FlxG.random.float(0, 3);}
|
||||
|
||||
super.update(elapsed);
|
||||
|
||||
UIState.state.updateSpriteRect(button);
|
||||
if(UIState.state.isOverlapping(button, button.__rect)) {
|
||||
buttonScale.set(0.95, 0.95);
|
||||
if (FlxG.mouse.justReleased && onClick != null) onClick();
|
||||
if (FlxG.mouse.justReleased && onClick != null) {
|
||||
onClick();
|
||||
if (animationOnClick) pressAnimation();
|
||||
}
|
||||
}
|
||||
else buttonScale.set(0.85, 0.85);
|
||||
|
||||
@@ -46,11 +72,33 @@ class CharterStrumlineButton extends UISprite {
|
||||
FlxMath.lerp(button.scale.x, buttonScale.x, 1/6),
|
||||
FlxMath.lerp(button.scale.y, buttonScale.y, 1/6)
|
||||
);
|
||||
button.scale += buttonScaleOffset;
|
||||
|
||||
textTweenColor.fpsLerpTo(0xFFFFFFFF, (1/20) * textColorLerp);
|
||||
text.color = textTweenColor.color;
|
||||
}
|
||||
|
||||
public override function destroy() {
|
||||
super.destroy();
|
||||
|
||||
buttonScale.put();
|
||||
buttonScaleOffset.put();
|
||||
}
|
||||
|
||||
public function pressAnimation(extra:Bool = false) {
|
||||
shakeTimer = 0.14;
|
||||
|
||||
if (jumpTween != null) jumpTween.cancel(); buttonYOffset = 0;
|
||||
jumpTween = FlxTween.tween(this, {buttonYOffset: -10 + FlxG.random.float(-2, 2) + (extra ? -8 : 0)}, .12, {ease: FlxEase.circOut})
|
||||
.then(FlxTween.tween(this, {buttonYOffset: 0}, .1 + FlxG.random.float(.1, .3), {ease: FlxEase.circIn}));
|
||||
|
||||
if (scaleTween != null) scaleTween.cancel(); buttonScaleOffset.set(0,0);
|
||||
scaleTween = FlxTween.tween(buttonScaleOffset, {x: .015, y: .02}, .12, {ease: FlxEase.circOut})
|
||||
.then(FlxTween.tween(buttonScaleOffset, {x: 0, y: 0}, .1 + FlxG.random.float(.1, .3), {ease: FlxEase.circIn}));
|
||||
|
||||
if (!extra) return;
|
||||
|
||||
if (angleTween != null) angleTween.cancel(); button.angle = 0;
|
||||
angleTween = FlxTween.tween(button, {angle: 360}, .5, {ease: FlxEase.circInOut});
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ class NewOption extends TextOption {
|
||||
|
||||
iconSpr = new FlxSprite().loadGraphic(Paths.image("editors/new"));
|
||||
iconSpr.setPosition(90 - iconSpr.width, (__text.height - iconSpr.height) / 2);
|
||||
iconSpr.scale.set(1.4, 1.4);
|
||||
iconSpr.updateHitbox();
|
||||
iconSpr.offset.set(20, -15);
|
||||
add(iconSpr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user