mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 11:22:55 +00:00
freeplay polish + new text
This commit is contained in:
parent
bc783a278a
commit
642f272bce
|
@ -91,6 +91,12 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
|
|||
return _metadata.keys().array();
|
||||
}
|
||||
|
||||
// this returns false so that any new song can override this and return true when needed
|
||||
public function isSongNew(currentDifficulty:String):Bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to false if the song was edited in the charter and should not be saved as a high score.
|
||||
*/
|
||||
|
|
|
@ -859,6 +859,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
function rankAnimStart(fromResults:Null<FromResultsParams>):Void
|
||||
{
|
||||
busy = true;
|
||||
grpCapsules.members[curSelected].sparkle.alpha = 0;
|
||||
// grpCapsules.members[curSelected].forcePosition();
|
||||
|
||||
if (fromResults != null)
|
||||
|
@ -1088,6 +1089,8 @@ class FreeplayState extends MusicBeatSubState
|
|||
|
||||
// NOW we can interact with the menu
|
||||
busy = false;
|
||||
grpCapsules.members[curSelected].sparkle.alpha = 0.7;
|
||||
playCurSongPreview(capsule);
|
||||
}, null);
|
||||
|
||||
// FlxTween.tween(capsule, {"targetPos.x": capsule.targetPos.x - 50}, 0.6,
|
||||
|
@ -1814,7 +1817,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
|
||||
function changeSelection(change:Int = 0):Void
|
||||
{
|
||||
FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4);
|
||||
if (!prepForNewRank) FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4);
|
||||
|
||||
var prevSelected:Int = curSelected;
|
||||
|
||||
|
@ -1855,43 +1858,48 @@ class FreeplayState extends MusicBeatSubState
|
|||
if (index < curSelected) capsule.targetPos.y -= 100; // another 100 for good measure
|
||||
}
|
||||
|
||||
if (grpCapsules.countLiving() > 0)
|
||||
if (grpCapsules.countLiving() > 0 && !prepForNewRank)
|
||||
{
|
||||
if (curSelected == 0)
|
||||
{
|
||||
FunkinSound.playMusic('freeplayRandom',
|
||||
{
|
||||
startingVolume: 0.0,
|
||||
overrideExisting: true,
|
||||
restartTrack: false
|
||||
});
|
||||
FlxG.sound.music.fadeIn(2, 0, 0.8);
|
||||
}
|
||||
else
|
||||
{
|
||||
var potentiallyErect:String = (currentDifficulty == "erect") || (currentDifficulty == "nightmare") ? "-erect" : "";
|
||||
FunkinSound.playMusic(daSongCapsule.songData.songId,
|
||||
{
|
||||
startingVolume: 0.0,
|
||||
overrideExisting: true,
|
||||
restartTrack: false,
|
||||
pathsFunction: INST,
|
||||
suffix: potentiallyErect,
|
||||
partialParams:
|
||||
{
|
||||
loadPartial: true,
|
||||
start: 0.05,
|
||||
end: 0.25
|
||||
},
|
||||
onLoad: function() {
|
||||
FlxG.sound.music.fadeIn(2, 0, 0.4);
|
||||
}
|
||||
});
|
||||
}
|
||||
playCurSongPreview(daSongCapsule);
|
||||
grpCapsules.members[curSelected].selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function playCurSongPreview(daSongCapsule:SongMenuItem):Void
|
||||
{
|
||||
if (curSelected == 0)
|
||||
{
|
||||
FunkinSound.playMusic('freeplayRandom',
|
||||
{
|
||||
startingVolume: 0.0,
|
||||
overrideExisting: true,
|
||||
restartTrack: false
|
||||
});
|
||||
FlxG.sound.music.fadeIn(2, 0, 0.8);
|
||||
}
|
||||
else
|
||||
{
|
||||
var potentiallyErect:String = (currentDifficulty == "erect") || (currentDifficulty == "nightmare") ? "-erect" : "";
|
||||
FunkinSound.playMusic(daSongCapsule.songData.songId,
|
||||
{
|
||||
startingVolume: 0.0,
|
||||
overrideExisting: true,
|
||||
restartTrack: false,
|
||||
pathsFunction: INST,
|
||||
suffix: potentiallyErect,
|
||||
partialParams:
|
||||
{
|
||||
loadPartial: true,
|
||||
start: 0.05,
|
||||
end: 0.25
|
||||
},
|
||||
onLoad: function() {
|
||||
FlxG.sound.music.fadeIn(2, 0, 0.4);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an instance of `FreeplayState` that is above the `MainMenuState`.
|
||||
* @return The MainMenuState with the FreeplayState as a substate.
|
||||
|
@ -2004,6 +2012,8 @@ class FreeplaySongData
|
|||
*/
|
||||
public var isFav:Bool = false;
|
||||
|
||||
public var isNew:Bool = false;
|
||||
|
||||
var song:Song;
|
||||
|
||||
public var levelId(default, null):String = '';
|
||||
|
@ -2083,6 +2093,8 @@ class FreeplaySongData
|
|||
}
|
||||
|
||||
this.scoringRank = Save.instance.getSongRank(songId, currentDifficulty);
|
||||
|
||||
this.isNew = song.isSongNew(currentDifficulty);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ import flixel.tweens.FlxEase;
|
|||
import flixel.tweens.FlxTween;
|
||||
import flixel.addons.effects.FlxTrail;
|
||||
import funkin.play.scoring.Scoring.ScoringRank;
|
||||
import funkin.save.Save;
|
||||
import funkin.save.Save.SaveScoreData;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
class SongMenuItem extends FlxSpriteGroup
|
||||
|
@ -76,6 +78,10 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
|
||||
var impactThing:FunkinSprite;
|
||||
|
||||
public var sparkle:FlxSprite;
|
||||
|
||||
var sparkleTimer:FlxTimer;
|
||||
|
||||
public function new(x:Float, y:Float)
|
||||
{
|
||||
super(x, y);
|
||||
|
@ -110,7 +116,7 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
newText.animation.play('newAnim', true);
|
||||
newText.setGraphicSize(Std.int(newText.width * 0.9));
|
||||
|
||||
newText.visible = false;
|
||||
// newText.visible = false;
|
||||
|
||||
add(newText);
|
||||
|
||||
|
@ -153,6 +159,18 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
blurredRanking.shader = new GaussianBlurShader(1);
|
||||
add(blurredRanking);
|
||||
|
||||
sparkle = new FlxSprite(ranking.x, ranking.y);
|
||||
sparkle.frames = Paths.getSparrowAtlas('freeplay/sparkle');
|
||||
sparkle.animation.addByPrefix('sparkle', 'sparkle', 24, false);
|
||||
sparkle.animation.play('sparkle', true);
|
||||
sparkle.scale.set(0.8, 0.8);
|
||||
sparkle.blend = BlendMode.ADD;
|
||||
|
||||
sparkle.visible = false;
|
||||
sparkle.alpha = 0.7;
|
||||
|
||||
add(sparkle);
|
||||
|
||||
// ranking.loadGraphic(Paths.image('freeplay/ranks/' + rank));
|
||||
// ranking.scale.x = ranking.scale.y = realScaled;
|
||||
// ranking.alpha = 0.75;
|
||||
|
@ -218,6 +236,13 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
setVisibleGrp(false);
|
||||
}
|
||||
|
||||
function sparkleEffect(timer:FlxTimer):Void
|
||||
{
|
||||
sparkle.setPosition(FlxG.random.float(ranking.x - 20, ranking.x + 3), FlxG.random.float(ranking.y - 29, ranking.y + 4));
|
||||
sparkle.animation.play('sparkle', true);
|
||||
sparkleTimer = new FlxTimer().start(FlxG.random.float(1.2, 4.5), sparkleEffect);
|
||||
}
|
||||
|
||||
// no way to grab weeks rn, so this needs to be done :/
|
||||
// negative values mean weekends
|
||||
function checkWeek(name:String):Void
|
||||
|
@ -415,8 +440,17 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
|
||||
function updateScoringRank(newRank:Null<ScoringRank>):Void
|
||||
{
|
||||
if (sparkleTimer != null) sparkleTimer.cancel();
|
||||
sparkle.visible = false;
|
||||
|
||||
this.ranking.rank = newRank;
|
||||
this.blurredRanking.rank = newRank;
|
||||
|
||||
if (newRank == PERFECT_GOLD)
|
||||
{
|
||||
sparkleTimer = new FlxTimer().start(1, sparkleEffect);
|
||||
sparkle.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
function set_hsvShader(value:HSVShader):HSVShader
|
||||
|
@ -468,6 +502,7 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
updateBPM(Std.int(songData?.songStartingBpm) ?? 0);
|
||||
updateDifficultyRating(songData?.difficultyRating ?? 0);
|
||||
updateScoringRank(songData?.scoringRank);
|
||||
newText.visible = songData?.isNew;
|
||||
// Update opacity, offsets, etc.
|
||||
updateSelected();
|
||||
|
||||
|
|
Loading…
Reference in a new issue