2022-03-08 03:13:53 -05:00
|
|
|
package funkin;
|
2020-10-30 19:47:19 -04:00
|
|
|
|
|
|
|
import flixel.FlxSprite;
|
2021-02-12 01:20:20 -05:00
|
|
|
import flixel.addons.transition.FlxTransitionableState;
|
2020-10-30 19:47:19 -04:00
|
|
|
import flixel.graphics.frames.FlxAtlasFrames;
|
|
|
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
|
|
|
import flixel.group.FlxGroup;
|
2020-11-06 21:17:27 -05:00
|
|
|
import flixel.math.FlxMath;
|
2020-10-30 19:47:19 -04:00
|
|
|
import flixel.text.FlxText;
|
2020-10-31 21:11:14 -04:00
|
|
|
import flixel.tweens.FlxTween;
|
2020-12-27 05:57:45 -05:00
|
|
|
import flixel.util.FlxColor;
|
2020-10-31 21:11:14 -04:00
|
|
|
import flixel.util.FlxTimer;
|
2022-08-25 01:35:47 -04:00
|
|
|
import funkin.MenuItem.WeekType;
|
2022-03-08 03:13:53 -05:00
|
|
|
import funkin.play.PlayState;
|
2022-08-22 20:18:54 -04:00
|
|
|
import lime.net.curl.CURLCode;
|
2022-08-25 01:35:47 -04:00
|
|
|
import openfl.Assets;
|
2020-10-30 19:47:19 -04:00
|
|
|
|
|
|
|
using StringTools;
|
|
|
|
|
2022-08-25 01:35:47 -04:00
|
|
|
#if discord_rpc
|
|
|
|
import Discord.DiscordClient;
|
|
|
|
#end
|
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
class StoryMenuState extends MusicBeatState
|
|
|
|
{
|
|
|
|
var scoreText:FlxText;
|
|
|
|
|
2022-03-06 02:37:38 -05:00
|
|
|
var weekData:Array<Array<String>> = [
|
2021-01-20 05:31:43 -05:00
|
|
|
['Tutorial'],
|
2020-12-11 04:15:24 -05:00
|
|
|
['Bopeebo', 'Fresh', 'Dadbattle'],
|
2021-02-24 20:22:37 -05:00
|
|
|
['Spookeez', 'South', "Monster"],
|
2020-12-27 05:37:04 -05:00
|
|
|
['Pico', 'Philly', "Blammed"],
|
2021-01-20 05:31:43 -05:00
|
|
|
['Satin-Panties', "High", "Milf"],
|
2021-02-02 02:20:14 -05:00
|
|
|
['Cocoa', 'Eggnog', 'Winter-Horrorland'],
|
2021-04-09 16:37:54 -04:00
|
|
|
['Senpai', 'Roses', 'Thorns'],
|
2022-08-22 20:18:54 -04:00
|
|
|
['Ugh', 'Guns', 'Stress'],
|
|
|
|
['Darnell', "lit-up", "2hot"]
|
2020-12-11 04:15:24 -05:00
|
|
|
];
|
2020-10-31 21:11:14 -04:00
|
|
|
var curDifficulty:Int = 1;
|
2020-10-30 19:47:19 -04:00
|
|
|
|
2022-03-21 00:19:05 -04:00
|
|
|
// TODO: This info is just hardcoded right now.
|
|
|
|
// We should probably make it so that weeks must be completed in order to unlock the next week.
|
2022-08-22 20:18:54 -04:00
|
|
|
public static var weekUnlocked:Array<Bool> = [true, true, true, true, true, true, true, true, true];
|
2020-10-31 21:11:14 -04:00
|
|
|
|
2020-12-11 04:15:24 -05:00
|
|
|
var weekCharacters:Array<Dynamic> = [
|
|
|
|
['dad', 'bf', 'gf'],
|
|
|
|
['dad', 'bf', 'gf'],
|
|
|
|
['spooky', 'bf', 'gf'],
|
2020-12-27 05:37:04 -05:00
|
|
|
['pico', 'bf', 'gf'],
|
2021-01-20 05:31:43 -05:00
|
|
|
['mom', 'bf', 'gf'],
|
2021-02-02 02:20:14 -05:00
|
|
|
['parents-christmas', 'bf', 'gf'],
|
2021-04-09 16:37:54 -04:00
|
|
|
['senpai', 'bf', 'gf'],
|
2022-03-26 22:18:26 -04:00
|
|
|
['tankman', 'bf', 'gf'],
|
2022-08-25 01:35:47 -04:00
|
|
|
['darnell', 'pico', 'nene']
|
2020-12-11 04:15:24 -05:00
|
|
|
];
|
2021-02-02 02:20:14 -05:00
|
|
|
|
|
|
|
var weekNames:Array<String> = [
|
|
|
|
"",
|
|
|
|
"Daddy Dearest",
|
|
|
|
"Spooky Month",
|
|
|
|
"PICO",
|
|
|
|
"MOMMY MUST MURDER",
|
|
|
|
"RED SNOW",
|
2021-04-09 16:37:54 -04:00
|
|
|
"hating simulator ft. moawling",
|
2022-08-22 20:18:54 -04:00
|
|
|
"TANKMAN",
|
2022-08-25 01:35:47 -04:00
|
|
|
"Due Debts"
|
2021-02-02 02:20:14 -05:00
|
|
|
];
|
|
|
|
|
2022-08-25 01:35:47 -04:00
|
|
|
var weekType:Array<WeekType> = [WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEKEND];
|
|
|
|
var weekTypeInc:Map<WeekType, Int> = new Map();
|
|
|
|
|
2021-02-02 02:20:14 -05:00
|
|
|
var txtWeekTitle:FlxText;
|
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
var curWeek:Int = 0;
|
|
|
|
|
|
|
|
var txtTracklist:FlxText;
|
|
|
|
|
|
|
|
var grpWeekText:FlxTypedGroup<MenuItem>;
|
2022-08-25 01:35:47 -04:00
|
|
|
var grpWeekCharacters:Array<FlxTypedGroup<MenuCharacter>>;
|
2020-10-30 19:47:19 -04:00
|
|
|
|
2022-08-25 01:35:47 -04:00
|
|
|
// var grpWeekCharacters:FlxTypedGroup<MenuCharacter>;
|
2020-10-30 19:47:19 -04:00
|
|
|
var grpLocks:FlxTypedGroup<FlxSprite>;
|
|
|
|
|
|
|
|
var difficultySelectors:FlxGroup;
|
2020-10-31 21:11:14 -04:00
|
|
|
var sprDifficulty:FlxSprite;
|
|
|
|
var leftArrow:FlxSprite;
|
|
|
|
var rightArrow:FlxSprite;
|
2022-08-25 01:35:47 -04:00
|
|
|
var yellowBG:FlxSprite; // not actually, yellow, lol!
|
|
|
|
var targetColor:Int = 0xFFF9CF51;
|
2020-10-30 19:47:19 -04:00
|
|
|
|
|
|
|
override function create()
|
|
|
|
{
|
2021-02-12 01:20:20 -05:00
|
|
|
transIn = FlxTransitionableState.defaultTransIn;
|
|
|
|
transOut = FlxTransitionableState.defaultTransOut;
|
|
|
|
|
2020-11-06 21:17:27 -05:00
|
|
|
if (FlxG.sound.music != null)
|
|
|
|
{
|
|
|
|
if (!FlxG.sound.music.playing)
|
2021-02-08 16:34:48 -05:00
|
|
|
FlxG.sound.playMusic(Paths.music('freakyMenu'));
|
2020-11-06 21:17:27 -05:00
|
|
|
}
|
2020-11-01 14:16:22 -05:00
|
|
|
|
2020-10-31 21:11:14 -04:00
|
|
|
persistentUpdate = persistentDraw = true;
|
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
scoreText = new FlxText(10, 10, 0, "SCORE: 49324858", 36);
|
|
|
|
scoreText.setFormat("VCR OSD Mono", 32);
|
|
|
|
|
2021-02-02 02:20:14 -05:00
|
|
|
txtWeekTitle = new FlxText(FlxG.width * 0.7, 10, 0, "", 32);
|
|
|
|
txtWeekTitle.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, RIGHT);
|
|
|
|
txtWeekTitle.alpha = 0.7;
|
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
var rankText:FlxText = new FlxText(0, 10);
|
|
|
|
rankText.text = 'RANK: GREAT';
|
2021-02-10 15:18:14 -05:00
|
|
|
rankText.setFormat(Paths.font("vcr.ttf"), 32);
|
2020-10-30 19:47:19 -04:00
|
|
|
rankText.size = scoreText.size;
|
|
|
|
rankText.screenCenter(X);
|
|
|
|
|
2021-02-08 16:34:48 -05:00
|
|
|
var ui_tex = Paths.getSparrowAtlas('campaign_menu_UI_assets');
|
2022-08-25 01:35:47 -04:00
|
|
|
yellowBG = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, FlxColor.WHITE);
|
|
|
|
yellowBG.color = 0xFFF9CF51;
|
|
|
|
// 0xFF413CAE blue
|
|
|
|
// 0xFFF9CF51 yello
|
2020-10-30 19:47:19 -04:00
|
|
|
|
|
|
|
grpWeekText = new FlxTypedGroup<MenuItem>();
|
|
|
|
add(grpWeekText);
|
|
|
|
|
2020-12-27 05:57:45 -05:00
|
|
|
var blackBarThingie:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 56, FlxColor.BLACK);
|
|
|
|
add(blackBarThingie);
|
|
|
|
|
2022-08-25 01:35:47 -04:00
|
|
|
// grpWeekCharacters = new FlxTypedGroup<MenuCharacter>();
|
|
|
|
grpWeekCharacters = [];
|
2020-10-31 21:11:14 -04:00
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
grpLocks = new FlxTypedGroup<FlxSprite>();
|
|
|
|
add(grpLocks);
|
|
|
|
|
2021-03-22 10:09:46 -04:00
|
|
|
#if discord_rpc
|
2021-02-26 07:27:32 -05:00
|
|
|
// Updating Discord Rich Presence
|
2021-02-27 19:06:30 -05:00
|
|
|
DiscordClient.changePresence("In the Menus", null);
|
2021-02-26 07:27:32 -05:00
|
|
|
#end
|
2020-11-07 15:52:21 -05:00
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
for (i in 0...weekData.length)
|
|
|
|
{
|
2022-08-25 01:35:47 -04:00
|
|
|
if (!weekTypeInc.exists(weekType[i]))
|
|
|
|
weekTypeInc[weekType[i]] = 1;
|
|
|
|
|
|
|
|
if (i == 0 && weekType[i] == WEEK)
|
|
|
|
weekTypeInc[weekType[i]] = 0; // set week to 0 by default?
|
|
|
|
|
|
|
|
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, weekTypeInc[weekType[i]], weekType[i]);
|
2020-10-30 19:47:19 -04:00
|
|
|
weekThing.y += ((weekThing.height + 20) * i);
|
|
|
|
weekThing.targetY = i;
|
|
|
|
grpWeekText.add(weekThing);
|
|
|
|
|
2022-08-25 01:35:47 -04:00
|
|
|
weekTypeInc[weekType[i]] += 1;
|
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
weekThing.screenCenter(X);
|
|
|
|
weekThing.antialiasing = true;
|
|
|
|
// weekThing.updateHitbox();
|
|
|
|
|
2020-11-06 21:17:27 -05:00
|
|
|
// Needs an offset thingie
|
2020-10-30 19:47:19 -04:00
|
|
|
if (!weekUnlocked[i])
|
|
|
|
{
|
|
|
|
var lock:FlxSprite = new FlxSprite(weekThing.width + 10 + weekThing.x);
|
|
|
|
lock.frames = ui_tex;
|
|
|
|
lock.animation.addByPrefix('lock', 'lock');
|
|
|
|
lock.animation.play('lock');
|
|
|
|
lock.ID = i;
|
|
|
|
lock.antialiasing = true;
|
|
|
|
grpLocks.add(lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-25 01:35:47 -04:00
|
|
|
var sizeChart:Map<String, Array<Float>> = new Map();
|
|
|
|
|
|
|
|
var sizeTxt:Array<String> = Assets.getText(Paths.file("data/storychardata.txt")).split("\n");
|
|
|
|
|
|
|
|
for (item in sizeTxt)
|
|
|
|
{
|
|
|
|
var items:Array<String> = item.split(" ");
|
|
|
|
|
|
|
|
var stuf:Array<Float> = [];
|
|
|
|
var name:String = items.shift();
|
|
|
|
|
|
|
|
for (num in items)
|
|
|
|
stuf.push(Std.parseFloat(num));
|
|
|
|
|
|
|
|
sizeChart.set(name, stuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (index => week in weekCharacters)
|
2020-10-31 21:11:14 -04:00
|
|
|
{
|
2022-08-25 01:35:47 -04:00
|
|
|
grpWeekCharacters.push(new FlxTypedGroup<MenuCharacter>());
|
|
|
|
|
|
|
|
for (char in 0...week.length)
|
2020-10-31 21:11:14 -04:00
|
|
|
{
|
2022-08-25 01:35:47 -04:00
|
|
|
var weekCharacterThing:MenuCharacter = new MenuCharacter((FlxG.width * 0.25) * (1 + char) - 150, weekCharacters[index][char]);
|
|
|
|
weekCharacterThing.y += 70;
|
|
|
|
weekCharacterThing.antialiasing = true;
|
|
|
|
|
|
|
|
var size:Float = 0.9;
|
|
|
|
|
|
|
|
switch (char)
|
|
|
|
{
|
|
|
|
case 0 | 2:
|
|
|
|
size = 0.5;
|
|
|
|
if (char == 0 && weekCharacterThing.character == "pico")
|
|
|
|
weekCharacterThing.flipX = true;
|
|
|
|
case 1:
|
|
|
|
size = 0.9;
|
|
|
|
weekCharacterThing.x -= 80;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sizeChart.exists(weekCharacterThing.character))
|
|
|
|
{
|
|
|
|
var nums:Array<Float> = sizeChart[weekCharacterThing.character];
|
|
|
|
size = nums[char];
|
|
|
|
|
|
|
|
// IDK, this might be busted ass null shit?
|
2022-08-25 01:40:39 -04:00
|
|
|
if (char != 1)
|
|
|
|
{
|
|
|
|
weekCharacterThing.x += nums[3];
|
|
|
|
weekCharacterThing.y += nums[4];
|
|
|
|
}
|
2022-08-25 01:35:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * size));
|
|
|
|
weekCharacterThing.updateHitbox();
|
|
|
|
|
|
|
|
grpWeekCharacters[index].add(weekCharacterThing);
|
|
|
|
trace("ADD CHARACTER");
|
2020-10-31 21:11:14 -04:00
|
|
|
}
|
|
|
|
|
2022-08-25 01:35:47 -04:00
|
|
|
trace(grpWeekCharacters[index].toString());
|
2020-10-31 21:11:14 -04:00
|
|
|
}
|
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
difficultySelectors = new FlxGroup();
|
|
|
|
add(difficultySelectors);
|
|
|
|
|
2020-11-06 21:17:27 -05:00
|
|
|
leftArrow = new FlxSprite(grpWeekText.members[0].x + grpWeekText.members[0].width + 10, grpWeekText.members[0].y + 10);
|
2020-10-30 19:47:19 -04:00
|
|
|
leftArrow.frames = ui_tex;
|
|
|
|
leftArrow.animation.addByPrefix('idle', "arrow left");
|
2020-10-31 21:11:14 -04:00
|
|
|
leftArrow.animation.addByPrefix('press', "arrow push left");
|
2020-10-30 19:47:19 -04:00
|
|
|
leftArrow.animation.play('idle');
|
|
|
|
difficultySelectors.add(leftArrow);
|
|
|
|
|
2020-10-31 21:11:14 -04:00
|
|
|
sprDifficulty = new FlxSprite(leftArrow.x + 130, leftArrow.y);
|
2020-10-30 19:47:19 -04:00
|
|
|
sprDifficulty.frames = ui_tex;
|
|
|
|
sprDifficulty.animation.addByPrefix('easy', 'EASY');
|
|
|
|
sprDifficulty.animation.addByPrefix('normal', 'NORMAL');
|
|
|
|
sprDifficulty.animation.addByPrefix('hard', 'HARD');
|
|
|
|
sprDifficulty.animation.play('easy');
|
2020-10-31 21:11:14 -04:00
|
|
|
changeDifficulty();
|
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
difficultySelectors.add(sprDifficulty);
|
|
|
|
|
2020-10-31 21:11:14 -04:00
|
|
|
rightArrow = new FlxSprite(sprDifficulty.x + sprDifficulty.width + 50, leftArrow.y);
|
2020-10-30 19:47:19 -04:00
|
|
|
rightArrow.frames = ui_tex;
|
|
|
|
rightArrow.animation.addByPrefix('idle', 'arrow right');
|
2020-10-31 21:11:14 -04:00
|
|
|
rightArrow.animation.addByPrefix('press', "arrow push right", 24, false);
|
2020-10-30 19:47:19 -04:00
|
|
|
rightArrow.animation.play('idle');
|
|
|
|
difficultySelectors.add(rightArrow);
|
|
|
|
|
|
|
|
add(yellowBG);
|
2022-08-25 01:35:47 -04:00
|
|
|
for (grp in grpWeekCharacters)
|
|
|
|
{
|
|
|
|
add(grp);
|
|
|
|
// trace("ADDED GRP");
|
|
|
|
}
|
|
|
|
|
|
|
|
// add(grpWeekCharacters);
|
2020-10-30 19:47:19 -04:00
|
|
|
|
|
|
|
txtTracklist = new FlxText(FlxG.width * 0.05, yellowBG.x + yellowBG.height + 100, 0, "Tracks", 32);
|
|
|
|
txtTracklist.alignment = CENTER;
|
|
|
|
txtTracklist.font = rankText.font;
|
|
|
|
txtTracklist.color = 0xFFe55777;
|
|
|
|
add(txtTracklist);
|
2020-11-01 14:16:22 -05:00
|
|
|
// add(rankText);
|
2020-11-06 21:17:27 -05:00
|
|
|
add(scoreText);
|
2021-02-02 02:20:14 -05:00
|
|
|
add(txtWeekTitle);
|
2020-10-30 19:47:19 -04:00
|
|
|
|
|
|
|
updateText();
|
|
|
|
|
|
|
|
super.create();
|
|
|
|
}
|
|
|
|
|
|
|
|
override function update(elapsed:Float)
|
|
|
|
{
|
|
|
|
// scoreText.setFormat('VCR OSD Mono', 32);
|
2022-08-25 01:35:47 -04:00
|
|
|
|
|
|
|
yellowBG.color = FlxColor.interpolate(yellowBG.color, targetColor, 0.06);
|
|
|
|
|
2021-04-13 22:02:21 -04:00
|
|
|
lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.5);
|
2020-11-06 21:17:27 -05:00
|
|
|
|
2021-04-13 22:02:21 -04:00
|
|
|
scoreText.text = "WEEK SCORE:" + Math.round(lerpScore);
|
2021-02-02 02:20:14 -05:00
|
|
|
|
|
|
|
txtWeekTitle.text = weekNames[curWeek].toUpperCase();
|
|
|
|
txtWeekTitle.x = FlxG.width - (txtWeekTitle.width + 10);
|
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
// FlxG.watch.addQuick('font', scoreText.font);
|
|
|
|
|
|
|
|
difficultySelectors.visible = weekUnlocked[curWeek];
|
|
|
|
|
|
|
|
grpLocks.forEach(function(lock:FlxSprite)
|
|
|
|
{
|
|
|
|
lock.y = grpWeekText.members[lock.ID].y;
|
|
|
|
});
|
|
|
|
|
2020-10-31 21:11:14 -04:00
|
|
|
if (!movedBack)
|
|
|
|
{
|
|
|
|
if (!selectedWeek)
|
|
|
|
{
|
2021-03-13 21:11:56 -05:00
|
|
|
if (controls.UI_UP_P)
|
2020-10-31 21:11:14 -04:00
|
|
|
{
|
|
|
|
changeWeek(-1);
|
|
|
|
}
|
|
|
|
|
2021-03-13 21:11:56 -05:00
|
|
|
if (controls.UI_DOWN_P)
|
2020-10-31 21:11:14 -04:00
|
|
|
{
|
|
|
|
changeWeek(1);
|
|
|
|
}
|
|
|
|
|
2021-03-13 21:11:56 -05:00
|
|
|
if (controls.UI_RIGHT)
|
2020-10-31 21:11:14 -04:00
|
|
|
rightArrow.animation.play('press')
|
|
|
|
else
|
|
|
|
rightArrow.animation.play('idle');
|
|
|
|
|
2021-03-13 21:11:56 -05:00
|
|
|
if (controls.UI_LEFT)
|
2020-10-31 21:11:14 -04:00
|
|
|
leftArrow.animation.play('press');
|
|
|
|
else
|
|
|
|
leftArrow.animation.play('idle');
|
|
|
|
|
2021-03-13 21:11:56 -05:00
|
|
|
if (controls.UI_RIGHT_P)
|
2020-10-31 21:11:14 -04:00
|
|
|
changeDifficulty(1);
|
2021-03-13 21:11:56 -05:00
|
|
|
if (controls.UI_LEFT_P)
|
2020-10-31 21:11:14 -04:00
|
|
|
changeDifficulty(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (controls.ACCEPT)
|
|
|
|
{
|
|
|
|
selectWeek();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (controls.BACK && !movedBack && !selectedWeek)
|
|
|
|
{
|
2021-02-08 16:34:48 -05:00
|
|
|
FlxG.sound.play(Paths.sound('cancelMenu'));
|
2020-10-31 21:11:14 -04:00
|
|
|
movedBack = true;
|
|
|
|
FlxG.switchState(new MainMenuState());
|
|
|
|
}
|
2020-10-30 19:47:19 -04:00
|
|
|
|
|
|
|
super.update(elapsed);
|
|
|
|
}
|
|
|
|
|
2020-10-31 21:11:14 -04:00
|
|
|
var movedBack:Bool = false;
|
|
|
|
var selectedWeek:Bool = false;
|
2020-11-26 14:14:35 -05:00
|
|
|
var stopspamming:Bool = false;
|
2020-12-11 04:15:24 -05:00
|
|
|
|
2020-10-31 21:11:14 -04:00
|
|
|
function selectWeek()
|
|
|
|
{
|
|
|
|
if (weekUnlocked[curWeek])
|
|
|
|
{
|
2020-12-11 04:15:24 -05:00
|
|
|
if (stopspamming == false)
|
2020-11-26 13:43:45 -05:00
|
|
|
{
|
2021-02-08 16:34:48 -05:00
|
|
|
FlxG.sound.play(Paths.sound('confirmMenu'));
|
2020-10-31 21:11:14 -04:00
|
|
|
|
2021-03-01 22:35:27 -05:00
|
|
|
grpWeekText.members[curWeek].startFlashing();
|
2022-08-25 01:35:47 -04:00
|
|
|
grpWeekCharacters[curWeek].members[1].animation.play('bfConfirm');
|
2020-11-26 13:43:45 -05:00
|
|
|
stopspamming = true;
|
|
|
|
}
|
2020-10-31 21:11:14 -04:00
|
|
|
|
|
|
|
PlayState.storyPlaylist = weekData[curWeek];
|
|
|
|
PlayState.isStoryMode = true;
|
|
|
|
selectedWeek = true;
|
|
|
|
|
2022-03-11 01:30:01 -05:00
|
|
|
PlayState.currentSong = SongLoad.loadFromJson(PlayState.storyPlaylist[0].toLowerCase(), PlayState.storyPlaylist[0].toLowerCase());
|
2022-01-28 12:20:03 -05:00
|
|
|
PlayState.storyWeek = curWeek;
|
|
|
|
PlayState.campaignScore = 0;
|
2020-10-31 21:11:14 -04:00
|
|
|
|
2022-01-28 12:20:03 -05:00
|
|
|
PlayState.storyDifficulty = curDifficulty;
|
|
|
|
SongLoad.curDiff = switch (curDifficulty)
|
2020-10-31 21:11:14 -04:00
|
|
|
{
|
|
|
|
case 0:
|
2022-01-28 12:20:03 -05:00
|
|
|
'easy';
|
|
|
|
case 1:
|
|
|
|
'normal';
|
2020-10-31 21:11:14 -04:00
|
|
|
case 2:
|
2022-01-28 12:20:03 -05:00
|
|
|
'hard';
|
|
|
|
default:
|
|
|
|
'normal';
|
|
|
|
};
|
2020-10-31 21:11:14 -04:00
|
|
|
|
|
|
|
new FlxTimer().start(1, function(tmr:FlxTimer)
|
|
|
|
{
|
2021-02-09 13:07:05 -05:00
|
|
|
LoadingState.loadAndSwitchState(new PlayState(), true);
|
2020-10-31 21:11:14 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function changeDifficulty(change:Int = 0):Void
|
|
|
|
{
|
|
|
|
curDifficulty += change;
|
|
|
|
|
|
|
|
if (curDifficulty < 0)
|
|
|
|
curDifficulty = 2;
|
|
|
|
if (curDifficulty > 2)
|
|
|
|
curDifficulty = 0;
|
|
|
|
|
|
|
|
sprDifficulty.offset.x = 0;
|
|
|
|
|
|
|
|
switch (curDifficulty)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
sprDifficulty.animation.play('easy');
|
|
|
|
sprDifficulty.offset.x = 20;
|
|
|
|
case 1:
|
|
|
|
sprDifficulty.animation.play('normal');
|
|
|
|
sprDifficulty.offset.x = 70;
|
|
|
|
case 2:
|
|
|
|
sprDifficulty.animation.play('hard');
|
|
|
|
sprDifficulty.offset.x = 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprDifficulty.alpha = 0;
|
|
|
|
|
2020-11-01 14:16:22 -05:00
|
|
|
// USING THESE WEIRD VALUES SO THAT IT DOESNT FLOAT UP
|
|
|
|
sprDifficulty.y = leftArrow.y - 15;
|
2020-11-06 05:56:45 -05:00
|
|
|
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
2020-11-07 15:52:21 -05:00
|
|
|
|
2020-11-01 14:16:22 -05:00
|
|
|
FlxTween.tween(sprDifficulty, {y: leftArrow.y + 15, alpha: 1}, 0.07);
|
2020-10-31 21:11:14 -04:00
|
|
|
}
|
|
|
|
|
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-30 19:47:19 -04:00
|
|
|
function changeWeek(change:Int = 0):Void
|
|
|
|
{
|
|
|
|
curWeek += change;
|
|
|
|
|
|
|
|
if (curWeek >= weekData.length)
|
|
|
|
curWeek = 0;
|
|
|
|
if (curWeek < 0)
|
|
|
|
curWeek = weekData.length - 1;
|
|
|
|
|
|
|
|
var bullShit:Int = 0;
|
|
|
|
|
|
|
|
for (item in grpWeekText.members)
|
|
|
|
{
|
|
|
|
item.targetY = bullShit - curWeek;
|
2020-11-06 21:17:27 -05:00
|
|
|
if (item.targetY == Std.int(0) && weekUnlocked[curWeek])
|
|
|
|
item.alpha = 1;
|
|
|
|
else
|
|
|
|
item.alpha = 0.6;
|
2020-10-30 19:47:19 -04:00
|
|
|
bullShit++;
|
|
|
|
}
|
|
|
|
|
2021-02-08 16:34:48 -05:00
|
|
|
FlxG.sound.play(Paths.sound('scrollMenu'));
|
2020-10-31 21:11:14 -04:00
|
|
|
|
2020-10-30 19:47:19 -04:00
|
|
|
updateText();
|
|
|
|
}
|
|
|
|
|
|
|
|
function updateText()
|
|
|
|
{
|
2022-08-25 01:35:47 -04:00
|
|
|
switch (weekType[curWeek])
|
2021-01-20 06:14:38 -05:00
|
|
|
{
|
2022-08-25 01:35:47 -04:00
|
|
|
case WEEK:
|
|
|
|
targetColor = 0xFFF9CF51;
|
|
|
|
case WEEKEND:
|
|
|
|
targetColor = 0xFF413CAE;
|
2021-01-20 06:14:38 -05:00
|
|
|
}
|
|
|
|
|
2022-08-25 01:35:47 -04:00
|
|
|
for (ind => grp in grpWeekCharacters)
|
|
|
|
grp.visible = ind == curWeek;
|
|
|
|
|
|
|
|
txtTracklist.text = "Tracks\n";
|
|
|
|
|
2022-03-06 02:37:38 -05:00
|
|
|
var trackNames:Array<String> = weekData[curWeek];
|
|
|
|
for (i in trackNames)
|
2020-10-30 19:47:19 -04:00
|
|
|
{
|
2022-03-06 02:37:38 -05:00
|
|
|
txtTracklist.text += '\n${i}';
|
2020-10-30 19:47:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
txtTracklist.text = txtTracklist.text.toUpperCase();
|
|
|
|
|
|
|
|
txtTracklist.screenCenter(X);
|
|
|
|
txtTracklist.x -= FlxG.width * 0.35;
|
2020-12-11 04:15:24 -05:00
|
|
|
|
2020-11-06 21:17:27 -05:00
|
|
|
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
2020-10-30 19:47:19 -04:00
|
|
|
}
|
|
|
|
}
|