Rewrite Stage data handling to use the Registry pattern, and add support for solid colors.
This commit is contained in:
@@ -12,6 +12,7 @@ import flixel.FlxCamera;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxSubState;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
import funkin.graphics.FunkinSprite;
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.math.FlxPoint;
|
||||
@@ -56,7 +57,7 @@ import funkin.data.song.SongData.SongNoteData;
|
||||
import funkin.data.song.SongData.SongCharacterData;
|
||||
import funkin.data.song.SongDataUtils;
|
||||
import funkin.ui.debug.charting.commands.ChartEditorCommand;
|
||||
import funkin.play.stage.StageData;
|
||||
import funkin.data.stage.StageData;
|
||||
import funkin.save.Save;
|
||||
import funkin.ui.debug.charting.commands.AddEventsCommand;
|
||||
import funkin.ui.debug.charting.commands.AddNotesCommand;
|
||||
@@ -2230,7 +2231,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||
var playheadWidth:Int = GRID_SIZE * (STRUMLINE_SIZE * 2 + 1) + (PLAYHEAD_SCROLL_AREA_WIDTH * 2);
|
||||
var playheadBaseYPos:Float = GRID_INITIAL_Y_POS;
|
||||
gridPlayhead.setPosition(GRID_X_POS, playheadBaseYPos);
|
||||
var playheadSprite:FlxSprite = new FlxSprite().makeGraphic(playheadWidth, PLAYHEAD_HEIGHT, PLAYHEAD_COLOR);
|
||||
var playheadSprite:FunkinSprite = new FunkinSprite().makeSolidColor(playheadWidth, PLAYHEAD_HEIGHT, PLAYHEAD_COLOR);
|
||||
playheadSprite.x = -PLAYHEAD_SCROLL_AREA_WIDTH;
|
||||
playheadSprite.y = 0;
|
||||
gridPlayhead.add(playheadSprite);
|
||||
@@ -5951,9 +5952,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||
ChartEditorNoteSprite.noteFrameCollection = null;
|
||||
|
||||
// Stop the music.
|
||||
welcomeMusic.destroy();
|
||||
audioInstTrack.destroy();
|
||||
audioVocalTrackGroup.destroy();
|
||||
if (welcomeMusic != null) welcomeMusic.destroy();
|
||||
if (audioInstTrack != null) audioInstTrack.destroy();
|
||||
if (audioVocalTrackGroup != null) audioVocalTrackGroup.destroy();
|
||||
}
|
||||
|
||||
function applyCanQuickSave():Void
|
||||
|
||||
@@ -13,7 +13,7 @@ import funkin.play.character.BaseCharacter;
|
||||
import funkin.play.character.CharacterData;
|
||||
import funkin.play.character.CharacterData.CharacterDataParser;
|
||||
import funkin.play.song.Song;
|
||||
import funkin.play.stage.StageData;
|
||||
import funkin.data.stage.StageData;
|
||||
import funkin.ui.debug.charting.dialogs.ChartEditorAboutDialog;
|
||||
import funkin.ui.debug.charting.dialogs.ChartEditorBaseDialog.DialogDropTarget;
|
||||
import funkin.ui.debug.charting.dialogs.ChartEditorCharacterIconSelectorMenu;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package funkin.ui.debug.charting.handlers;
|
||||
|
||||
import funkin.play.stage.StageData.StageDataParser;
|
||||
import funkin.play.stage.StageData;
|
||||
import funkin.data.stage.StageData;
|
||||
import funkin.play.character.CharacterData;
|
||||
import funkin.play.character.CharacterData.CharacterDataParser;
|
||||
import haxe.ui.components.HorizontalSlider;
|
||||
@@ -16,8 +15,7 @@ import funkin.play.character.CharacterData;
|
||||
import funkin.play.character.CharacterData.CharacterDataParser;
|
||||
import funkin.play.event.SongEvent;
|
||||
import funkin.play.song.SongSerializer;
|
||||
import funkin.play.stage.StageData;
|
||||
import funkin.play.stage.StageData.StageDataParser;
|
||||
import funkin.data.stage.StageData;
|
||||
import haxe.ui.RuntimeComponentBuilder;
|
||||
import funkin.ui.debug.charting.util.ChartEditorDropdowns;
|
||||
import funkin.ui.haxeui.components.CharacterPlayer;
|
||||
|
||||
@@ -2,7 +2,7 @@ package funkin.ui.debug.charting.toolboxes;
|
||||
|
||||
import funkin.play.character.BaseCharacter.CharacterType;
|
||||
import funkin.play.character.CharacterData;
|
||||
import funkin.play.stage.StageData;
|
||||
import funkin.data.stage.StageData;
|
||||
import funkin.play.event.SongEvent;
|
||||
import funkin.data.event.SongEventSchema;
|
||||
import funkin.ui.debug.charting.commands.ChangeStartingBPMCommand;
|
||||
|
||||
@@ -2,7 +2,8 @@ package funkin.ui.debug.charting.toolboxes;
|
||||
|
||||
import funkin.play.character.BaseCharacter.CharacterType;
|
||||
import funkin.play.character.CharacterData;
|
||||
import funkin.play.stage.StageData;
|
||||
import funkin.data.stage.StageData;
|
||||
import funkin.data.stage.StageRegistry;
|
||||
import funkin.ui.debug.charting.commands.ChangeStartingBPMCommand;
|
||||
import funkin.ui.debug.charting.util.ChartEditorDropdowns;
|
||||
import haxe.ui.components.Button;
|
||||
@@ -13,6 +14,7 @@ import haxe.ui.components.Label;
|
||||
import haxe.ui.components.NumberStepper;
|
||||
import haxe.ui.components.Slider;
|
||||
import haxe.ui.components.TextField;
|
||||
import funkin.play.stage.Stage;
|
||||
import haxe.ui.containers.Box;
|
||||
import haxe.ui.containers.Frame;
|
||||
import haxe.ui.events.UIEvent;
|
||||
@@ -199,11 +201,11 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox
|
||||
inputTimeSignature.value = {id: currentTimeSignature, text: currentTimeSignature};
|
||||
|
||||
var stageId:String = chartEditorState.currentSongMetadata.playData.stage;
|
||||
var stageData:Null<StageData> = StageDataParser.parseStageData(stageId);
|
||||
var stage:Null<Stage> = StageRegistry.instance.fetchEntry(stageId);
|
||||
if (inputStage != null)
|
||||
{
|
||||
inputStage.value = (stageData != null) ?
|
||||
{id: stageId, text: stageData.name} :
|
||||
inputStage.value = (stage != null) ?
|
||||
{id: stage.id, text: stage.stageName} :
|
||||
{id: "mainStage", text: "Main Stage"};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@ package funkin.ui.debug.charting.util;
|
||||
|
||||
import funkin.data.notestyle.NoteStyleRegistry;
|
||||
import funkin.play.notes.notestyle.NoteStyle;
|
||||
import funkin.play.stage.StageData;
|
||||
import funkin.play.stage.StageData.StageDataParser;
|
||||
import funkin.data.stage.StageData;
|
||||
import funkin.data.stage.StageRegistry;
|
||||
import funkin.play.character.CharacterData;
|
||||
import haxe.ui.components.DropDown;
|
||||
import funkin.play.stage.Stage;
|
||||
import funkin.play.character.BaseCharacter.CharacterType;
|
||||
import funkin.play.character.CharacterData.CharacterDataParser;
|
||||
|
||||
@@ -60,16 +61,16 @@ class ChartEditorDropdowns
|
||||
{
|
||||
dropDown.dataSource.clear();
|
||||
|
||||
var stageIds:Array<String> = StageDataParser.listStageIds();
|
||||
var stageIds:Array<String> = StageRegistry.instance.listEntryIds();
|
||||
|
||||
var returnValue:DropDownEntry = {id: "mainStage", text: "Main Stage"};
|
||||
|
||||
for (stageId in stageIds)
|
||||
{
|
||||
var stage:Null<StageData> = StageDataParser.parseStageData(stageId);
|
||||
var stage:Null<Stage> = StageRegistry.instance.fetchEntry(stageId);
|
||||
if (stage == null) continue;
|
||||
|
||||
var value = {id: stageId, text: stage.name};
|
||||
var value = {id: stage.id, text: stage.stageName};
|
||||
if (startingStageId == stageId) returnValue = value;
|
||||
|
||||
dropDown.dataSource.add(value);
|
||||
|
||||
@@ -5,15 +5,17 @@ import flixel.input.mouse.FlxMouseEvent;
|
||||
import flixel.math.FlxPoint;
|
||||
import funkin.play.character.BaseCharacter;
|
||||
import funkin.play.PlayState;
|
||||
import funkin.play.stage.StageData;
|
||||
import funkin.data.stage.StageData;
|
||||
import funkin.play.stage.StageProp;
|
||||
import funkin.graphics.shaders.StrokeShader;
|
||||
import funkin.ui.haxeui.HaxeUISubState;
|
||||
import funkin.ui.debug.stage.StageEditorCommand;
|
||||
import funkin.util.SerializerUtil;
|
||||
import funkin.data.stage.StageRegistry;
|
||||
import funkin.util.MouseUtil;
|
||||
import haxe.ui.containers.ListView;
|
||||
import haxe.ui.core.Component;
|
||||
import funkin.graphics.FunkinSprite;
|
||||
import haxe.ui.events.UIEvent;
|
||||
import haxe.ui.RuntimeComponentBuilder;
|
||||
import openfl.events.Event;
|
||||
@@ -354,7 +356,13 @@ class StageOffsetSubState extends HaxeUISubState
|
||||
|
||||
function prepStageStuff():String
|
||||
{
|
||||
var stageLol:StageData = StageDataParser.parseStageData(PlayState.instance.currentStageId);
|
||||
var stageLol:StageData = StageRegistry.instance.fetchEntry(PlayState.instance.currentStageId)?._data;
|
||||
|
||||
if (stageLol == null)
|
||||
{
|
||||
FlxG.log.error("Stage not found in registry!");
|
||||
return "";
|
||||
}
|
||||
|
||||
for (prop in stageLol.props)
|
||||
{
|
||||
@@ -378,6 +386,6 @@ class StageOffsetSubState extends HaxeUISubState
|
||||
stageLol.characters.gf.position[0] = Std.int(GF_FEET_SNIIIIIIIIIIIIIFFFF.x);
|
||||
stageLol.characters.gf.position[1] = Std.int(GF_FEET_SNIIIIIIIIIIIIIFFFF.y);
|
||||
|
||||
return SerializerUtil.toJSON(stageLol);
|
||||
return stageLol.serialize();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user