mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-22 18:09:33 +00:00
Add a .visible attribute to story weeks.
This commit is contained in:
parent
dc50a4ba5e
commit
a8a2dc83d3
|
@ -5,5 +5,8 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.1.0]
|
||||||
|
- Added `visible` attribute.
|
||||||
|
|
||||||
## [1.0.0]
|
## [1.0.0]
|
||||||
Initial release.
|
Initial release.
|
||||||
|
|
|
@ -34,6 +34,14 @@ typedef LevelData =
|
||||||
@:default([])
|
@:default([])
|
||||||
var props:Array<LevelPropData>;
|
var props:Array<LevelPropData>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this week is visible in the story menu.
|
||||||
|
* @default `true`
|
||||||
|
*/
|
||||||
|
@:default(true)
|
||||||
|
@:optional
|
||||||
|
var visible:Bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of song IDs included in this level.
|
* The list of song IDs included in this level.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,7 +12,7 @@ class LevelRegistry extends BaseRegistry<Level, LevelData>
|
||||||
* Handle breaking changes by incrementing this value
|
* Handle breaking changes by incrementing this value
|
||||||
* and adding migration to the `migrateLevelData()` function.
|
* and adding migration to the `migrateLevelData()` function.
|
||||||
*/
|
*/
|
||||||
public static final LEVEL_DATA_VERSION:thx.semver.Version = "1.0.0";
|
public static final LEVEL_DATA_VERSION:thx.semver.Version = "1.0.1";
|
||||||
|
|
||||||
public static final LEVEL_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
public static final LEVEL_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ class Level implements IRegistryEntry<LevelData>
|
||||||
*/
|
*/
|
||||||
public function isVisible():Bool
|
public function isVisible():Bool
|
||||||
{
|
{
|
||||||
return true;
|
return _data.visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -97,6 +97,11 @@ class StoryMenuState extends MusicBeatState
|
||||||
*/
|
*/
|
||||||
var difficultySprite:FlxSprite;
|
var difficultySprite:FlxSprite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of available level IDs.
|
||||||
|
*/
|
||||||
|
var levelList:Array<String> = [];
|
||||||
|
|
||||||
var difficultySprites:Map<String, FlxSprite>;
|
var difficultySprites:Map<String, FlxSprite>;
|
||||||
|
|
||||||
var stickerSubState:StickerSubState;
|
var stickerSubState:StickerSubState;
|
||||||
|
@ -118,6 +123,15 @@ class StoryMenuState extends MusicBeatState
|
||||||
{
|
{
|
||||||
super.create();
|
super.create();
|
||||||
|
|
||||||
|
levelList = LevelRegistry.instance.listSortedLevelIds();
|
||||||
|
levelList = levelList.filter(function(id) {
|
||||||
|
var levelData = LevelRegistry.instance.fetchEntry(id);
|
||||||
|
if (levelData == null) return false;
|
||||||
|
|
||||||
|
return levelData.isVisible();
|
||||||
|
});
|
||||||
|
if (levelList.length == 0) levelList = ['tutorial']; // Make sure there's at least one level to display.
|
||||||
|
|
||||||
difficultySprites = new Map<String, FlxSprite>();
|
difficultySprites = new Map<String, FlxSprite>();
|
||||||
|
|
||||||
transIn = FlxTransitionableState.defaultTransIn;
|
transIn = FlxTransitionableState.defaultTransIn;
|
||||||
|
@ -273,14 +287,13 @@ class StoryMenuState extends MusicBeatState
|
||||||
{
|
{
|
||||||
levelTitles.clear();
|
levelTitles.clear();
|
||||||
|
|
||||||
var levelIds:Array<String> = LevelRegistry.instance.listSortedLevelIds();
|
for (levelIndex in 0...levelList.length)
|
||||||
if (levelIds.length == 0) levelIds = ['tutorial']; // Make sure there's at least one level to display.
|
|
||||||
|
|
||||||
for (levelIndex in 0...levelIds.length)
|
|
||||||
{
|
{
|
||||||
var levelId:String = levelIds[levelIndex];
|
var levelId:String = levelList[levelIndex];
|
||||||
var level:Level = LevelRegistry.instance.fetchEntry(levelId);
|
var level:Level = LevelRegistry.instance.fetchEntry(levelId);
|
||||||
if (level == null) continue;
|
if (level == null || !level.isVisible()) continue;
|
||||||
|
|
||||||
|
// TODO: Readd lock icon if unlocked is false.
|
||||||
|
|
||||||
var levelTitleItem:LevelTitle = new LevelTitle(0, Std.int(levelBackground.y + levelBackground.height + 10), level);
|
var levelTitleItem:LevelTitle = new LevelTitle(0, Std.int(levelBackground.y + levelBackground.height + 10), level);
|
||||||
levelTitleItem.targetY = ((levelTitleItem.height + 20) * levelIndex);
|
levelTitleItem.targetY = ((levelTitleItem.height + 20) * levelIndex);
|
||||||
|
@ -373,9 +386,6 @@ class StoryMenuState extends MusicBeatState
|
||||||
*/
|
*/
|
||||||
function changeLevel(change:Int = 0):Void
|
function changeLevel(change:Int = 0):Void
|
||||||
{
|
{
|
||||||
var levelList:Array<String> = LevelRegistry.instance.listSortedLevelIds();
|
|
||||||
if (levelList.length == 0) levelList = ['tutorial'];
|
|
||||||
|
|
||||||
var currentIndex:Int = levelList.indexOf(currentLevelId);
|
var currentIndex:Int = levelList.indexOf(currentLevelId);
|
||||||
|
|
||||||
currentIndex += change;
|
currentIndex += change;
|
||||||
|
|
Loading…
Reference in a new issue