mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
the SubState...
This commit is contained in:
parent
6c65a9ea78
commit
a7eb91ce29
20 changed files with 54 additions and 54 deletions
|
@ -2,7 +2,7 @@ package funkin;
|
|||
|
||||
import flixel.FlxSubState;
|
||||
|
||||
class ButtonRemapSubstate extends FlxSubState
|
||||
class ButtonRemapSubState extends FlxSubState
|
||||
{
|
||||
public function new()
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ import funkin.shaderslmfao.StrokeShader;
|
|||
import lime.app.Future;
|
||||
import lime.utils.Assets;
|
||||
|
||||
class FreeplayState extends MusicBeatSubstate
|
||||
class FreeplayState extends MusicBeatSubState
|
||||
{
|
||||
var songs:Array<SongMetadata> = [];
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import funkin.ui.CoolStatsGraph;
|
|||
import haxe.Timer;
|
||||
import openfl.events.KeyboardEvent;
|
||||
|
||||
class LatencyState extends MusicBeatSubstate
|
||||
class LatencyState extends MusicBeatSubState
|
||||
{
|
||||
var offsetText:FlxText;
|
||||
var noteGrp:FlxTypedGroup<Note>;
|
||||
|
|
|
@ -35,8 +35,8 @@ class MusicBeatState extends FlxUIState
|
|||
|
||||
function initCallbacks()
|
||||
{
|
||||
subStateOpened.add(onOpenSubstateComplete);
|
||||
subStateClosed.add(onCloseSubstateComplete);
|
||||
subStateOpened.add(onOpenSubStateComplete);
|
||||
subStateClosed.add(onCloseSubStateComplete);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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));
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ class MusicBeatState extends FlxUIState
|
|||
super.closeSubState();
|
||||
}
|
||||
|
||||
function onCloseSubstateComplete(targetState:FlxSubState):Void
|
||||
function onCloseSubStateComplete(targetState:FlxSubState):Void
|
||||
{
|
||||
dispatchEvent(new SubStateScriptEvent(ScriptEvent.SUBSTATE_CLOSE_END, targetState, true));
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ import funkin.modding.events.ScriptEvent;
|
|||
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)
|
||||
{
|
|
@ -11,7 +11,7 @@ import flixel.util.FlxColor;
|
|||
import funkin.play.PlayState;
|
||||
import funkin.play.song.SongData.SongDataParser;
|
||||
|
||||
class PauseSubState extends MusicBeatSubstate
|
||||
class PauseSubState extends MusicBeatSubState
|
||||
{
|
||||
var grpMenuShit:FlxTypedGroup<Alphabet>;
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ interface IStateChangingScriptedClass extends IScriptedClass
|
|||
public function onStateChangeBegin(event:StateChangeScriptEvent):Void;
|
||||
public function onStateChangeEnd(event:StateChangeScriptEvent):Void;
|
||||
|
||||
public function onSubstateOpenBegin(event:SubStateScriptEvent):Void;
|
||||
public function onSubstateOpenEnd(event:SubStateScriptEvent):Void;
|
||||
public function onSubstateCloseBegin(event:SubStateScriptEvent):Void;
|
||||
public function onSubstateCloseEnd(event:SubStateScriptEvent):Void;
|
||||
public function onSubStateOpenBegin(event:SubStateScriptEvent):Void;
|
||||
public function onSubStateOpenEnd(event:SubStateScriptEvent):Void;
|
||||
public function onSubStateCloseBegin(event:SubStateScriptEvent):Void;
|
||||
public function onSubStateCloseEnd(event:SubStateScriptEvent):Void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
8
source/funkin/modding/base/ScriptedMusicBeatSubState.hx
Normal file
8
source/funkin/modding/base/ScriptedMusicBeatSubState.hx
Normal 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 {}
|
|
@ -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 {}
|
|
@ -113,16 +113,16 @@ class ScriptEventDispatcher
|
|||
t.onStateChangeEnd(cast event);
|
||||
return;
|
||||
case ScriptEvent.SUBSTATE_OPEN_BEGIN:
|
||||
t.onSubstateOpenBegin(cast event);
|
||||
t.onSubStateOpenBegin(cast event);
|
||||
return;
|
||||
case ScriptEvent.SUBSTATE_OPEN_END:
|
||||
t.onSubstateOpenEnd(cast event);
|
||||
t.onSubStateOpenEnd(cast event);
|
||||
return;
|
||||
case ScriptEvent.SUBSTATE_CLOSE_BEGIN:
|
||||
t.onSubstateCloseBegin(cast event);
|
||||
t.onSubStateCloseBegin(cast event);
|
||||
return;
|
||||
case ScriptEvent.SUBSTATE_CLOSE_END:
|
||||
t.onSubstateCloseEnd(cast event);
|
||||
t.onSubStateCloseEnd(cast event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,13 +107,13 @@ class Module implements IPlayStateScriptedClass implements IStateChangingScripte
|
|||
|
||||
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) {}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
class GameOverSubstate extends MusicBeatSubstate
|
||||
class GameOverSubState extends MusicBeatSubState
|
||||
{
|
||||
/**
|
||||
* Which alternate animation on the character to use.
|
||||
|
@ -91,7 +91,7 @@ class GameOverSubstate extends MusicBeatSubstate
|
|||
bg.scrollFactor.set();
|
||||
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.
|
||||
boyfriend = PlayState.instance.currentStage.getBoyfriend(true);
|
||||
boyfriend.isDead = true;
|
||||
|
@ -212,7 +212,7 @@ class GameOverSubstate extends MusicBeatSubstate
|
|||
new FlxTimer().start(0.7, function(tmr:FlxTimer) {
|
||||
// ...fade out the graphics. Then after that happens...
|
||||
FlxG.camera.fade(FlxColor.BLACK, 2, false, function() {
|
||||
// ...close the GameOverSubstate.
|
||||
// ...close the GameOverSubState.
|
||||
FlxG.camera.fade(FlxColor.BLACK, 1, true, null, true);
|
||||
PlayState.needsReset = true;
|
||||
|
|
@ -45,7 +45,7 @@ import funkin.SongLoad.SwagSong;
|
|||
import funkin.audio.VoicesGroup;
|
||||
import funkin.ui.PopUpStuff;
|
||||
import funkin.ui.PreferencesMenu;
|
||||
import funkin.ui.stageBuildShit.StageOffsetSubstate;
|
||||
import funkin.ui.stageBuildShit.StageOffsetSubState;
|
||||
import funkin.util.Constants;
|
||||
import funkin.util.SerializerUtil;
|
||||
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!!
|
||||
disableKeys = true;
|
||||
persistentUpdate = false;
|
||||
openSubState(new StageOffsetSubstate());
|
||||
openSubState(new StageOffsetSubState());
|
||||
}
|
||||
|
||||
updateHealthBar();
|
||||
|
@ -1643,8 +1643,8 @@ class PlayState extends MusicBeatState
|
|||
}
|
||||
#end
|
||||
|
||||
var gameOverSubstate = new GameOverSubstate();
|
||||
openSubState(gameOverSubstate);
|
||||
var gameOverSubState = new GameOverSubState();
|
||||
openSubState(gameOverSubState);
|
||||
|
||||
#if discord_rpc
|
||||
// Game Over doesn't get his own variable because it's only used here
|
||||
|
@ -2739,7 +2739,7 @@ class PlayState extends MusicBeatState
|
|||
currentStage = null;
|
||||
}
|
||||
|
||||
GameOverSubstate.reset();
|
||||
GameOverSubState.reset();
|
||||
|
||||
// Clear the static reference to this state.
|
||||
instance = null;
|
||||
|
|
|
@ -19,7 +19,7 @@ import funkin.shaderslmfao.LeftMaskShader;
|
|||
import funkin.ui.TallyCounter;
|
||||
import flxanimate.FlxAnimate.Settings;
|
||||
|
||||
class ResultState extends MusicBeatSubstate
|
||||
class ResultState extends MusicBeatSubState
|
||||
{
|
||||
var resultsVariation:ResultVariations;
|
||||
var songName:FlxBitmapText;
|
||||
|
|
|
@ -401,7 +401,7 @@ class BaseCharacter extends Bopper
|
|||
{
|
||||
if (force || (getCurrentAnimation().startsWith('firstDeath') && isAnimationFinished()))
|
||||
{
|
||||
playAnimation('deathLoop' + GameOverSubstate.animationSuffix);
|
||||
playAnimation('deathLoop' + GameOverSubState.animationSuffix);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import openfl.geom.Matrix;
|
|||
import openfl.display.Sprite;
|
||||
import openfl.display.Bitmap;
|
||||
|
||||
class StickerSubState extends MusicBeatSubstate
|
||||
class StickerSubState extends MusicBeatSubState
|
||||
{
|
||||
public var grpStickers:FlxTypedGroup<StickerSprite>;
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ package funkin.ui.debug;
|
|||
|
||||
import flixel.FlxObject;
|
||||
import flixel.FlxSprite;
|
||||
import funkin.MusicBeatSubstate;
|
||||
import funkin.MusicBeatSubState;
|
||||
import funkin.ui.TextMenuList;
|
||||
import funkin.ui.debug.charting.ChartEditorState;
|
||||
|
||||
class DebugMenuSubState extends MusicBeatSubstate
|
||||
class DebugMenuSubState extends MusicBeatSubState
|
||||
{
|
||||
var items:TextMenuList;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import haxe.ui.core.Component;
|
|||
import haxe.ui.events.MouseEvent;
|
||||
import haxe.ui.events.UIEvent;
|
||||
|
||||
class HaxeUISubState extends MusicBeatSubstate
|
||||
class HaxeUISubState extends MusicBeatSubState
|
||||
{
|
||||
// The component representing the main UI.
|
||||
public var component:Component;
|
||||
|
|
|
@ -9,8 +9,8 @@ import flixel.FlxSprite;
|
|||
*/
|
||||
interface StageEditorCommand
|
||||
{
|
||||
public function execute(state:StageOffsetSubstate):Void;
|
||||
public function undo(state:StageOffsetSubstate):Void;
|
||||
public function execute(state:StageOffsetSubState):Void;
|
||||
public function undo(state:StageOffsetSubState):Void;
|
||||
public function toString():String;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class MovePropCommand implements StageEditorCommand
|
|||
this.realMove = realMove;
|
||||
}
|
||||
|
||||
public function execute(state:StageOffsetSubstate):Void
|
||||
public function execute(state:StageOffsetSubState):Void
|
||||
{
|
||||
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.y -= yDiff;
|
||||
|
@ -58,13 +58,13 @@ class SelectPropCommand implements StageEditorCommand
|
|||
this.prop = prop;
|
||||
}
|
||||
|
||||
public function execute(state:StageOffsetSubstate):Void
|
||||
public function execute(state:StageOffsetSubState):Void
|
||||
{
|
||||
this.prevProp = state.char;
|
||||
state.char = prop;
|
||||
}
|
||||
|
||||
public function undo(state:StageOffsetSubstate):Void
|
||||
public function undo(state:StageOffsetSubState):Void
|
||||
{
|
||||
var funnyShader = state.char.shader;
|
||||
if (state.char != null) state.char.shader = null;
|
||||
|
|
|
@ -28,7 +28,7 @@ import openfl.net.FileReference;
|
|||
*/
|
||||
// Give other classes access to private instance fields
|
||||
@:allow(funkin.ui.stageBuildShit.StageEditorCommand)
|
||||
class StageOffsetSubstate extends HaxeUISubState
|
||||
class StageOffsetSubState extends HaxeUISubState
|
||||
{
|
||||
var uiStuff:Component;
|
||||
|
Loading…
Reference in a new issue