Alphabetical sort

This commit is contained in:
EliteMasterEric 2023-07-19 01:29:43 -04:00
parent ce0be2374d
commit adda3020a9
3 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,6 @@
package funkin.modding.module; package funkin.modding.module;
import funkin.util.SortUtil;
import funkin.modding.events.ScriptEvent.UpdateScriptEvent; import funkin.modding.events.ScriptEvent.UpdateScriptEvent;
import funkin.modding.events.ScriptEvent; import funkin.modding.events.ScriptEvent;
import funkin.modding.events.ScriptEventDispatcher; import funkin.modding.events.ScriptEventDispatcher;
@ -76,8 +77,7 @@ class ModuleHandler
} }
else else
{ {
// Sort alphabetically. Yes that's how this works. return SortUtil.alphabetical(a, b);
return a > b ? 1 : -1;
} }
}); });
} }

View file

@ -586,7 +586,7 @@ class BaseCharacter extends Bopper
public override function playAnimation(name:String, restart:Bool = false, ?ignoreOther:Bool = false, ?reversed:Bool = false):Void public override function playAnimation(name:String, restart:Bool = false, ?ignoreOther:Bool = false, ?reversed:Bool = false):Void
{ {
FlxG.watch.addQuick('playAnim(${characterName})', name); FlxG.watch.addQuick('playAnim(${characterName})', name);
trace('playAnim(${characterName}): ${name}'); // trace('playAnim(${characterName}): ${name}');
super.playAnimation(name, restart, ignoreOther, reversed); super.playAnimation(name, restart, ignoreOther, reversed);
} }
} }

View file

@ -26,4 +26,13 @@ class SortUtil
{ {
return FlxSort.byValues(order, a.data.strumTime, b.data.strumTime); return FlxSort.byValues(order, a.data.strumTime, b.data.strumTime);
} }
/**
* Sort predicate for sorting strings alphabetically.
*/
public static function alphabetical(a:String, b:String):Int
{
// Sort alphabetically. Yes that's how this works.
return a > b ? 1 : -1;
}
} }