hopefully fix empty events

This commit is contained in:
lunarcleint
2023-09-16 12:40:08 -07:00
parent 80115e2224
commit 0543f6c401
3 changed files with 12 additions and 3 deletions

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 129 B

@@ -8,6 +8,7 @@ class CharterEventGroup extends FlxTypedGroup<CharterEvent> {
var __lastSort:Int = 0;
public override function update(elapsed:Float) {
filterEvents();
if (length != __lastSort)
sortEvents();
@@ -22,10 +23,18 @@ class CharterEventGroup extends FlxTypedGroup<CharterEvent> {
super.draw();
}
public function sortEvents() {
public inline function sortEvents() {
__lastSort = length;
this.sort(function(i, e1, e2) {
return FlxSort.byValues(FlxSort.ASCENDING, e1.step, e2.step);
});
}
public inline function filterEvents() {
for (event in members)
if (event.events.length == 0) {
remove(event, true);
event.kill();
}
}
}
@@ -40,7 +40,7 @@ class CharterStrumline extends UISprite {
members.push(healthIcon);
draggingSprite = new UISprite();
draggingSprite.loadGraphic(Paths.image("editors/charter/drag-strumline"));
draggingSprite.loadGraphic(Paths.image("editors/charter/strumline-drag"));
draggingSprite.alpha = 0.4;
draggingSprite.y = 9;
draggingSprite.antialiasing = true;
@@ -98,7 +98,7 @@ class CharterStrumline extends UISprite {
class CharterStrumlineButton extends UITopMenuButton {
var strLine:CharterStrumline;
public function new(parent:CharterStrumline) {
super(0, 95, null, "Options", []);
super(0, 95, null, "Options ↓", []);
strLine = parent;
bWidth = 40 * 4;
this.label.fieldWidth = bWidth;