Merge pull request #104 from FunkinCrew/recapitalizing

the SubState...
This commit is contained in:
Cameron Taylor 2023-06-09 15:54:50 -04:00 committed by GitHub
commit aa5a5c5cc1
20 changed files with 54 additions and 54 deletions

View file

@ -2,7 +2,7 @@ package funkin;
import flixel.FlxSubState; import flixel.FlxSubState;
class ButtonRemapSubstate extends FlxSubState class ButtonRemapSubState extends FlxSubState
{ {
public function new() public function new()
{ {

View file

@ -37,7 +37,7 @@ import funkin.shaderslmfao.StrokeShader;
import lime.app.Future; import lime.app.Future;
import lime.utils.Assets; import lime.utils.Assets;
class FreeplayState extends MusicBeatSubstate class FreeplayState extends MusicBeatSubState
{ {
var songs:Array<SongMetadata> = []; var songs:Array<SongMetadata> = [];

View file

@ -14,7 +14,7 @@ import funkin.ui.CoolStatsGraph;
import haxe.Timer; import haxe.Timer;
import openfl.events.KeyboardEvent; import openfl.events.KeyboardEvent;
class LatencyState extends MusicBeatSubstate class LatencyState extends MusicBeatSubState
{ {
var offsetText:FlxText; var offsetText:FlxText;
var noteGrp:FlxTypedGroup<Note>; var noteGrp:FlxTypedGroup<Note>;

View file

@ -35,8 +35,8 @@ class MusicBeatState extends FlxUIState
function initCallbacks() function initCallbacks()
{ {
subStateOpened.add(onOpenSubstateComplete); subStateOpened.add(onOpenSubStateComplete);
subStateClosed.add(onCloseSubstateComplete); subStateClosed.add(onCloseSubStateComplete);
} }
override function create() override function create()
@ -162,18 +162,18 @@ class MusicBeatState extends FlxUIState
} }
} }
public override function openSubState(targetSubstate:FlxSubState):Void public override function openSubState(targetSubState:FlxSubState):Void
{ {
var event = new SubStateScriptEvent(ScriptEvent.SUBSTATE_OPEN_BEGIN, targetSubstate, true); var event = new SubStateScriptEvent(ScriptEvent.SUBSTATE_OPEN_BEGIN, targetSubState, true);
dispatchEvent(event); dispatchEvent(event);
if (event.eventCanceled) return; if (event.eventCanceled) return;
super.openSubState(targetSubstate); super.openSubState(targetSubState);
} }
function onOpenSubstateComplete(targetState:FlxSubState):Void function onOpenSubStateComplete(targetState:FlxSubState):Void
{ {
dispatchEvent(new SubStateScriptEvent(ScriptEvent.SUBSTATE_OPEN_END, targetState, true)); dispatchEvent(new SubStateScriptEvent(ScriptEvent.SUBSTATE_OPEN_END, targetState, true));
} }
@ -189,7 +189,7 @@ class MusicBeatState extends FlxUIState
super.closeSubState(); super.closeSubState();
} }
function onCloseSubstateComplete(targetState:FlxSubState):Void function onCloseSubStateComplete(targetState:FlxSubState):Void
{ {
dispatchEvent(new SubStateScriptEvent(ScriptEvent.SUBSTATE_CLOSE_END, targetState, true)); dispatchEvent(new SubStateScriptEvent(ScriptEvent.SUBSTATE_CLOSE_END, targetState, true));
} }

View file

@ -7,9 +7,9 @@ import funkin.modding.events.ScriptEvent;
import funkin.modding.module.ModuleHandler; import funkin.modding.module.ModuleHandler;
/** /**
* MusicBeatSubstate reincorporates the functionality of MusicBeatState into an FlxSubState. * MusicBeatSubState reincorporates the functionality of MusicBeatState into an FlxSubState.
*/ */
class MusicBeatSubstate extends FlxSubState class MusicBeatSubState extends FlxSubState
{ {
public function new(bgColor:FlxColor = FlxColor.TRANSPARENT) public function new(bgColor:FlxColor = FlxColor.TRANSPARENT)
{ {

View file

@ -11,7 +11,7 @@ import flixel.util.FlxColor;
import funkin.play.PlayState; import funkin.play.PlayState;
import funkin.play.song.SongData.SongDataParser; import funkin.play.song.SongData.SongDataParser;
class PauseSubState extends MusicBeatSubstate class PauseSubState extends MusicBeatSubState
{ {
var grpMenuShit:FlxTypedGroup<Alphabet>; var grpMenuShit:FlxTypedGroup<Alphabet>;

View file

@ -24,10 +24,10 @@ interface IStateChangingScriptedClass extends IScriptedClass
public function onStateChangeBegin(event:StateChangeScriptEvent):Void; public function onStateChangeBegin(event:StateChangeScriptEvent):Void;
public function onStateChangeEnd(event:StateChangeScriptEvent):Void; public function onStateChangeEnd(event:StateChangeScriptEvent):Void;
public function onSubstateOpenBegin(event:SubStateScriptEvent):Void; public function onSubStateOpenBegin(event:SubStateScriptEvent):Void;
public function onSubstateOpenEnd(event:SubStateScriptEvent):Void; public function onSubStateOpenEnd(event:SubStateScriptEvent):Void;
public function onSubstateCloseBegin(event:SubStateScriptEvent):Void; public function onSubStateCloseBegin(event:SubStateScriptEvent):Void;
public function onSubstateCloseEnd(event:SubStateScriptEvent):Void; public function onSubStateCloseEnd(event:SubStateScriptEvent):Void;
} }
/** /**

View file

@ -0,0 +1,8 @@
package funkin.modding.base;
/**
* A script that can be tied to a MusicBeatSubState.
* Create a scripted class that extends MusicBeatSubState to use this.
*/
@:hscriptClass
class ScriptedMusicBeatSubState extends funkin.MusicBeatSubState implements HScriptedClass {}

View file

@ -1,8 +0,0 @@
package funkin.modding.base;
/**
* A script that can be tied to a MusicBeatSubstate.
* Create a scripted class that extends MusicBeatSubstate to use this.
*/
@:hscriptClass
class ScriptedMusicBeatSubstate extends funkin.MusicBeatSubstate implements HScriptedClass {}

View file

@ -113,16 +113,16 @@ class ScriptEventDispatcher
t.onStateChangeEnd(cast event); t.onStateChangeEnd(cast event);
return; return;
case ScriptEvent.SUBSTATE_OPEN_BEGIN: case ScriptEvent.SUBSTATE_OPEN_BEGIN:
t.onSubstateOpenBegin(cast event); t.onSubStateOpenBegin(cast event);
return; return;
case ScriptEvent.SUBSTATE_OPEN_END: case ScriptEvent.SUBSTATE_OPEN_END:
t.onSubstateOpenEnd(cast event); t.onSubStateOpenEnd(cast event);
return; return;
case ScriptEvent.SUBSTATE_CLOSE_BEGIN: case ScriptEvent.SUBSTATE_CLOSE_BEGIN:
t.onSubstateCloseBegin(cast event); t.onSubStateCloseBegin(cast event);
return; return;
case ScriptEvent.SUBSTATE_CLOSE_END: case ScriptEvent.SUBSTATE_CLOSE_END:
t.onSubstateCloseEnd(cast event); t.onSubStateCloseEnd(cast event);
return; return;
} }
} }

View file

@ -107,13 +107,13 @@ class Module implements IPlayStateScriptedClass implements IStateChangingScripte
public function onStateChangeEnd(event:StateChangeScriptEvent) {} public function onStateChangeEnd(event:StateChangeScriptEvent) {}
public function onSubstateOpenBegin(event:SubStateScriptEvent) {} public function onSubStateOpenBegin(event:SubStateScriptEvent) {}
public function onSubstateOpenEnd(event:SubStateScriptEvent) {} public function onSubStateOpenEnd(event:SubStateScriptEvent) {}
public function onSubstateCloseBegin(event:SubStateScriptEvent) {} public function onSubStateCloseBegin(event:SubStateScriptEvent) {}
public function onSubstateCloseEnd(event:SubStateScriptEvent) {} public function onSubStateCloseEnd(event:SubStateScriptEvent) {}
public function onSongRetry(event:ScriptEvent) {} public function onSongRetry(event:ScriptEvent) {}
} }

