change sorting blah blah blah
This commit is contained in:
@@ -583,7 +583,6 @@ class Charter extends UIState {
|
||||
if (s is CharterNote) cast(s, CharterNote).snappedToStrumline = true;
|
||||
if (s is UISprite) cast(s, UISprite).cursor = BUTTON;
|
||||
}
|
||||
sortNotes();
|
||||
undos.addToUndo(CSelectionDrag(selection, changePoint.clone()));
|
||||
|
||||
changePoint.put();
|
||||
@@ -615,7 +614,6 @@ class Charter extends UIState {
|
||||
note.updatePos(FlxG.keys.pressed.SHIFT ? (mousePos.y / 40) : Math.floor(mousePos.y / 40), id % 4, 0, 0, strumLines.members[Std.int(id/4)]);
|
||||
notesGroup.add(note);
|
||||
selection = [note];
|
||||
sortNotes();
|
||||
undos.addToUndo(CCreateSelection([note]));
|
||||
}
|
||||
}
|
||||
@@ -678,7 +676,6 @@ class Charter extends UIState {
|
||||
eventsGroup.remove(event, true);
|
||||
event.kill();
|
||||
}
|
||||
sortNotes();
|
||||
|
||||
if (addToUndo)
|
||||
undos.addToUndo(CDeleteSelection([selected]));
|
||||
@@ -697,7 +694,6 @@ class Charter extends UIState {
|
||||
e.revive();
|
||||
e.refreshEventIcons();
|
||||
}, false);
|
||||
sortNotes();
|
||||
|
||||
for (s in selection)
|
||||
if (s is CharterEvent) {
|
||||
@@ -723,7 +719,6 @@ class Charter extends UIState {
|
||||
else member++;
|
||||
}
|
||||
}
|
||||
sortNotes();
|
||||
|
||||
for (s in selection)
|
||||
if (s is CharterEvent) {
|
||||
@@ -747,7 +742,6 @@ class Charter extends UIState {
|
||||
n.updatePos(t, note.id, Conductor.getStepForTime(note.time + note.sLen) - t, note.type, cStr);
|
||||
notesGroup.add(n);
|
||||
}
|
||||
sortNotes();
|
||||
|
||||
if (addToUndo)
|
||||
undos.addToUndo(CCreateStrumLine(strumLineID, strL));
|
||||
@@ -770,8 +764,6 @@ class Charter extends UIState {
|
||||
strumLines.members[strumLineID].destroy();
|
||||
strumLines.members.remove(strumLines.members[strumLineID]);
|
||||
|
||||
sortNotes();
|
||||
|
||||
if (addToUndo) {
|
||||
var newStrL = Reflect.copy(strL);
|
||||
newStrL.notes = undoNotes;
|
||||
@@ -822,14 +814,6 @@ class Charter extends UIState {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public inline function sortNotes() {
|
||||
notesGroup.sort(function(i, n1, n2) {
|
||||
if (n1.step == n2.step)
|
||||
return FlxSort.byValues(FlxSort.ASCENDING, n1.id, n2.id);
|
||||
return FlxSort.byValues(FlxSort.ASCENDING, n1.step, n2.step);
|
||||
});
|
||||
}
|
||||
#end
|
||||
|
||||
var __crochet:Float;
|
||||
|
||||
@@ -105,7 +105,6 @@ class CharterBackdrop extends FlxBackdrop {
|
||||
topLimit.x = this.x;
|
||||
topLimit.cameras = this.cameras;
|
||||
|
||||
// Draw notes
|
||||
notesGroup.forEach((n) -> {
|
||||
if(n.exists && n.visible) {
|
||||
n.cameras = cameras;
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import funkin.editors.charter.CharterBackdrop.EventBackdrop;
|
||||
import flixel.util.FlxSort;
|
||||
|
||||
class CharterEventGroup extends FlxTypedGroup<CharterEvent> {
|
||||
public var eventsBackdrop:EventBackdrop;
|
||||
var __lastSort:Int = 0;
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
if (length != __lastSort)
|
||||
sortEvents();
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
public override function draw() {
|
||||
for (event in members) {
|
||||
@@ -12,4 +21,11 @@ class CharterEventGroup extends FlxTypedGroup<CharterEvent> {
|
||||
}
|
||||
super.draw();
|
||||
}
|
||||
|
||||
public function sortEvents() {
|
||||
__lastSort = length;
|
||||
this.sort(function(i, e1, e2) {
|
||||
return FlxSort.byValues(FlxSort.ASCENDING, e1.step, e2.step);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ class CharterNote extends UISprite implements ICharterSelectable {
|
||||
sustainSpr.follow(this, 15, 20);
|
||||
|
||||
if (__passed != (__passed = step < Conductor.curStepFloat)) {
|
||||
alpha = (__passed ? 0.8 : 1) - (!strumLine.strumLine.visible ? .6 : 0);
|
||||
alpha = (__passed ? 0.6 : 1);
|
||||
if (__passed && FlxG.sound.music.playing && Charter.instance.hitsoundsEnabled(strumLineID))
|
||||
Charter.instance.hitsound.replay();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import flixel.util.FlxSort;
|
||||
import funkin.backend.system.Conductor;
|
||||
|
||||
class CharterNoteGroup extends FlxTypedGroup<CharterNote> {
|
||||
@@ -8,6 +9,7 @@ class CharterNoteGroup extends FlxTypedGroup<CharterNote> {
|
||||
var max:Float = 0;
|
||||
var __currentlyLooping:Bool = false;
|
||||
var __autoDraw:Bool = false;
|
||||
var __lastSort:Int = 0;
|
||||
|
||||
public override function forEach(noteFunc:CharterNote->Void, recursive:Bool = false) {
|
||||
__loopSprite = null;
|
||||
@@ -62,7 +64,6 @@ class CharterNoteGroup extends FlxTypedGroup<CharterNote> {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@:privateAccess FlxCamera._defaultCameras = oldDefaultCameras;
|
||||
}
|
||||
|
||||
@@ -70,6 +71,9 @@ class CharterNoteGroup extends FlxTypedGroup<CharterNote> {
|
||||
@:privateAccess var oldDefaultCameras = FlxCamera._defaultCameras;
|
||||
@:privateAccess if (cameras != null) FlxCamera._defaultCameras = cameras;
|
||||
|
||||
if (length != __lastSort)
|
||||
sortNotes();
|
||||
|
||||
forEach((n) -> {
|
||||
if(n.exists && n.active)
|
||||
n.update(elapsed);
|
||||
@@ -77,4 +81,13 @@ class CharterNoteGroup extends FlxTypedGroup<CharterNote> {
|
||||
|
||||
@:privateAccess FlxCamera._defaultCameras = oldDefaultCameras;
|
||||
}
|
||||
|
||||
public function sortNotes() {
|
||||
__lastSort = length;
|
||||
this.sort(function(i, n1, n2) {
|
||||
if (n1.step == n2.step)
|
||||
return FlxSort.byValues(FlxSort.ASCENDING, n1.fullID, n2.fullID);
|
||||
return FlxSort.byValues(FlxSort.ASCENDING, n1.step, n2.step);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,11 @@ class CharterStrumLineGroup extends FlxTypedGroup<CharterStrumline> {
|
||||
}
|
||||
}
|
||||
|
||||
if (draggingObj != null)
|
||||
if (isDragging) {
|
||||
draggingObj.x = mousePos.x - draggingOffset;
|
||||
this.sort(function(o, a, b) return FlxSort.byValues(o, a.x, b.x), -1);
|
||||
}
|
||||
|
||||
this.sort(function(o, a, b) return FlxSort.byValues(o, a.x, b.x), -1);
|
||||
for (i=>strum in members)
|
||||
if (!strum.dragging) strum.x = CoolUtil.fpsLerp(strum.x, 160 * i, 0.225);
|
||||
|
||||
@@ -42,7 +43,7 @@ class CharterStrumLineGroup extends FlxTypedGroup<CharterStrumline> {
|
||||
if (Charter.instance.strumlineAddButton != null)
|
||||
Charter.instance.strumlineAddButton.x = members[members.length-1].x + (40*4);
|
||||
|
||||
if ((FlxG.mouse.justReleased || !draggable) && draggingObj != null)
|
||||
if ((FlxG.mouse.justReleased || !draggable) && isDragging)
|
||||
finishDrag();
|
||||
|
||||
mousePos.put();
|
||||
@@ -55,14 +56,11 @@ class CharterStrumLineGroup extends FlxTypedGroup<CharterStrumline> {
|
||||
members.remove(strumLine);
|
||||
members.insert(newID, strumLine);
|
||||
|
||||
for (i=>strum in members)
|
||||
strum.x = 160 * i;
|
||||
|
||||
finishDrag(false);
|
||||
}
|
||||
|
||||
public function finishDrag(?addToUndo:Bool = true) {
|
||||
if (draggingObj != null)
|
||||
if (isDragging)
|
||||
draggingObj.dragging = false;
|
||||
|
||||
// Undo
|
||||
@@ -72,7 +70,6 @@ class CharterStrumLineGroup extends FlxTypedGroup<CharterStrumline> {
|
||||
Charter.instance.undos.addToUndo(COrderStrumLine(draggingObj, oldID, newID));
|
||||
}
|
||||
|
||||
|
||||
draggingObj = null;
|
||||
fixEvents();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user