2022-03-08 03:13:53 -05:00
|
|
|
package funkin;
|
2021-04-07 20:19:49 -04:00
|
|
|
|
2020-11-06 21:17:27 -05:00
|
|
|
import flash.text.TextField;
|
2021-08-21 20:45:03 -04:00
|
|
|
import flixel.FlxCamera;
|
|
|
|
import flixel.FlxGame;
|
2020-10-21 14:05:27 -04:00
|
|
|
import flixel.FlxSprite;
|
2021-06-07 21:14:50 -04:00
|
|
|
import flixel.FlxState;
|
2020-10-25 16:51:06 -04:00
|
|
|
import flixel.addons.display.FlxGridOverlay;
|
2021-10-21 23:08:48 -04:00
|
|
|
import flixel.addons.transition.FlxTransitionableState;
|
2022-09-26 18:22:45 -04:00
|
|
|
import flixel.addons.ui.FlxInputText;
|
2020-11-01 14:16:22 -05:00
|
|
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
2021-10-21 23:08:48 -04:00
|
|
|
import flixel.group.FlxGroup;
|
2021-12-07 17:41:18 -05:00
|
|
|
import flixel.group.FlxSpriteGroup;
|
2021-08-21 19:53:08 -04:00
|
|
|
import flixel.input.touch.FlxTouch;
|
2021-08-24 15:28:04 -04:00
|
|
|
import flixel.math.FlxAngle;
|
2020-11-06 21:17:27 -05:00
|
|
|
import flixel.math.FlxMath;
|
2021-08-24 15:28:04 -04:00
|
|
|
import flixel.math.FlxPoint;
|
2020-10-21 14:05:27 -04:00
|
|
|
import flixel.text.FlxText;
|
2021-10-21 23:08:48 -04:00
|
|
|
import flixel.tweens.FlxEase;
|
2021-03-02 00:46:28 -05:00
|
|
|
import flixel.tweens.FlxTween;
|
2020-11-06 21:17:27 -05:00
|
|
|
import flixel.util.FlxColor;
|
2021-10-21 23:08:48 -04:00
|
|
|
import flixel.util.FlxSpriteUtil;
|
2021-10-21 17:40:53 -04:00
|
|
|
import flixel.util.FlxTimer;
|
2022-03-23 23:27:48 -04:00
|
|
|
import funkin.Controls.Control;
|
2022-03-08 03:13:53 -05:00
|
|
|
import funkin.freeplayStuff.BGScrollingText;
|
|
|
|
import funkin.freeplayStuff.DJBoyfriend;
|
|
|
|
import funkin.freeplayStuff.FreeplayScore;
|
2022-09-27 04:37:42 -04:00
|
|
|
import funkin.freeplayStuff.LetterSort;
|
2022-03-08 03:13:53 -05:00
|
|
|
import funkin.freeplayStuff.SongMenuItem;
|
2022-03-25 22:30:37 -04:00
|
|
|
import funkin.play.HealthIcon;
|
2022-03-23 23:27:48 -04:00
|
|
|
import funkin.play.PlayState;
|
2022-03-08 03:13:53 -05:00
|
|
|
import funkin.shaderslmfao.AngleMask;
|
|
|
|
import funkin.shaderslmfao.PureColor;
|
|
|
|
import funkin.shaderslmfao.StrokeShader;
|
2022-03-23 23:27:48 -04:00
|
|
|
import lime.app.Future;
|
|
|
|
import lime.utils.Assets;
|
2020-10-21 14:05:27 -04:00
|
|
|
|
2021-01-14 23:33:12 -05:00
|
|
|
using StringTools;
|
|
|
|
|
2021-12-04 20:24:53 -05:00
|
|
|
class FreeplayState extends MusicBeatSubstate
|
2020-10-21 14:05:27 -04:00
|
|
|
{
|
2021-02-24 20:52:59 -05:00
|
|
|
var songs:Array<SongMetadata> = [];
|
2020-10-21 14:05:27 -04:00
|
|
|
|
2021-04-21 22:17:00 -04:00
|
|
|
// var selector:FlxText;
|
2020-10-21 14:05:27 -04:00
|
|
|
var curSelected:Int = 0;
|
2020-11-06 21:17:27 -05:00
|
|
|
var curDifficulty:Int = 1;
|
|
|
|
|
2021-12-06 00:13:11 -05:00
|
|
|
var fp:FreeplayScore;
|
2021-04-13 22:02:21 -04:00
|
|
|
var lerpScore:Float = 0;
|
2020-11-06 21:17:27 -05:00
|
|
|
var intendedScore:Int = 0;
|
2020-10-21 14:05:27 -04:00
|
|
|
|
2021-12-07 17:41:18 -05:00
|
|
|
var grpDifficulties:FlxSpriteGroup;
|
|
|
|
|
2021-04-10 11:21:04 -04:00
|
|
|
var coolColors:Array<Int> = [
|
|
|
|
0xff9271fd,
|
|
|
|
0xff9271fd,
|
|
|
|
0xff223344,
|
|
|
|
0xFF941653,
|
|
|
|
0xFFfc96d7,
|
|
|
|
0xFFa0d1ff,
|
|
|
|
0xffff78bf,
|
|
|
|
0xfff6b604
|
|
|
|
];
|
2021-03-02 00:46:28 -05:00
|
|
|
|
2020-11-01 14:16:22 -05:00
|
|
|
private var grpSongs:FlxTypedGroup<Alphabet>;
|
2021-10-21 17:40:53 -04:00
|
|
|
private var grpCapsules:FlxTypedGroup<SongMenuItem>;
|
2020-11-24 22:53:48 -05:00
|
|
|
private var curPlaying:Bool = false;
|
2020-11-01 14:16:22 -05:00
|
|
|
|
2021-03-01 23:58:19 -05:00
|
|
|
private var iconArray:Array<HealthIcon> = [];
|
|
|
|
|
2022-09-26 18:22:45 -04:00
|
|
|
var typing:FlxInputText;
|
|
|
|
|
2020-10-21 14:05:27 -04:00
|
|
|
override function create()
|
|
|
|
{
|
2021-10-21 23:08:48 -04:00
|
|
|
FlxTransitionableState.skipNextTransIn = true;
|
|
|
|
|
2021-05-06 06:54:57 -04:00
|
|
|
#if discord_rpc
|
|
|
|
// Updating Discord Rich Presence
|
|
|
|
DiscordClient.changePresence("In the Menus", null);
|
|
|
|
#end
|
|
|
|
|
|
|
|
var isDebug:Bool = false;
|
|
|
|
|
|
|
|
#if debug
|
|
|
|
isDebug = true;
|
|
|
|
addSong('Test', 1, 'bf-pixel');
|
2022-02-28 23:04:55 -05:00
|
|
|
addSong('Pyro', 4, 'bf');
|
2021-05-06 06:54:57 -04:00
|
|
|
#end
|
|
|
|
|
2021-02-24 20:52:59 -05:00
|
|
|
var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
|
|
|
|
|
|
|
|
for (i in 0...initSonglist.length)
|
|
|
|
{
|
2021-03-01 18:59:51 -05:00
|
|
|
songs.push(new SongMetadata(initSonglist[i], 1, 'gf'));
|
2021-02-24 20:52:59 -05:00
|
|
|
}
|
2021-01-14 23:33:12 -05:00
|
|
|
|
2021-03-04 19:36:56 -05:00
|
|
|
if (FlxG.sound.music != null)
|
|
|
|
{
|
|
|
|
if (!FlxG.sound.music.playing)
|
|
|
|
FlxG.sound.playMusic(Paths.music('freakyMenu'));
|
|
|
|
}
|
2020-11-01 14:16:22 -05:00
|
|
|
|
2021-03-01 18:59:51 -05:00
|
|
|
if (StoryMenuState.weekUnlocked[2] || isDebug)
|
|
|
|
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
|
|
|
|
|
2020-12-04 12:36:28 -05:00
|
|
|
if (StoryMenuState.weekUnlocked[2] || isDebug)
|
2021-03-13 13:43:11 -05:00
|
|
|
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky', 'spooky', 'monster']);
|
2020-11-01 14:16:22 -05:00
|
|
|
|
2020-12-11 06:45:00 -05:00
|
|
|
if (StoryMenuState.weekUnlocked[3] || isDebug)
|
2021-03-01 16:46:08 -05:00
|
|
|
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
|
2020-12-11 06:45:00 -05:00
|
|
|
|
2020-12-27 05:37:04 -05:00
|
|
|
if (StoryMenuState.weekUnlocked[4] || isDebug)
|
2021-03-01 16:46:08 -05:00
|
|
|
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);
|
2020-12-27 05:37:04 -05:00
|
|
|
|
2021-01-17 04:16:02 -05:00
|
|
|
if (StoryMenuState.weekUnlocked[5] || isDebug)
|
2021-03-01 16:46:08 -05:00
|
|
|
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);
|
2021-01-17 04:16:02 -05:00
|
|
|
|
2021-01-24 22:42:51 -05:00
|
|
|
if (StoryMenuState.weekUnlocked[6] || isDebug)
|
2021-03-01 16:46:08 -05:00
|
|
|
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
|
2021-01-24 22:42:51 -05:00
|
|
|
|
2021-03-04 03:00:48 -05:00
|
|
|
if (StoryMenuState.weekUnlocked[7] || isDebug)
|
|
|
|
addWeek(['Ugh', 'Guns', 'Stress'], 7, ['tankman']);
|
|
|
|
|
2021-09-22 16:04:34 -04:00
|
|
|
addWeek(["Darnell", "lit-up", "2hot"], 8, ['darnell']);
|
2021-09-22 21:09:28 -04:00
|
|
|
addWeek(["bro"], 1, ['gf']);
|
2021-09-06 14:50:04 -04:00
|
|
|
|
2020-10-21 14:05:27 -04:00
|
|
|
// LOAD MUSIC
|
|
|
|
|
|
|
|
// LOAD CHARACTERS
|
|
|
|
|
2021-08-21 20:45:03 -04:00
|
|
|
trace(FlxG.width);
|
|
|
|
trace(FlxG.camera.zoom);
|
|
|
|
trace(FlxG.camera.initialZoom);
|
|
|
|
trace(FlxCamera.defaultZoom);
|
|
|
|
trace(FlxG.initialZoom);
|
2020-10-25 16:51:06 -04:00
|
|
|
|
2021-10-21 23:08:48 -04:00
|
|
|
var pinkBack:FlxSprite = new FlxSprite().loadGraphic(Paths.image('freeplay/pinkBack'));
|
|
|
|
pinkBack.color = 0xFFffd4e9; // sets it to pink!
|
|
|
|
pinkBack.x -= pinkBack.width;
|
|
|
|
|
|
|
|
FlxTween.tween(pinkBack, {x: 0}, 0.6, {ease: FlxEase.quartOut});
|
|
|
|
add(pinkBack);
|
|
|
|
|
|
|
|
var orangeBackShit:FlxSprite = new FlxSprite(84, FlxG.height * 0.68).makeGraphic(Std.int(pinkBack.width), 50, 0xFFffd400);
|
|
|
|
add(orangeBackShit);
|
|
|
|
|
|
|
|
var alsoOrangeLOL:FlxSprite = new FlxSprite(0, orangeBackShit.y).makeGraphic(100, Std.int(orangeBackShit.height), 0xFFffd400);
|
|
|
|
add(alsoOrangeLOL);
|
|
|
|
|
|
|
|
FlxSpriteUtil.alphaMaskFlxSprite(orangeBackShit, pinkBack, orangeBackShit);
|
|
|
|
orangeBackShit.visible = false;
|
|
|
|
alsoOrangeLOL.visible = false;
|
|
|
|
|
|
|
|
var grpTxtScrolls:FlxGroup = new FlxGroup();
|
|
|
|
add(grpTxtScrolls);
|
|
|
|
grpTxtScrolls.visible = false;
|
|
|
|
|
|
|
|
var moreWays:BGScrollingText = new BGScrollingText(0, 200, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width);
|
|
|
|
moreWays.funnyColor = 0xFFfff383;
|
2021-12-06 00:13:11 -05:00
|
|
|
moreWays.speed = 4;
|
2021-10-21 23:08:48 -04:00
|
|
|
grpTxtScrolls.add(moreWays);
|
|
|
|
|
|
|
|
var funnyScroll:BGScrollingText = new BGScrollingText(0, 250, "BOYFRIEND", FlxG.width / 2);
|
|
|
|
funnyScroll.funnyColor = 0xFFff9963;
|
2021-12-06 00:13:11 -05:00
|
|
|
funnyScroll.speed = -1;
|
2021-10-21 23:08:48 -04:00
|
|
|
grpTxtScrolls.add(funnyScroll);
|
|
|
|
|
|
|
|
var txtNuts:BGScrollingText = new BGScrollingText(0, 300, "PROTECT YO NUTS", FlxG.width / 2);
|
|
|
|
grpTxtScrolls.add(txtNuts);
|
|
|
|
|
|
|
|
var funnyScroll2:BGScrollingText = new BGScrollingText(0, 340, "BOYFRIEND", FlxG.width / 2);
|
|
|
|
funnyScroll2.funnyColor = 0xFFff9963;
|
2021-12-06 00:13:11 -05:00
|
|
|
funnyScroll2.speed = -1.2;
|
2021-10-21 23:08:48 -04:00
|
|
|
grpTxtScrolls.add(funnyScroll2);
|
|
|
|
|
|
|
|
var moreWays2:BGScrollingText = new BGScrollingText(0, 400, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width);
|
|
|
|
moreWays2.funnyColor = 0xFFfff383;
|
2021-12-06 00:13:11 -05:00
|
|
|
moreWays2.speed = 4.4;
|
2021-10-21 23:08:48 -04:00
|
|
|
grpTxtScrolls.add(moreWays2);
|
|
|
|
|
|
|
|
var funnyScroll3:BGScrollingText = new BGScrollingText(0, orangeBackShit.y, "BOYFRIEND", FlxG.width / 2);
|
|
|
|
funnyScroll3.funnyColor = 0xFFff9963;
|
2021-12-06 00:13:11 -05:00
|
|
|
funnyScroll3.speed = -0.8;
|
2021-10-21 23:08:48 -04:00
|
|
|
grpTxtScrolls.add(funnyScroll3);
|
|
|
|
|
|
|
|
var dj:DJBoyfriend = new DJBoyfriend(0, -100);
|
|
|
|
add(dj);
|
|
|
|
|
2021-12-06 00:13:11 -05:00
|
|
|
var bgDad:FlxSprite = new FlxSprite(pinkBack.width * 0.75, 0).loadGraphic(Paths.image('freeplay/freeplayBGdad'));
|
2021-10-21 23:08:48 -04:00
|
|
|
bgDad.setGraphicSize(0, FlxG.height);
|
|
|
|
bgDad.updateHitbox();
|
|
|
|
bgDad.shader = new AngleMask();
|
2021-12-06 00:13:11 -05:00
|
|
|
bgDad.visible = false;
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2021-12-06 00:13:11 -05:00
|
|
|
var blackOverlayBullshitLOLXD:FlxSprite = new FlxSprite(FlxG.width).makeGraphic(Std.int(bgDad.width), Std.int(bgDad.height), FlxColor.BLACK);
|
|
|
|
add(blackOverlayBullshitLOLXD); // used to mask the text lol!
|
2021-12-04 01:19:25 -05:00
|
|
|
|
2021-10-21 23:08:48 -04:00
|
|
|
add(bgDad);
|
2021-12-06 00:13:11 -05:00
|
|
|
FlxTween.tween(blackOverlayBullshitLOLXD, {x: pinkBack.width * 0.75}, 1, {ease: FlxEase.quintOut});
|
2021-10-21 23:08:48 -04:00
|
|
|
|
|
|
|
blackOverlayBullshitLOLXD.shader = bgDad.shader;
|
|
|
|
|
2020-11-01 14:16:22 -05:00
|
|
|
grpSongs = new FlxTypedGroup<Alphabet>();
|
|
|
|
add(grpSongs);
|
|
|
|
|
2021-10-21 17:40:53 -04:00
|
|
|
grpCapsules = new FlxTypedGroup<SongMenuItem>();
|
|
|
|
add(grpCapsules);
|
|
|
|
|
2021-12-07 22:34:01 -05:00
|
|
|
grpDifficulties = new FlxSpriteGroup(-300, 80);
|
2021-12-07 17:41:18 -05:00
|
|
|
add(grpDifficulties);
|
|
|
|
|
|
|
|
grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayEasy')));
|
|
|
|
grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayNorm')));
|
|
|
|
grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayHard')));
|
|
|
|
|
|
|
|
grpDifficulties.group.forEach(function(spr)
|
|
|
|
{
|
|
|
|
spr.visible = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
grpDifficulties.group.members[curDifficulty].visible = true;
|
|
|
|
|
2021-10-21 23:08:48 -04:00
|
|
|
var overhangStuff:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 64, FlxColor.BLACK);
|
|
|
|
overhangStuff.y -= overhangStuff.height;
|
|
|
|
add(overhangStuff);
|
2021-12-04 01:19:25 -05:00
|
|
|
FlxTween.tween(overhangStuff, {y: 0}, 0.3, {ease: FlxEase.quartOut});
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2021-12-04 01:19:25 -05:00
|
|
|
var fnfFreeplay:FlxText = new FlxText(0, 12, 0, "FREEPLAY", 48);
|
2021-10-21 23:08:48 -04:00
|
|
|
fnfFreeplay.font = "VCR OSD Mono";
|
2021-12-04 01:19:25 -05:00
|
|
|
fnfFreeplay.visible = false;
|
2021-12-04 22:38:33 -05:00
|
|
|
var sillyStroke = new StrokeShader(0xFFFFFFFF, 2, 2);
|
|
|
|
fnfFreeplay.shader = sillyStroke;
|
2021-10-21 23:08:48 -04:00
|
|
|
add(fnfFreeplay);
|
|
|
|
|
2021-12-06 00:13:11 -05:00
|
|
|
fp = new FreeplayScore(420, 40, 100);
|
|
|
|
fp.visible = false;
|
|
|
|
add(fp);
|
|
|
|
|
2021-10-21 23:08:48 -04:00
|
|
|
dj.animHITsignal.add(function()
|
|
|
|
{
|
2021-12-07 19:29:26 -05:00
|
|
|
FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut});
|
|
|
|
|
2021-12-07 22:34:01 -05:00
|
|
|
add(new DifficultySelector(20, grpDifficulties.y - 10, false, controls));
|
|
|
|
add(new DifficultySelector(325, grpDifficulties.y - 10, true, controls));
|
2021-12-07 19:29:26 -05:00
|
|
|
|
2022-09-27 04:37:42 -04:00
|
|
|
var letterSort:LetterSort = new LetterSort(300, 100);
|
|
|
|
add(letterSort);
|
|
|
|
|
|
|
|
letterSort.changeSelectionCallback = (str) ->
|
|
|
|
{
|
2022-09-28 02:50:53 -04:00
|
|
|
switch (str)
|
|
|
|
{
|
|
|
|
case "fav":
|
|
|
|
generateSongList({filterType: FAVORITE}, true);
|
|
|
|
case "ALL":
|
|
|
|
generateSongList(null, true);
|
|
|
|
default:
|
|
|
|
generateSongList({filterType: STARTSWITH, filterData: str}, true);
|
|
|
|
}
|
2022-09-27 04:37:42 -04:00
|
|
|
};
|
|
|
|
|
2021-12-04 01:34:58 -05:00
|
|
|
new FlxTimer().start(1 / 24, function(handShit)
|
|
|
|
{
|
2021-12-04 22:38:33 -05:00
|
|
|
fnfFreeplay.visible = true;
|
2021-12-06 00:13:11 -05:00
|
|
|
fp.visible = true;
|
2021-12-06 00:41:10 -05:00
|
|
|
fp.updateScore(FlxG.random.int(0, 1000));
|
2021-12-04 01:34:58 -05:00
|
|
|
|
|
|
|
new FlxTimer().start(1.5 / 24, function(bold)
|
|
|
|
{
|
2021-12-04 22:38:33 -05:00
|
|
|
sillyStroke.width = 0;
|
|
|
|
sillyStroke.height = 0;
|
2021-12-04 01:34:58 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-10-21 23:08:48 -04:00
|
|
|
pinkBack.color = 0xFFffd863;
|
2021-12-04 01:34:58 -05:00
|
|
|
// fnfFreeplay.visible = true;
|
2021-12-06 00:13:11 -05:00
|
|
|
bgDad.visible = true;
|
2021-10-21 23:08:48 -04:00
|
|
|
orangeBackShit.visible = true;
|
|
|
|
alsoOrangeLOL.visible = true;
|
|
|
|
grpTxtScrolls.visible = true;
|
|
|
|
});
|
|
|
|
|
2022-09-26 18:22:45 -04:00
|
|
|
generateSongList();
|
|
|
|
|
|
|
|
// FlxG.sound.playMusic(Paths.music('title'), 0);
|
|
|
|
// FlxG.sound.music.fadeIn(2, 0, 0.8);
|
|
|
|
// selector = new FlxText();
|
|
|
|
|
|
|
|
// selector.size = 40;
|
|
|
|
// selector.text = ">";
|
|
|
|
// add(selector);
|
|
|
|
|
|
|
|
var swag:Alphabet = new Alphabet(1, 0, "swag");
|
|
|
|
|
|
|
|
// JUST DOIN THIS SHIT FOR TESTING!!!
|
|
|
|
/*
|
|
|
|
var md:String = Markdown.markdownToHtml(Assets.getText('CHANGELOG.md'));
|
|
|
|
|
|
|
|
var texFel:TextField = new TextField();
|
|
|
|
texFel.width = FlxG.width;
|
|
|
|
texFel.height = FlxG.height;
|
|
|
|
// texFel.
|
|
|
|
texFel.htmlText = md;
|
|
|
|
|
|
|
|
FlxG.stage.addChild(texFel);
|
|
|
|
|
|
|
|
trace(md);
|
|
|
|
*/
|
|
|
|
|
|
|
|
var funnyCam = new FlxCamera(0, 0, FlxG.width, FlxG.height);
|
|
|
|
funnyCam.bgColor = FlxColor.TRANSPARENT;
|
|
|
|
FlxG.cameras.add(funnyCam);
|
|
|
|
|
|
|
|
typing = new FlxInputText(100, 100);
|
|
|
|
add(typing);
|
|
|
|
|
|
|
|
typing.callback = function(txt, action)
|
|
|
|
{
|
2022-09-27 04:37:42 -04:00
|
|
|
// generateSongList(new EReg(txt.trim(), "ig"));
|
2022-09-26 18:22:45 -04:00
|
|
|
trace(action);
|
|
|
|
};
|
|
|
|
|
|
|
|
forEach(function(bs)
|
|
|
|
{
|
|
|
|
bs.cameras = [funnyCam];
|
|
|
|
});
|
|
|
|
|
|
|
|
super.create();
|
|
|
|
}
|
|
|
|
|
2022-09-28 02:50:53 -04:00
|
|
|
public function generateSongList(?filterStuff:SongFilter, ?force:Bool = false)
|
2022-09-26 18:22:45 -04:00
|
|
|
{
|
|
|
|
curSelected = 0;
|
|
|
|
|
|
|
|
grpCapsules.clear();
|
|
|
|
|
2022-09-27 04:37:42 -04:00
|
|
|
// var regexp:EReg = regexp;
|
2022-09-26 18:22:45 -04:00
|
|
|
var tempSongs:Array<SongMetadata> = songs;
|
|
|
|
|
2022-09-28 02:50:53 -04:00
|
|
|
if (filterStuff != null)
|
2022-09-26 18:22:45 -04:00
|
|
|
{
|
2022-09-28 02:50:53 -04:00
|
|
|
switch (filterStuff.filterType)
|
2022-09-27 04:37:42 -04:00
|
|
|
{
|
2022-09-28 02:50:53 -04:00
|
|
|
case STARTSWITH:
|
2022-09-27 04:37:42 -04:00
|
|
|
tempSongs = tempSongs.filter(str ->
|
|
|
|
{
|
2022-09-28 02:50:53 -04:00
|
|
|
return str.songName.toLowerCase().startsWith(filterStuff.filterData);
|
2022-09-27 04:37:42 -04:00
|
|
|
});
|
2022-09-28 02:50:53 -04:00
|
|
|
case ALL:
|
|
|
|
// no filter!
|
|
|
|
case FAVORITE:
|
|
|
|
tempSongs = tempSongs.filter(str ->
|
|
|
|
{
|
|
|
|
return str.isFav;
|
|
|
|
});
|
|
|
|
default:
|
|
|
|
// return all on default
|
2022-09-27 04:37:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (regexp != null)
|
|
|
|
// tempSongs = songs.filter(item -> regexp.match(item.songName));
|
|
|
|
|
|
|
|
// tempSongs.sort(function(a, b):Int
|
|
|
|
// {
|
|
|
|
// var tempA = a.songName.toUpperCase();
|
|
|
|
// var tempB = b.songName.toUpperCase();
|
|
|
|
|
|
|
|
// if (tempA < tempB)
|
|
|
|
// return -1;
|
|
|
|
// else if (tempA > tempB)
|
|
|
|
// return 1;
|
|
|
|
// else
|
|
|
|
// return 0;
|
|
|
|
// });
|
2022-09-26 18:22:45 -04:00
|
|
|
|
|
|
|
for (i in 0...tempSongs.length)
|
2020-10-21 14:05:27 -04:00
|
|
|
{
|
2022-09-26 18:22:45 -04:00
|
|
|
var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, (i * 150) + 160, tempSongs[i].songName);
|
2021-10-21 17:40:53 -04:00
|
|
|
funnyMenu.targetPos.x = funnyMenu.x;
|
|
|
|
funnyMenu.ID = i;
|
2021-12-04 01:19:25 -05:00
|
|
|
funnyMenu.alpha = 0.5;
|
|
|
|
funnyMenu.songText.visible = false;
|
2021-10-21 17:40:53 -04:00
|
|
|
|
2021-12-06 00:13:11 -05:00
|
|
|
fp.updateScore(0);
|
|
|
|
|
2021-12-04 22:52:21 -05:00
|
|
|
new FlxTimer().start((1 / 24) * i, function(doShit)
|
|
|
|
{
|
|
|
|
funnyMenu.doJumpIn = true;
|
|
|
|
});
|
|
|
|
|
2021-12-04 20:24:53 -05:00
|
|
|
new FlxTimer().start((0.09 * i) + 0.85, function(lerpTmr)
|
2021-10-21 17:40:53 -04:00
|
|
|
{
|
|
|
|
funnyMenu.doLerp = true;
|
|
|
|
});
|
|
|
|
|
2022-09-27 04:37:42 -04:00
|
|
|
if (!force)
|
|
|
|
{
|
|
|
|
new FlxTimer().start(((0.20 * i) / (1 + i)) + 0.75, function(swagShi)
|
|
|
|
{
|
|
|
|
funnyMenu.songText.visible = true;
|
|
|
|
funnyMenu.alpha = 1;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
2021-12-04 01:19:25 -05:00
|
|
|
{
|
|
|
|
funnyMenu.songText.visible = true;
|
|
|
|
funnyMenu.alpha = 1;
|
2022-09-27 04:37:42 -04:00
|
|
|
}
|
2021-12-04 01:19:25 -05:00
|
|
|
|
2021-10-21 17:40:53 -04:00
|
|
|
grpCapsules.add(funnyMenu);
|
|
|
|
|
2022-09-26 18:22:45 -04:00
|
|
|
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, tempSongs[i].songName, true, false);
|
2021-10-21 17:40:53 -04:00
|
|
|
songText.x += 100;
|
2020-11-01 14:16:22 -05:00
|
|
|
songText.isMenuItem = true;
|
|
|
|
songText.targetY = i;
|
2021-10-21 17:40:53 -04:00
|
|
|
|
|
|
|
// grpSongs.add(songText);
|
2021-03-01 18:59:51 -05:00
|
|
|
|
2022-09-26 18:22:45 -04:00
|
|
|
var icon:HealthIcon = new HealthIcon(tempSongs[i].songCharacter);
|
2022-03-25 22:30:37 -04:00
|
|
|
// icon.sprTracker = songText;
|
2021-03-01 23:58:19 -05:00
|
|
|
|
|
|
|
// using a FlxGroup is too much fuss!
|
|
|
|
iconArray.push(icon);
|
2021-10-21 17:40:53 -04:00
|
|
|
// add(icon);
|
2021-03-01 18:59:51 -05:00
|
|
|
|
2020-11-01 14:16:22 -05:00
|
|
|
// songText.x += 40;
|
2020-10-30 19:47:19 -04:00
|
|
|
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
|
|
|
// songText.screenCenter(X);
|
2020-10-21 14:05:27 -04:00
|
|
|
}
|
|
|
|
|
2020-11-01 14:16:22 -05:00
|
|
|
changeSelection();
|
2020-11-06 21:17:27 -05:00
|
|
|
changeDiff();
|
2020-10-21 14:05:27 -04:00
|
|
|
}
|
|
|
|
|
2021-03-01 16:46:08 -05:00
|
|
|
public function addSong(songName:String, weekNum:Int, songCharacter:String)
|
2021-02-24 20:52:59 -05:00
|
|
|
{
|
2021-03-01 16:46:08 -05:00
|
|
|
songs.push(new SongMetadata(songName, weekNum, songCharacter));
|
2021-02-24 20:52:59 -05:00
|
|
|
}
|
|
|
|
|
2021-03-01 16:46:08 -05:00
|
|
|
public function addWeek(songs:Array<String>, weekNum:Int, ?songCharacters:Array<String>)
|
2021-02-24 20:52:59 -05:00
|
|
|
{
|
2021-03-01 16:46:08 -05:00
|
|
|
if (songCharacters == null)
|
|
|
|
songCharacters = ['bf'];
|
|
|
|
|
|
|
|
var num:Int = 0;
|
2021-02-24 20:52:59 -05:00
|
|
|
for (song in songs)
|
|
|
|
{
|
2021-03-01 16:46:08 -05:00
|
|
|
addSong(song, weekNum, songCharacters[num]);
|
|
|
|
|
|
|
|
if (songCharacters.length != 1)
|
|
|
|
num++;
|
2021-02-24 20:52:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-21 19:53:08 -04:00
|
|
|
var touchY:Float = 0;
|
2021-08-22 16:54:22 -04:00
|
|
|
var touchX:Float = 0;
|
|
|
|
var dxTouch:Float = 0;
|
2021-08-21 19:53:08 -04:00
|
|
|
var dyTouch:Float = 0;
|
|
|
|
var velTouch:Float = 0;
|
|
|
|
|
|
|
|
var veloctiyLoopShit:Float = 0;
|
2021-08-21 20:45:03 -04:00
|
|
|
var touchTimer:Float = 0;
|
2021-08-21 19:53:08 -04:00
|
|
|
|
2021-08-24 15:28:04 -04:00
|
|
|
var initTouchPos:FlxPoint = new FlxPoint();
|
|
|
|
|
2022-09-27 04:53:34 -04:00
|
|
|
var spamTimer:Float = 0;
|
|
|
|
var spamming:Bool = false;
|
|
|
|
|
2020-10-21 14:05:27 -04:00
|
|
|
override function update(elapsed:Float)
|
|
|
|
{
|
2021-08-21 20:45:03 -04:00
|
|
|
super.update(elapsed);
|
|
|
|
|
2022-09-28 02:50:53 -04:00
|
|
|
if (FlxG.keys.justPressed.F)
|
|
|
|
{
|
|
|
|
songs[curSelected].isFav = !songs[curSelected].isFav;
|
|
|
|
if (songs[curSelected].isFav)
|
|
|
|
FlxTween.tween(grpCapsules.members[curSelected], {angle: 360}, 0.4, {ease: FlxEase.elasticOut});
|
|
|
|
else
|
|
|
|
FlxTween.tween(grpCapsules.members[curSelected], {angle: 0}, 0.4, {ease: FlxEase.elasticOut});
|
|
|
|
}
|
|
|
|
|
2022-09-26 18:22:45 -04:00
|
|
|
if (FlxG.keys.justPressed.T)
|
|
|
|
typing.hasFocus = true;
|
|
|
|
|
2021-08-21 20:45:03 -04:00
|
|
|
if (FlxG.sound.music != null)
|
|
|
|
{
|
|
|
|
if (FlxG.sound.music.volume < 0.7)
|
|
|
|
{
|
2022-03-13 14:36:03 -04:00
|
|
|
FlxG.sound.music.volume += 0.5 * elapsed;
|
2021-08-21 20:45:03 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-06 15:28:14 -05:00
|
|
|
lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.2);
|
2021-08-21 20:45:03 -04:00
|
|
|
|
2021-12-06 00:41:10 -05:00
|
|
|
fp.scoreShit = Std.int(lerpScore);
|
|
|
|
|
2021-08-21 20:45:03 -04:00
|
|
|
var upP = controls.UI_UP_P;
|
|
|
|
var downP = controls.UI_DOWN_P;
|
|
|
|
var accepted = controls.ACCEPT;
|
|
|
|
|
2021-08-21 19:53:08 -04:00
|
|
|
if (FlxG.onMobile)
|
|
|
|
{
|
2021-08-24 15:28:04 -04:00
|
|
|
for (touch in FlxG.touches.list)
|
|
|
|
{
|
|
|
|
if (touch.justPressed)
|
|
|
|
{
|
|
|
|
initTouchPos.set(touch.screenX, touch.screenY);
|
|
|
|
}
|
|
|
|
if (touch.pressed)
|
|
|
|
{
|
|
|
|
var dx = initTouchPos.x - touch.screenX;
|
|
|
|
var dy = initTouchPos.y - touch.screenY;
|
|
|
|
|
|
|
|
var angle = Math.atan2(dy, dx);
|
|
|
|
var length = Math.sqrt(dx * dx + dy * dy);
|
|
|
|
|
|
|
|
FlxG.watch.addQuick("LENGTH", length);
|
|
|
|
FlxG.watch.addQuick("ANGLE", Math.round(FlxAngle.asDegrees(angle)));
|
|
|
|
trace("ANGLE", Math.round(FlxAngle.asDegrees(angle)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* switch (inputID)
|
|
|
|
{
|
|
|
|
case FlxObject.UP:
|
|
|
|
return
|
|
|
|
case FlxObject.DOWN:
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2021-08-21 19:53:08 -04:00
|
|
|
if (FlxG.touches.getFirst() != null)
|
|
|
|
{
|
2021-08-21 20:45:03 -04:00
|
|
|
if (touchTimer >= 1.5)
|
|
|
|
accepted = true;
|
|
|
|
|
2022-03-13 14:36:03 -04:00
|
|
|
touchTimer += elapsed;
|
2021-08-21 19:53:08 -04:00
|
|
|
var touch:FlxTouch = FlxG.touches.getFirst();
|
|
|
|
|
|
|
|
velTouch = Math.abs((touch.screenY - dyTouch)) / 50;
|
|
|
|
|
|
|
|
dyTouch = touch.screenY - touchY;
|
2021-08-22 16:54:22 -04:00
|
|
|
dxTouch = touch.screenX - touchX;
|
2021-08-21 19:53:08 -04:00
|
|
|
|
|
|
|
if (touch.justPressed)
|
|
|
|
{
|
|
|
|
touchY = touch.screenY;
|
|
|
|
dyTouch = 0;
|
|
|
|
velTouch = 0;
|
2021-08-22 16:54:22 -04:00
|
|
|
|
|
|
|
touchX = touch.screenX;
|
|
|
|
dxTouch = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Math.abs(dxTouch) >= 100)
|
|
|
|
{
|
|
|
|
touchX = touch.screenX;
|
|
|
|
if (dxTouch != 0)
|
|
|
|
dxTouch < 0 ? changeDiff(1) : changeDiff(-1);
|
2021-08-21 19:53:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (Math.abs(dyTouch) >= 100)
|
|
|
|
{
|
|
|
|
touchY = touch.screenY;
|
|
|
|
|
|
|
|
if (dyTouch != 0)
|
|
|
|
dyTouch < 0 ? changeSelection(1) : changeSelection(-1);
|
|
|
|
// changeSelection(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-08-21 20:45:03 -04:00
|
|
|
touchTimer = 0;
|
2021-08-21 19:53:08 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-17 01:20:00 -04:00
|
|
|
#if mobile
|
|
|
|
for (touch in FlxG.touches.list)
|
|
|
|
{
|
|
|
|
if (touch.justPressed)
|
|
|
|
{
|
2021-08-21 19:53:08 -04:00
|
|
|
// accepted = true;
|
2021-08-17 01:20:00 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#end
|
|
|
|
|
2022-09-27 04:53:34 -04:00
|
|
|
if (controls.UI_UP || controls.UI_DOWN)
|
|
|
|
{
|
|
|
|
spamTimer += elapsed;
|
|
|
|
|
|
|
|
if (spamming)
|
|
|
|
{
|
|
|
|
if (spamTimer >= 0.07)
|
|
|
|
{
|
|
|
|
spamTimer = 0;
|
|
|
|
|
|
|
|
if (controls.UI_UP)
|
|
|
|
changeSelection(-1);
|
|
|
|
else
|
|
|
|
changeSelection(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (spamTimer >= 0.9)
|
|
|
|
spamming = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
spamming = false;
|
|
|
|
spamTimer = 0;
|
|
|
|
}
|
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
if (upP)
|
2020-11-01 14:16:22 -05:00
|
|
|
changeSelection(-1);
|
2020-10-30 19:47:19 -04:00
|
|
|
if (downP)
|
2020-11-01 14:16:22 -05:00
|
|
|
changeSelection(1);
|
2020-10-21 14:05:27 -04:00
|
|
|
|
2021-04-07 20:19:49 -04:00
|
|
|
if (FlxG.mouse.wheel != 0)
|
|
|
|
changeSelection(-Math.round(FlxG.mouse.wheel / 4));
|
|
|
|
|
2021-03-13 21:11:56 -05:00
|
|
|
if (controls.UI_LEFT_P)
|
2020-11-06 21:17:27 -05:00
|
|
|
changeDiff(-1);
|
2021-03-13 21:11:56 -05:00
|
|
|
if (controls.UI_RIGHT_P)
|
2020-11-06 21:17:27 -05:00
|
|
|
changeDiff(1);
|
|
|
|
|
2022-09-26 18:22:45 -04:00
|
|
|
if (controls.BACK && !typing.hasFocus)
|
2020-11-01 14:16:22 -05:00
|
|
|
{
|
2021-04-15 10:19:02 -04:00
|
|
|
FlxG.sound.play(Paths.sound('cancelMenu'));
|
2022-03-23 23:27:48 -04:00
|
|
|
|
|
|
|
FlxTransitionableState.skipNextTransIn = true;
|
|
|
|
FlxTransitionableState.skipNextTransOut = true;
|
2022-02-28 23:04:55 -05:00
|
|
|
FlxG.switchState(new MainMenuState());
|
2020-11-01 14:16:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (accepted)
|
|
|
|
{
|
2021-09-10 10:07:55 -04:00
|
|
|
// if (Assets.exists())
|
|
|
|
|
2021-12-06 20:35:15 -05:00
|
|
|
var poop:String = songs[curSelected].songName.toLowerCase();
|
2021-09-10 10:07:55 -04:00
|
|
|
|
2021-09-21 15:39:30 -04:00
|
|
|
// does not work properly, always just accidentally sets it to normal anyways!
|
|
|
|
/* if (!Assets.exists(Paths.json(songs[curSelected].songName + '/' + poop)))
|
|
|
|
{
|
|
|
|
// defaults to normal if HARD / EASY doesn't exist
|
|
|
|
// does not account if NORMAL doesn't exist!
|
|
|
|
FlxG.log.warn("CURRENT DIFFICULTY IS NOT CHARTED, DEFAULTING TO NORMAL!");
|
|
|
|
poop = Highscore.formatSong(songs[curSelected].songName.toLowerCase(), 1);
|
|
|
|
curDifficulty = 1;
|
|
|
|
}*/
|
|
|
|
|
2022-03-11 01:30:01 -05:00
|
|
|
PlayState.currentSong = SongLoad.loadFromJson(poop, songs[curSelected].songName.toLowerCase());
|
2020-11-01 14:16:22 -05:00
|
|
|
PlayState.isStoryMode = false;
|
2020-11-06 21:17:27 -05:00
|
|
|
PlayState.storyDifficulty = curDifficulty;
|
2021-12-03 07:29:47 -05:00
|
|
|
// SongLoad.curDiff = Highscore.formatSong()
|
2021-12-06 20:35:15 -05:00
|
|
|
|
|
|
|
SongLoad.curDiff = switch (curDifficulty)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
'easy';
|
|
|
|
case 1:
|
|
|
|
'normal';
|
|
|
|
case 2:
|
|
|
|
'hard';
|
|
|
|
default: 'normal';
|
|
|
|
};
|
2021-02-24 20:22:37 -05:00
|
|
|
|
2021-02-24 20:52:59 -05:00
|
|
|
PlayState.storyWeek = songs[curSelected].week;
|
2021-12-06 20:35:15 -05:00
|
|
|
trace(' CUR WEEK ' + PlayState.storyWeek);
|
2021-02-09 13:07:05 -05:00
|
|
|
LoadingState.loadAndSwitchState(new PlayState());
|
2020-11-06 21:17:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-07 21:14:50 -04:00
|
|
|
override function switchTo(nextState:FlxState):Bool
|
|
|
|
{
|
|
|
|
clearDaCache(songs[curSelected].songName);
|
|
|
|
return super.switchTo(nextState);
|
|
|
|
}
|
|
|
|
|
2020-11-06 21:17:27 -05:00
|
|
|
function changeDiff(change:Int = 0)
|
|
|
|
{
|
2021-08-24 15:28:04 -04:00
|
|
|
touchTimer = 0;
|
|
|
|
|
2020-11-06 21:17:27 -05:00
|
|
|
curDifficulty += change;
|
|
|
|
|
|
|
|
if (curDifficulty < 0)
|
|
|
|
curDifficulty = 2;
|
|
|
|
if (curDifficulty > 2)
|
|
|
|
curDifficulty = 0;
|
|
|
|
|
2021-12-06 00:41:10 -05:00
|
|
|
// intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
|
2022-09-23 14:26:50 -04:00
|
|
|
intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
|
2020-11-06 21:17:27 -05:00
|
|
|
|
2021-03-02 00:46:28 -05:00
|
|
|
PlayState.storyDifficulty = curDifficulty;
|
|
|
|
|
2021-12-07 17:41:18 -05:00
|
|
|
grpDifficulties.group.forEach(function(spr)
|
|
|
|
{
|
|
|
|
spr.visible = false;
|
|
|
|
});
|
|
|
|
|
2021-12-07 19:29:26 -05:00
|
|
|
var curShit:FlxSprite = grpDifficulties.group.members[curDifficulty];
|
2021-12-07 17:41:18 -05:00
|
|
|
|
2021-12-07 19:29:26 -05:00
|
|
|
curShit.visible = true;
|
|
|
|
curShit.offset.y += 5;
|
2021-12-07 22:34:01 -05:00
|
|
|
curShit.alpha = 0.5;
|
2021-12-07 19:29:26 -05:00
|
|
|
new FlxTimer().start(1 / 24, function(swag)
|
|
|
|
{
|
2021-12-07 22:34:01 -05:00
|
|
|
curShit.alpha = 1;
|
2021-12-07 19:29:26 -05:00
|
|
|
curShit.updateHitbox();
|
|
|
|
});
|
2020-11-01 14:16:22 -05:00
|
|
|
}
|
|
|
|
|
2021-12-06 20:35:15 -05:00
|
|
|
// Clears the cache of songs, frees up memory, they' ll have to be loaded in later tho function clearDaCache(actualSongTho:String)
|
2021-06-07 21:14:50 -04:00
|
|
|
function clearDaCache(actualSongTho:String)
|
|
|
|
{
|
|
|
|
for (song in songs)
|
|
|
|
{
|
|
|
|
if (song.songName != actualSongTho)
|
|
|
|
{
|
|
|
|
trace('trying to remove: ' + song.songName);
|
2021-08-10 02:40:47 -04:00
|
|
|
// openfl.Assets.cache.clear(Paths.inst(song.songName));
|
2021-06-07 21:14:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-01 14:16:22 -05:00
|
|
|
function changeSelection(change:Int = 0)
|
|
|
|
{
|
2021-12-06 00:41:10 -05:00
|
|
|
// fp.updateScore(12345);
|
2021-12-06 00:13:11 -05:00
|
|
|
|
2020-11-06 21:17:27 -05:00
|
|
|
NGio.logEvent('Fresh');
|
|
|
|
|
2020-11-24 22:53:48 -05:00
|
|
|
// NGio.logEvent('Fresh');
|
2021-02-08 16:34:48 -05:00
|
|
|
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
|
2020-11-24 22:53:48 -05:00
|
|
|
|
2020-11-01 14:16:22 -05:00
|
|
|
curSelected += change;
|
2020-10-26 19:06:42 -04:00
|
|
|
|
2020-10-21 14:05:27 -04:00
|
|
|
if (curSelected < 0)
|
2022-09-27 04:37:42 -04:00
|
|
|
curSelected = grpCapsules.members.length - 1;
|
|
|
|
if (curSelected >= grpCapsules.members.length)
|
2020-10-21 14:05:27 -04:00
|
|
|
curSelected = 0;
|
|
|
|
|
2020-11-01 14:16:22 -05:00
|
|
|
// selector.y = (70 * curSelected) + 30;
|
2020-10-21 14:05:27 -04:00
|
|
|
|
2021-12-06 00:41:10 -05:00
|
|
|
// intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
|
|
|
|
intendedScore = FlxG.random.int(0, 1000000);
|
2020-11-06 21:17:27 -05:00
|
|
|
// lerpScore = 0;
|
|
|
|
|
2021-02-10 15:18:14 -05:00
|
|
|
#if PRELOAD_ALL
|
2021-08-21 19:53:08 -04:00
|
|
|
// FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0);
|
2021-02-10 15:18:14 -05:00
|
|
|
#end
|
2020-11-24 22:53:48 -05:00
|
|
|
|
2020-11-01 14:16:22 -05:00
|
|
|
var bullShit:Int = 0;
|
|
|
|
|
2021-03-01 23:58:19 -05:00
|
|
|
for (i in 0...iconArray.length)
|
|
|
|
{
|
|
|
|
iconArray[i].alpha = 0.6;
|
|
|
|
}
|
|
|
|
|
|
|
|
iconArray[curSelected].alpha = 1;
|
|
|
|
|
2021-10-21 17:40:53 -04:00
|
|
|
for (index => capsule in grpCapsules.members)
|
2020-10-21 19:33:43 -04:00
|
|
|
{
|
2021-10-21 17:40:53 -04:00
|
|
|
capsule.selected = false;
|
2020-11-01 14:16:22 -05:00
|
|
|
|
2021-10-21 17:40:53 -04:00
|
|
|
capsule.targetPos.y = ((index - curSelected) * 150) + 160;
|
2021-12-04 20:24:53 -05:00
|
|
|
capsule.targetPos.x = 270 + (60 * (Math.sin(index - curSelected)));
|
|
|
|
// capsule.targetPos.x = 320 + (40 * (index - curSelected));
|
2021-12-07 19:29:26 -05:00
|
|
|
|
|
|
|
if (index < curSelected)
|
|
|
|
capsule.targetPos.y -= 100; // another 100 for good measure
|
2020-11-01 14:16:22 -05:00
|
|
|
}
|
2021-10-21 17:40:53 -04:00
|
|
|
|
2022-09-27 04:37:42 -04:00
|
|
|
if (grpCapsules.members.length > 0)
|
|
|
|
grpCapsules.members[curSelected].selected = true;
|
2020-10-21 14:05:27 -04:00
|
|
|
}
|
2021-12-07 19:29:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
class DifficultySelector extends FlxSprite
|
|
|
|
{
|
|
|
|
var controls:Controls;
|
2021-12-07 22:34:01 -05:00
|
|
|
var whiteShader:PureColor;
|
2021-12-07 19:29:26 -05:00
|
|
|
|
|
|
|
public function new(x:Float, y:Float, flipped:Bool, controls:Controls)
|
|
|
|
{
|
|
|
|
super(x, y);
|
|
|
|
|
|
|
|
this.controls = controls;
|
|
|
|
|
|
|
|
frames = Paths.getSparrowAtlas('freeplay/freeplaySelector');
|
|
|
|
animation.addByPrefix('shine', "arrow pointer loop", 24);
|
|
|
|
animation.play('shine');
|
|
|
|
|
2021-12-07 22:34:01 -05:00
|
|
|
whiteShader = new PureColor(FlxColor.WHITE);
|
|
|
|
|
|
|
|
shader = whiteShader;
|
|
|
|
|
2021-12-07 19:29:26 -05:00
|
|
|
flipX = flipped;
|
|
|
|
}
|
2021-04-08 17:29:31 -04:00
|
|
|
|
2021-12-07 19:29:26 -05:00
|
|
|
override function update(elapsed:Float)
|
|
|
|
{
|
|
|
|
if (flipX && controls.UI_RIGHT_P)
|
|
|
|
moveShitDown();
|
|
|
|
if (!flipX && controls.UI_LEFT_P)
|
|
|
|
moveShitDown();
|
|
|
|
|
|
|
|
super.update(elapsed);
|
|
|
|
}
|
|
|
|
|
|
|
|
function moveShitDown()
|
2021-04-08 17:29:31 -04:00
|
|
|
{
|
2021-12-07 19:29:26 -05:00
|
|
|
offset.y -= 5;
|
2021-04-08 17:29:31 -04:00
|
|
|
|
2021-12-07 22:34:01 -05:00
|
|
|
whiteShader.colorSet = true;
|
|
|
|
|
2021-12-07 19:29:26 -05:00
|
|
|
new FlxTimer().start(2 / 24, function(tmr)
|
|
|
|
{
|
2021-12-07 22:34:01 -05:00
|
|
|
whiteShader.colorSet = false;
|
2021-12-07 19:29:26 -05:00
|
|
|
updateHitbox();
|
|
|
|
});
|
2021-04-08 17:29:31 -04:00
|
|
|
}
|
2020-10-21 14:05:27 -04:00
|
|
|
}
|
2021-02-24 20:52:59 -05:00
|
|
|
|
2022-09-28 02:50:53 -04:00
|
|
|
typedef SongFilter =
|
|
|
|
{
|
|
|
|
var filterType:FilterType;
|
|
|
|
var ?filterData:Dynamic;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum abstract FilterType(String)
|
|
|
|
{
|
|
|
|
var STARTSWITH;
|
|
|
|
var FAVORITE;
|
|
|
|
var ALL;
|
|
|
|
}
|
|
|
|
|
2021-02-24 20:52:59 -05:00
|
|
|
class SongMetadata
|
|
|
|
{
|
|
|
|
public var songName:String = "";
|
|
|
|
public var week:Int = 0;
|
2021-03-01 16:46:08 -05:00
|
|
|
public var songCharacter:String = "";
|
2022-09-28 02:50:53 -04:00
|
|
|
public var isFav:Bool = false;
|
2021-02-24 20:52:59 -05:00
|
|
|
|
2022-09-28 02:50:53 -04:00
|
|
|
public function new(song:String, week:Int, songCharacter:String, ?isFav:Bool = false)
|
2021-02-24 20:52:59 -05:00
|
|
|
{
|
|
|
|
this.songName = song;
|
|
|
|
this.week = week;
|
2021-03-01 16:46:08 -05:00
|
|
|
this.songCharacter = songCharacter;
|
2022-09-28 02:50:53 -04:00
|
|
|
this.isFav = isFav;
|
2021-02-24 20:52:59 -05:00
|
|
|
}
|
|
|
|
}
|