remove hover note for now
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB |
@@ -1,66 +0,0 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import flixel.tweens.misc.VarTween;
|
||||
import flixel.tweens.FlxTween;
|
||||
|
||||
class ChartHoverNote extends UISprite {
|
||||
public var angleTween:FlxTween;
|
||||
|
||||
public var onGrid:Bool = false;
|
||||
public var id:Int = 0;
|
||||
public var nextID:Int = 0;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
antialiasing = true;
|
||||
loadGraphic(Paths.image('editors/charter/note'), true, 157, 154);
|
||||
animation.add("note", [for(i in 0...frames.frames.length) i], 0, true);
|
||||
animation.play("note");
|
||||
this.setUnstretchedGraphicSize(40, 40, false);
|
||||
|
||||
moves = selectable = false;
|
||||
colorTransform.color = 0xFFFFFF;
|
||||
}
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
super.update(elapsed);
|
||||
|
||||
var mousePos = FlxG.mouse.getWorldPosition(__lastDrawCameras[0]);
|
||||
alpha = FlxMath.lerp(alpha, onGrid ? 0.2 : 0, 1/8);
|
||||
id = Math.floor(x / 40);
|
||||
|
||||
if (onGrid) {
|
||||
Charter.instance.gridBackdropDummy.cursor = BUTTON;
|
||||
x = (nextID = Math.floor(mousePos.x / 40)) * 40;
|
||||
y = (FlxG.keys.pressed.SHIFT ? (mousePos.y / 40) : Math.floor(mousePos.y / 40)) * 40;
|
||||
|
||||
if (id != nextID) {
|
||||
if (angleTween != null) angleTween.cancel();
|
||||
|
||||
angle = switch(id % 4) {
|
||||
case 0: -90;
|
||||
case 1: 180;
|
||||
case 2: 0;
|
||||
case 3: 90;
|
||||
default: 0; // how is that even possible
|
||||
};
|
||||
|
||||
var destAngle = switch((nextID % 4)) {
|
||||
case 0: -90;
|
||||
case 1: 180;
|
||||
case 2: 0;
|
||||
case 3: 90;
|
||||
default: 0; // how is that even possible
|
||||
};
|
||||
|
||||
angleTween = FlxTween.tween(this, {angle: destAngle}, 2/3, {ease: function(t) {
|
||||
return ((Math.sin(t * Math.PI) * 0.35) * 3 * t * Math.sqrt(1 - t)) + t;
|
||||
}, onComplete: function (t) {angleTween = null;}});
|
||||
}
|
||||
} else if (alpha > 0) {
|
||||
Charter.instance.gridBackdropDummy.cursor = ARROW;
|
||||
x = mousePos.x - 20; y = mousePos.y -20;
|
||||
}
|
||||
mousePos.put();
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,6 @@ class Charter extends UIState {
|
||||
public var topLimit:FlxSprite;
|
||||
public var bottomLimit:FlxSprite;
|
||||
public var bottomSeparator:FlxSprite;
|
||||
public var hoverNote:ChartHoverNote;
|
||||
|
||||
public var strumlineInfoBG:FlxSprite;
|
||||
public var strumlineAddButton:CharterStrumlineExtraButton;
|
||||
@@ -353,9 +352,6 @@ class Charter extends UIState {
|
||||
eventsBackdrop.cameras = [charterCamera];
|
||||
add(eventsBackdrop);
|
||||
|
||||
hoverNote = new ChartHoverNote();
|
||||
hoverNote.cameras = [charterCamera];
|
||||
|
||||
add(gridBackdropDummy = new CharterBackdropDummy(gridBackdrop));
|
||||
sectionSeparator = new FlxBackdrop(null, Y, 0, 0);
|
||||
sectionSeparator.x = -20;
|
||||
@@ -435,7 +431,6 @@ class Charter extends UIState {
|
||||
|
||||
// adds grid and notes so that they're ALWAYS behind the UI
|
||||
add(gridBackdrop);
|
||||
add(hoverNote);
|
||||
add(sectionSeparator);
|
||||
add(beatSeparator);
|
||||
add(addEventSpr);
|
||||
@@ -564,7 +559,6 @@ class Charter extends UIState {
|
||||
if (!gridBackdropDummy.hoveredByChild && !FlxG.mouse.pressed)
|
||||
gridActionType = NONE;
|
||||
selectionBox.visible = false;
|
||||
hoverNote.onGrid = false;
|
||||
switch(gridActionType) {
|
||||
case BOX:
|
||||
if (gridBackdropDummy.hoveredByChild) {
|
||||
@@ -643,8 +637,6 @@ class Charter extends UIState {
|
||||
if (FlxG.mouse.justPressed)
|
||||
FlxG.mouse.getWorldPosition(charterCamera, dragStartPos);
|
||||
|
||||
hoverNote.visible = hoveredSprite != null ? hoveredSprite is CharterNote : true;
|
||||
|
||||
if (gridBackdropDummy.hovered) {
|
||||
// AUTO DETECT
|
||||
if (FlxG.mouse.pressed && (Math.abs(mousePos.x - dragStartPos.x) > 20 || Math.abs(mousePos.y - dragStartPos.y) > 20))
|
||||
@@ -653,8 +645,6 @@ class Charter extends UIState {
|
||||
var id = Math.floor(mousePos.x / 40);
|
||||
var mouseOnGrid = id >= 0 && id < 4 * gridBackdrop.strumlinesAmount && mousePos.y >= 0;
|
||||
|
||||
hoverNote.onGrid = mouseOnGrid;
|
||||
|
||||
if (FlxG.mouse.justReleased) {
|
||||
if (selection.length > 1) {
|
||||
selection = []; // clear selection
|
||||
@@ -1021,16 +1011,16 @@ class Charter extends UIState {
|
||||
#if REGION
|
||||
function _file_exit(_) {
|
||||
if (undos.unsaved) {
|
||||
FlxG.state.openSubState(new UIWarningSubstate("Unsaved Changes", "Your changes will be lost if you don't save them.", [
|
||||
FlxG.state.openSubState(new UIWarningSubstate("Unsaved Changes", "Your changes will be lost if you don't save them. (Can't be recovered)\n\n\nWould you like to Cancel?", [
|
||||
{
|
||||
label: "Exit",
|
||||
label: "Exit To Menu",
|
||||
onClick: function(_) FlxG.switchState(new CharterSelection())
|
||||
},
|
||||
{
|
||||
label: "Cancel",
|
||||
onClick: function (_) {}
|
||||
}
|
||||
]));
|
||||
], false));
|
||||
} else
|
||||
FlxG.switchState(new CharterSelection());
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ class UIWarningSubstate extends MusicBeatSubstate {
|
||||
var title:String;
|
||||
var message:String;
|
||||
var buttons:Array<WarningButton>;
|
||||
var isError:Bool = true;
|
||||
|
||||
var titleSpr:UIText;
|
||||
var messageSpr:UIText;
|
||||
@@ -55,19 +56,23 @@ class UIWarningSubstate extends MusicBeatSubstate {
|
||||
warnCam.zoom = 0.1;
|
||||
FlxG.cameras.add(warnCam, false);
|
||||
|
||||
var spr = new UISliceSprite(0, 0, CoolUtil.maxInt(560, 30 + (170 * buttons.length)), 280, "editors/ui/warning-popup");
|
||||
var spr = new UISliceSprite(0, 0, CoolUtil.maxInt(560, 30 + (170 * buttons.length)), 232, "editors/ui/normal-popup");
|
||||
spr.x = (FlxG.width - spr.bWidth) / 2;
|
||||
spr.y = (FlxG.height - spr.bHeight) / 2;
|
||||
spr.color = 0xFFFF0000;
|
||||
add(spr);
|
||||
|
||||
add(titleSpr = new UIText(spr.x + 25, spr.y, spr.bWidth - 50, title, 15, -1));
|
||||
titleSpr.y = spr.y + ((30 - titleSpr.height) / 2);
|
||||
|
||||
add(messageSpr = new UIText(spr.x + 10, spr.y + 40, spr.bWidth - 20, message, 15, -1));
|
||||
var sprIcon:FlxSprite = new FlxSprite(spr.x + 26, spr.y + 28 + 26).makeSolid(100, 100, -1);
|
||||
add(sprIcon);
|
||||
|
||||
add(messageSpr = new UIText(sprIcon.x + 100 + 16, sprIcon.y + 12, spr.bWidth - 100 - (26 * 2), message));
|
||||
|
||||
var xPos = (FlxG.width - (30 + (170 * buttons.length))) / 2;
|
||||
for(k=>b in buttons) {
|
||||
var button = new UIButton(xPos + 20 + (170 * k), spr.y + spr.bHeight - 40, b.label, function() {
|
||||
var button = new UIButton(xPos + 20 + (170 * k), spr.y + spr.bHeight - (32 + 16), b.label, function() {
|
||||
b.onClick(this);
|
||||
close();
|
||||
}, 160, 30);
|
||||
@@ -89,11 +94,12 @@ class UIWarningSubstate extends MusicBeatSubstate {
|
||||
FlxG.cameras.remove(warnCam);
|
||||
}
|
||||
|
||||
public function new(title:String, message:String, buttons:Array<WarningButton>) {
|
||||
public function new(title:String, message:String, buttons:Array<WarningButton>, ?isError:Bool = true) {
|
||||
super();
|
||||
this.title = title;
|
||||
this.message = message;
|
||||
this.buttons = buttons;
|
||||
this.isError = isError;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user