1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 07:27:12 +00:00

Added new "Mods" story menu section (hidden when no mods are installed)

This commit is contained in:
EliteMasterEric 2023-06-10 02:56:03 -04:00
parent 109676522a
commit 6f676a5896
3 changed files with 32 additions and 8 deletions

View file

@ -156,7 +156,10 @@ class Level implements IRegistryEntry<LevelData>
for (propIndex in 0..._data.props.length) for (propIndex in 0..._data.props.length)
{ {
var propData = _data.props[propIndex]; var propData = _data.props[propIndex];
var propSprite:LevelProp = LevelProp.build(propData);
var propSprite:Null<LevelProp> = LevelProp.build(propData);
if (propSprite == null) continue;
propSprite.x += FlxG.width * 0.25 * propIndex; propSprite.x += FlxG.width * 0.25 * propIndex;
props.push(propSprite); props.push(propSprite);
} }

View file

@ -16,8 +16,10 @@ class LevelProp extends Bopper
playAnimation('confirm', true, true); playAnimation('confirm', true, true);
} }
public static function build(propData:LevelPropData):Null<LevelProp> public static function build(propData:Null<LevelPropData>):Null<LevelProp>
{ {
if (propData == null) return null;
var isAnimated:Bool = propData.animations.length > 0; var isAnimated:Bool = propData.animations.length > 0;
var prop:LevelProp = new LevelProp(propData.danceEvery); var prop:LevelProp = new LevelProp(propData.danceEvery);

View file

@ -52,6 +52,11 @@ class StoryMenuState extends MusicBeatState
*/ */
var scoreText:FlxText; var scoreText:FlxText;
/**
* The mode text at the top-middle.
*/
var modeText:FlxText;
/** /**
* The list of songs on the left. * The list of songs on the left.
*/ */
@ -146,16 +151,22 @@ class StoryMenuState extends MusicBeatState
updateProps(); updateProps();
scoreText = new FlxText(10, 10, 0, 'HIGH SCORE: 42069420');
scoreText.setFormat("VCR OSD Mono", 32);
add(scoreText);
tracklistText = new FlxText(FlxG.width * 0.05, levelBackground.x + levelBackground.height + 100, 0, "Tracks", 32); tracklistText = new FlxText(FlxG.width * 0.05, levelBackground.x + levelBackground.height + 100, 0, "Tracks", 32);
tracklistText.setFormat("VCR OSD Mono", 32); tracklistText.setFormat("VCR OSD Mono", 32);
tracklistText.alignment = CENTER; tracklistText.alignment = CENTER;
tracklistText.color = 0xFFe55777; tracklistText.color = 0xFFe55777;
add(tracklistText); add(tracklistText);
scoreText = new FlxText(10, 10, 0, 'HIGH SCORE: 42069420');
scoreText.setFormat("VCR OSD Mono", 32);
add(scoreText);
modeText = new FlxText(10, 10, 0, 'Base Game Levels [TAB to switch]');
modeText.setFormat("VCR OSD Mono", 32);
modeText.screenCenter(X);
modeText.visible = hasModdedLevels();
add(modeText);
levelTitleText = new FlxText(FlxG.width * 0.7, 10, 0, 'LEVEL 1'); levelTitleText = new FlxText(FlxG.width * 0.7, 10, 0, 'LEVEL 1');
levelTitleText.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, RIGHT); levelTitleText.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, RIGHT);
levelTitleText.alpha = 0.7; levelTitleText.alpha = 0.7;
@ -256,7 +267,7 @@ class StoryMenuState extends MusicBeatState
displayingModdedLevels = moddedLevels; displayingModdedLevels = moddedLevels;
buildLevelTitles(); buildLevelTitles();
changeLevel(0); changeLevel(999999); // Jump past the end of the list to the beginning.
changeDifficulty(0); changeDifficulty(0);
} }
@ -268,6 +279,9 @@ class StoryMenuState extends MusicBeatState
scoreText.text = 'LEVEL SCORE: ${Math.round(highScoreLerp)}'; scoreText.text = 'LEVEL SCORE: ${Math.round(highScoreLerp)}';
modeText.text = displayingModdedLevels ? 'Mods [TAB to switch]' : 'Base Game [TAB to switch]';
modeText.screenCenter(X);
levelTitleText.text = currentLevel.getTitle(); levelTitleText.text = currentLevel.getTitle();
levelTitleText.x = FlxG.width - (levelTitleText.width + 10); // Right align. levelTitleText.x = FlxG.width - (levelTitleText.width + 10); // Right align.
@ -322,7 +336,7 @@ class StoryMenuState extends MusicBeatState
changeDifficulty(-1); changeDifficulty(-1);
} }
if (FlxG.keys.justPressed.TAB) if (FlxG.keys.justPressed.TAB && modeText.visible)
{ {
switchMode(!displayingModdedLevels); switchMode(!displayingModdedLevels);
} }
@ -342,6 +356,11 @@ class StoryMenuState extends MusicBeatState
} }
} }
function hasModdedLevels():Bool
{
return LevelRegistry.instance.listModdedLevelIds().length > 0;
}
/** /**
* Changes the selected level. * Changes the selected level.
* @param change +1 (down), -1 (up) * @param change +1 (down), -1 (up)