2024-01-04 00:53:17 +00:00
|
|
|
package funkin.util.plugins;
|
|
|
|
|
|
|
|
import flixel.FlxBasic;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A plugin which adds functionality to display several universally important values
|
|
|
|
* in the Flixel variable watch window.
|
|
|
|
*/
|
|
|
|
class WatchPlugin extends FlxBasic
|
|
|
|
{
|
|
|
|
public function new()
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function initialize():Void
|
|
|
|
{
|
|
|
|
FlxG.plugins.addPlugin(new WatchPlugin());
|
|
|
|
}
|
|
|
|
|
|
|
|
public override function update(elapsed:Float):Void
|
|
|
|
{
|
|
|
|
super.update(elapsed);
|
|
|
|
|
2024-02-12 21:49:04 +00:00
|
|
|
var stateClassName = Type.getClassName(Type.getClass(FlxG.state));
|
|
|
|
FlxG.watch.addQuick("currentState", stateClassName);
|
|
|
|
var subStateClassNames = [];
|
|
|
|
var subState = FlxG.state.subState;
|
|
|
|
while (subState != null)
|
|
|
|
{
|
|
|
|
subStateClassNames.push(Type.getClassName(Type.getClass(subState)));
|
|
|
|
subState = subState.subState;
|
|
|
|
}
|
|
|
|
FlxG.watch.addQuick("currentSubStates", subStateClassNames.join(", "));
|
|
|
|
|
2024-01-06 01:25:54 +00:00
|
|
|
FlxG.watch.addQuick("songPosition", Conductor.instance.songPosition);
|
|
|
|
FlxG.watch.addQuick("songPositionNoOffset", Conductor.instance.songPosition + Conductor.instance.instrumentalOffset);
|
2024-01-04 00:53:17 +00:00
|
|
|
FlxG.watch.addQuick("musicTime", FlxG.sound?.music?.time ?? 0.0);
|
2024-01-06 01:25:54 +00:00
|
|
|
FlxG.watch.addQuick("bpm", Conductor.instance.bpm);
|
|
|
|
FlxG.watch.addQuick("currentMeasureTime", Conductor.instance.currentMeasureTime);
|
|
|
|
FlxG.watch.addQuick("currentBeatTime", Conductor.instance.currentBeatTime);
|
|
|
|
FlxG.watch.addQuick("currentStepTime", Conductor.instance.currentStepTime);
|
2024-01-04 00:53:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override function destroy():Void
|
|
|
|
{
|
|
|
|
super.destroy();
|
|
|
|
}
|
|
|
|
}
|