2022-09-07 19:07:08 -04:00
|
|
|
package funkin.ui.debug;
|
|
|
|
|
2023-07-26 16:52:58 -04:00
|
|
|
import flixel.math.FlxPoint;
|
2022-09-07 19:07:08 -04:00
|
|
|
import flixel.FlxObject;
|
|
|
|
import flixel.FlxSprite;
|
2023-06-09 15:44:29 -04:00
|
|
|
import funkin.MusicBeatSubState;
|
2022-09-07 19:07:08 -04:00
|
|
|
import funkin.ui.TextMenuList;
|
|
|
|
import funkin.ui.debug.charting.ChartEditorState;
|
|
|
|
|
2023-06-09 15:44:29 -04:00
|
|
|
class DebugMenuSubState extends MusicBeatSubState
|
2022-09-07 19:07:08 -04:00
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
var items:TextMenuList;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Camera focus point
|
|
|
|
*/
|
|
|
|
var camFocusPoint:FlxObject;
|
|
|
|
|
2023-04-06 01:39:27 -04:00
|
|
|
override function create():Void
|
2023-01-22 22:25:45 -05:00
|
|
|
{
|
|
|
|
super.create();
|
2023-04-06 01:39:27 -04:00
|
|
|
bgColor = 0x00000000;
|
2023-01-22 22:25:45 -05:00
|
|
|
|
|
|
|
// Create an object for the camera to track.
|
|
|
|
camFocusPoint = new FlxObject(0, 0);
|
|
|
|
add(camFocusPoint);
|
|
|
|
|
|
|
|
// Follow the camera focus as we scroll.
|
|
|
|
FlxG.camera.follow(camFocusPoint, null, 0.06);
|
|
|
|
|
|
|
|
// Create the green background.
|
|
|
|
var menuBG = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
|
|
|
|
menuBG.color = 0xFF4CAF50;
|
|
|
|
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
|
|
|
|
menuBG.updateHitbox();
|
|
|
|
menuBG.screenCenter();
|
|
|
|
menuBG.scrollFactor.set(0, 0);
|
|
|
|
add(menuBG);
|
|
|
|
|
|
|
|
// Create the list for menu items.
|
|
|
|
items = new TextMenuList();
|
|
|
|
// Move the camera when the menu is scrolled.
|
|
|
|
items.onChange.add(onMenuChange);
|
|
|
|
add(items);
|
|
|
|
|
|
|
|
// Create each menu item.
|
|
|
|
// Call onMenuChange when the first item is created to move the camera .
|
|
|
|
onMenuChange(createItem("CHART EDITOR", openChartEditor));
|
|
|
|
createItem("ANIMATION EDITOR", openAnimationEditor);
|
|
|
|
createItem("STAGE EDITOR", openStageEditor);
|
2023-04-05 00:56:02 -04:00
|
|
|
createItem("TEST STICKERS", testStickers);
|
2023-07-26 16:52:58 -04:00
|
|
|
|
|
|
|
FlxG.camera.focusOn(new FlxPoint(camFocusPoint.x, camFocusPoint.y));
|
|
|
|
FlxG.camera.focusOn(new FlxPoint(camFocusPoint.x, camFocusPoint.y + 500));
|
2023-01-22 22:25:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function onMenuChange(selected:TextMenuItem)
|
|
|
|
{
|
|
|
|
camFocusPoint.setPosition(selected.x + selected.width / 2, selected.y + selected.height / 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
override function update(elapsed:Float)
|
|
|
|
{
|
|
|
|
super.update(elapsed);
|
|
|
|
|
|
|
|
if (controls.BACK)
|
|
|
|
{
|
|
|
|
FlxG.sound.play(Paths.sound('cancelMenu'));
|
|
|
|
exitDebugMenu();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function createItem(name:String, callback:Void->Void, fireInstantly = false)
|
|
|
|
{
|
|
|
|
var item = items.createItem(0, 100 + items.length * 100, name, BOLD, callback);
|
|
|
|
item.fireInstantly = fireInstantly;
|
|
|
|
item.screenCenter(X);
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
function openChartEditor()
|
|
|
|
{
|
|
|
|
FlxG.switchState(new ChartEditorState());
|
|
|
|
}
|
|
|
|
|
|
|
|
function openAnimationEditor()
|
|
|
|
{
|
|
|
|
FlxG.switchState(new funkin.ui.animDebugShit.DebugBoundingState());
|
|
|
|
trace('Animation Editor');
|
|
|
|
}
|
|
|
|
|
2023-04-05 00:56:02 -04:00
|
|
|
function testStickers()
|
|
|
|
{
|
|
|
|
openSubState(new funkin.ui.StickerSubState());
|
|
|
|
trace('opened stickers');
|
|
|
|
}
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
function openStageEditor()
|
|
|
|
{
|
|
|
|
trace('Stage Editor');
|
|
|
|
}
|
|
|
|
|
|
|
|
function exitDebugMenu()
|
|
|
|
{
|
|
|
|
// TODO: Add a transition?
|
|
|
|
this.close();
|
|
|
|
}
|
2022-09-07 19:07:08 -04:00
|
|
|
}
|