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:
parent
109676522a
commit
6f676a5896
|
@ -156,7 +156,10 @@ class Level implements IRegistryEntry<LevelData>
|
|||
for (propIndex in 0..._data.props.length)
|
||||
{
|
||||
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;
|
||||
props.push(propSprite);
|
||||
}
|
||||
|
|
|
@ -16,8 +16,10 @@ class LevelProp extends Bopper
|
|||
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 prop:LevelProp = new LevelProp(propData.danceEvery);
|
||||
|
||||
|
|
|
@ -52,6 +52,11 @@ class StoryMenuState extends MusicBeatState
|
|||
*/
|
||||
var scoreText:FlxText;
|
||||
|
||||
/**
|
||||
* The mode text at the top-middle.
|
||||
*/
|
||||
var modeText:FlxText;
|
||||
|
||||
/**
|
||||
* The list of songs on the left.
|
||||
*/
|
||||
|
@ -146,16 +151,22 @@ class StoryMenuState extends MusicBeatState
|
|||
|
||||
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.setFormat("VCR OSD Mono", 32);
|
||||
tracklistText.alignment = CENTER;
|
||||
tracklistText.color = 0xFFe55777;
|
||||
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.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, RIGHT);
|
||||
levelTitleText.alpha = 0.7;
|
||||
|
@ -256,7 +267,7 @@ class StoryMenuState extends MusicBeatState
|
|||
displayingModdedLevels = moddedLevels;
|
||||
buildLevelTitles();
|
||||
|
||||
changeLevel(0);
|
||||
changeLevel(999999); // Jump past the end of the list to the beginning.
|
||||
changeDifficulty(0);
|
||||
}
|
||||
|
||||
|
@ -268,6 +279,9 @@ class StoryMenuState extends MusicBeatState
|
|||
|
||||
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.x = FlxG.width - (levelTitleText.width + 10); // Right align.
|
||||
|
||||
|
@ -322,7 +336,7 @@ class StoryMenuState extends MusicBeatState
|
|||
changeDifficulty(-1);
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.TAB)
|
||||
if (FlxG.keys.justPressed.TAB && modeText.visible)
|
||||
{
|
||||
switchMode(!displayingModdedLevels);
|
||||
}
|
||||
|
@ -342,6 +356,11 @@ class StoryMenuState extends MusicBeatState
|
|||
}
|
||||
}
|
||||
|
||||
function hasModdedLevels():Bool
|
||||
{
|
||||
return LevelRegistry.instance.listModdedLevelIds().length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the selected level.
|
||||
* @param change +1 (down), -1 (up)
|
||||
|
|
Loading…
Reference in a new issue