View file

@ -18,7 +18,7 @@ import funkin.ui.PreferencesMenu;
* *
* The newest implementation uses a substate, which prevents having to reload the song and stage each reset. * The newest implementation uses a substate, which prevents having to reload the song and stage each reset.
*/ */
class GameOverSubstate extends MusicBeatSubstate class GameOverSubState extends MusicBeatSubState
{ {
/** /**
* Which alternate animation on the character to use. * Which alternate animation on the character to use.
@ -91,7 +91,7 @@ class GameOverSubstate extends MusicBeatSubstate
bg.scrollFactor.set(); bg.scrollFactor.set();
add(bg); add(bg);
// Pluck Boyfriend from the PlayState and place him (in the same position) in the GameOverSubstate. // Pluck Boyfriend from the PlayState and place him (in the same position) in the GameOverSubState.
// We can then play the character's `firstDeath` animation. // We can then play the character's `firstDeath` animation.
boyfriend = PlayState.instance.currentStage.getBoyfriend(true); boyfriend = PlayState.instance.currentStage.getBoyfriend(true);
boyfriend.isDead = true; boyfriend.isDead = true;
@ -212,7 +212,7 @@ class GameOverSubstate extends MusicBeatSubstate
new FlxTimer().start(0.7, function(tmr:FlxTimer) { new FlxTimer().start(0.7, function(tmr:FlxTimer) {
// ...fade out the graphics. Then after that happens... // ...fade out the graphics. Then after that happens...
FlxG.camera.fade(FlxColor.BLACK, 2, false, function() { FlxG.camera.fade(FlxColor.BLACK, 2, false, function() {
// ...close the GameOverSubstate. // ...close the GameOverSubState.
FlxG.camera.fade(FlxColor.BLACK, 1, true, null, true); FlxG.camera.fade(FlxColor.BLACK, 1, true, null, true);
PlayState.needsReset = true; PlayState.needsReset = true;

View file

@ -45,7 +45,7 @@ import funkin.SongLoad.SwagSong;
import funkin.audio.VoicesGroup; import funkin.audio.VoicesGroup;
import funkin.ui.PopUpStuff; import funkin.ui.PopUpStuff;
import funkin.ui.PreferencesMenu; import funkin.ui.PreferencesMenu;
import funkin.ui.stageBuildShit.StageOffsetSubstate; import funkin.ui.stageBuildShit.StageOffsetSubState;
import funkin.util.Constants; import funkin.util.Constants;
import funkin.util.SerializerUtil; import funkin.util.SerializerUtil;
import funkin.util.SortUtil; import funkin.util.SortUtil;
@ -1405,7 +1405,7 @@ class PlayState extends MusicBeatState
// hack for HaxeUI generation, doesn't work unless persistentUpdate is false at state creation!! // hack for HaxeUI generation, doesn't work unless persistentUpdate is false at state creation!!
disableKeys = true; disableKeys = true;
persistentUpdate = false; persistentUpdate = false;
openSubState(new StageOffsetSubstate()); openSubState(new StageOffsetSubState());
} }
updateHealthBar(); updateHealthBar();
@ -1643,8 +1643,8 @@ class PlayState extends MusicBeatState
} }
#end #end
var gameOverSubstate = new GameOverSubstate(); var gameOverSubState = new GameOverSubState();
openSubState(gameOverSubstate); openSubState(gameOverSubState);
#if discord_rpc #if discord_rpc
// Game Over doesn't get his own variable because it's only used here // Game Over doesn't get his own variable because it's only used here
@ -2739,7 +2739,7 @@ class PlayState extends MusicBeatState
currentStage = null; currentStage = null;
} }
GameOverSubstate.reset(); GameOverSubState.reset();
// Clear the static reference to this state. // Clear the static reference to this state.
instance = null; instance = null;

View file

@ -19,7 +19,7 @@ import funkin.shaderslmfao.LeftMaskShader;
import funkin.ui.TallyCounter; import funkin.ui.TallyCounter;
import flxanimate.FlxAnimate.Settings; import flxanimate.FlxAnimate.Settings;
class ResultState extends MusicBeatSubstate class ResultState extends MusicBeatSubState
{ {
var resultsVariation:ResultVariations; var resultsVariation:ResultVariations;
var songName:FlxBitmapText; var songName:FlxBitmapText;

View file

@ -401,7 +401,7 @@ class BaseCharacter extends Bopper
{ {
if (force || (getCurrentAnimation().startsWith('firstDeath') && isAnimationFinished())) if (force || (getCurrentAnimation().startsWith('firstDeath') && isAnimationFinished()))
{ {
playAnimation('deathLoop' + GameOverSubstate.animationSuffix); playAnimation('deathLoop' + GameOverSubState.animationSuffix);
} }
} }

View file

@ -17,7 +17,7 @@ import openfl.geom.Matrix;
import openfl.display.Sprite; import openfl.display.Sprite;
import openfl.display.Bitmap; import openfl.display.Bitmap;
class StickerSubState extends MusicBeatSubstate class StickerSubState extends MusicBeatSubState
{ {
public var grpStickers:FlxTypedGroup<StickerSprite>; public var grpStickers:FlxTypedGroup<StickerSprite>;

View file

@ -2,11 +2,11 @@ package funkin.ui.debug;
import flixel.FlxObject; import flixel.FlxObject;
import flixel.FlxSprite; import flixel.FlxSprite;
import funkin.MusicBeatSubstate; import funkin.MusicBeatSubState;
import funkin.ui.TextMenuList; import funkin.ui.TextMenuList;
import funkin.ui.debug.charting.ChartEditorState; import funkin.ui.debug.charting.ChartEditorState;
class DebugMenuSubState extends MusicBeatSubstate class DebugMenuSubState extends MusicBeatSubState
{ {
var items:TextMenuList; var items:TextMenuList;

View file

@ -7,7 +7,7 @@ import haxe.ui.core.Component;
import haxe.ui.events.MouseEvent; import haxe.ui.events.MouseEvent;
import haxe.ui.events.UIEvent; import haxe.ui.events.UIEvent;
class HaxeUISubState extends MusicBeatSubstate class HaxeUISubState extends MusicBeatSubState
{ {
// The component representing the main UI. // The component representing the main UI.
public var component:Component; public var component:Component;

View file

@ -9,8 +9,8 @@ import flixel.FlxSprite;
*/ */
interface StageEditorCommand interface StageEditorCommand
{ {
public function execute(state:StageOffsetSubstate):Void; public function execute(state:StageOffsetSubState):Void;
public function undo(state:StageOffsetSubstate):Void; public function undo(state:StageOffsetSubState):Void;
public function toString():String; public function toString():String;
} }
@ -27,7 +27,7 @@ class MovePropCommand implements StageEditorCommand
this.realMove = realMove; this.realMove = realMove;
} }
public function execute(state:StageOffsetSubstate):Void public function execute(state:StageOffsetSubState):Void
{ {
if (realMove) if (realMove)
{ {
@ -36,7 +36,7 @@ class MovePropCommand implements StageEditorCommand
} }
} }
public function undo(state:StageOffsetSubstate):Void public function undo(state:StageOffsetSubState):Void
{ {
state.char.x -= xDiff; state.char.x -= xDiff;
state.char.y -= yDiff; state.char.y -= yDiff;
@ -58,13 +58,13 @@ class SelectPropCommand implements StageEditorCommand
this.prop = prop; this.prop = prop;
} }
public function execute(state:StageOffsetSubstate):Void public function execute(state:StageOffsetSubState):Void
{ {
this.prevProp = state.char; this.prevProp = state.char;
state.char = prop; state.char = prop;
} }
public function undo(state:StageOffsetSubstate):Void public function undo(state:StageOffsetSubState):Void
{ {
var funnyShader = state.char.shader; var funnyShader = state.char.shader;
if (state.char != null) state.char.shader = null; if (state.char != null) state.char.shader = null;

View file

@ -28,7 +28,7 @@ import openfl.net.FileReference;
*/ */
// Give other classes access to private instance fields // Give other classes access to private instance fields
@:allow(funkin.ui.stageBuildShit.StageEditorCommand) @:allow(funkin.ui.stageBuildShit.StageEditorCommand)
class StageOffsetSubstate extends HaxeUISubState class StageOffsetSubState extends HaxeUISubState
{ {
var uiStuff:Component; var uiStuff:Component;