Merge pull request #322 from FunkinCrew/storymode-nene-fix

hide storymode menu characters if they dont exist for the level
This commit is contained in:
Eric 2024-02-17 19:26:05 -05:00 committed by GitHub
commit 1c8fd7251c
3 changed files with 29 additions and 18 deletions

View File

@ -8,6 +8,9 @@ import flash.display.Sprite;
import flixel.system.FlxBasePreloader;
import openfl.display.Sprite;
import funkin.util.CLIUtil;
import openfl.text.TextField;
import openfl.text.TextFormat;
import flixel.system.FlxAssets;
@:bitmap("art/preloaderArt.png") class LogoImage extends BitmapData {}
@ -21,12 +24,26 @@ class Preloader extends FlxBasePreloader
}
var logo:Sprite;
var _text:TextField;
override function create():Void
{
this._width = Lib.current.stage.stageWidth;
this._height = Lib.current.stage.stageHeight;
_text = new TextField();
_text.width = 500;
_text.text = "Loading FNF";
_text.defaultTextFormat = new TextFormat(FlxAssets.FONT_DEFAULT, 16, 0xFFFFFFFF);
_text.embedFonts = true;
_text.selectable = false;
_text.multiline = false;
_text.wordWrap = false;
_text.autoSize = LEFT;
_text.x = 2;
_text.y = 2;
addChild(_text);
var ratio:Float = this._width / 2560; // This allows us to scale assets depending on the size of the screen.
logo = new Sprite();
@ -34,27 +51,14 @@ class Preloader extends FlxBasePreloader
logo.scaleX = logo.scaleY = ratio;
logo.x = ((this._width) / 2) - ((logo.width) / 2);
logo.y = (this._height / 2) - ((logo.height) / 2);
addChild(logo); // Adds the graphic to the NMEPreloader's buffer.
// addChild(logo); // Adds the graphic to the NMEPreloader's buffer.
super.create();
}
override function update(Percent:Float):Void
{
if (Percent < 69)
{
logo.scaleX += Percent / 1920;
logo.scaleY += Percent / 1920;
logo.x -= Percent * 0.6;
logo.y -= Percent / 2;
}
else
{
logo.scaleX = this._width / 1280;
logo.scaleY = this._width / 1280;
logo.x = ((this._width) / 2) - ((logo.width) / 2);
logo.y = (this._height / 2) - ((logo.height) / 2);
}
_text.text = "FNF: " + Math.round(Percent * 100) + "%";
super.update(Percent);
}

View File

@ -187,6 +187,10 @@ class Level implements IRegistryEntry<LevelData>
if (_data.props.length == 0) return props;
var hiddenProps:Array<LevelProp> = props.splice(_data.props.length - 1, props.length - 1);
for (hiddenProp in hiddenProps)
hiddenProp.visible = false;
for (propIndex in 0..._data.props.length)
{
var propData = _data.props[propIndex];
@ -198,6 +202,7 @@ class Level implements IRegistryEntry<LevelData>
{
existingProp.propData = propData;
existingProp.x = propData.offsets[0] + FlxG.width * 0.25 * propIndex;
existingProp.visible = true;
}
else
{

View File

@ -590,7 +590,9 @@ class StoryMenuState extends MusicBeatState
{
// Both the previous and current level were simple backgrounds.
// Fade between colors directly, rather than fading one background out and another in.
FlxTween.color(levelBackground, 0.4, previousColor, currentColor);
// cancels potential tween in progress, and tweens from there
FlxTween.cancelTweensOf(levelBackground);
FlxTween.color(levelBackground, 0.9, levelBackground.color, currentColor, {ease: FlxEase.quartOut});
}
else
{
@ -630,10 +632,10 @@ class StoryMenuState extends MusicBeatState
function updateProps():Void
{
for (prop in currentLevel.buildProps(levelProps.members))
for (ind => prop in currentLevel.buildProps(levelProps.members))
{
prop.zIndex = 1000;
levelProps.add(prop);
if (levelProps.members[ind] != prop) levelProps.replace(levelProps.members[ind], prop) ?? levelProps.add(prop);
}
refresh();