music and preloading
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -1,5 +1,12 @@
|
|||||||
package;
|
package;
|
||||||
|
|
||||||
|
import lime.app.Application;
|
||||||
|
#if windows
|
||||||
|
import Discord.DiscordClient;
|
||||||
|
#end
|
||||||
|
import openfl.display.BitmapData;
|
||||||
|
import openfl.utils.Assets;
|
||||||
|
import flixel.ui.FlxBar;
|
||||||
import haxe.Exception;
|
import haxe.Exception;
|
||||||
import flixel.tweens.FlxEase;
|
import flixel.tweens.FlxEase;
|
||||||
import flixel.tweens.FlxTween;
|
import flixel.tweens.FlxTween;
|
||||||
@ -25,15 +32,26 @@ class Caching extends MusicBeatState
|
|||||||
var toBeDone = 0;
|
var toBeDone = 0;
|
||||||
var done = 0;
|
var done = 0;
|
||||||
|
|
||||||
|
var loaded = false;
|
||||||
|
|
||||||
var text:FlxText;
|
var text:FlxText;
|
||||||
var kadeLogo:FlxSprite;
|
var kadeLogo:FlxSprite;
|
||||||
|
|
||||||
|
public static var bitmapData:Map<String,BitmapData>;
|
||||||
|
|
||||||
|
var images = [];
|
||||||
|
var music = [];
|
||||||
|
var charts = [];
|
||||||
|
|
||||||
|
|
||||||
override function create()
|
override function create()
|
||||||
{
|
{
|
||||||
FlxG.mouse.visible = false;
|
FlxG.mouse.visible = false;
|
||||||
|
|
||||||
FlxG.worldBounds.set(0,0);
|
FlxG.worldBounds.set(0,0);
|
||||||
|
|
||||||
|
bitmapData = new Map<String,BitmapData>();
|
||||||
|
|
||||||
text = new FlxText(FlxG.width / 2, FlxG.height / 2 + 300,0,"Loading...");
|
text = new FlxText(FlxG.width / 2, FlxG.height / 2 + 300,0,"Loading...");
|
||||||
text.size = 34;
|
text.size = 34;
|
||||||
text.alignment = FlxTextAlign.CENTER;
|
text.alignment = FlxTextAlign.CENTER;
|
||||||
@ -48,43 +66,27 @@ class Caching extends MusicBeatState
|
|||||||
|
|
||||||
kadeLogo.alpha = 0;
|
kadeLogo.alpha = 0;
|
||||||
|
|
||||||
add(kadeLogo);
|
PlayerSettings.init();
|
||||||
add(text);
|
|
||||||
|
|
||||||
trace('starting caching..');
|
#if windows
|
||||||
|
DiscordClient.initialize();
|
||||||
|
|
||||||
sys.thread.Thread.create(() -> {
|
Application.current.onExit.add (function (exitCode) {
|
||||||
cache();
|
DiscordClient.shutdown();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#end
|
||||||
|
|
||||||
super.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
var calledDone = false;
|
Highscore.load();
|
||||||
|
|
||||||
override function update(elapsed)
|
FlxG.save.bind('funkin', 'ninjamuffin99');
|
||||||
|
|
||||||
|
KadeEngineData.initSave();
|
||||||
|
|
||||||
|
|
||||||
|
if (FlxG.save.data.cacheImages)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (toBeDone != 0 && done != toBeDone)
|
|
||||||
{
|
|
||||||
var alpha = HelperFunctions.truncateFloat(done / toBeDone * 100,2) / 100;
|
|
||||||
kadeLogo.alpha = alpha;
|
|
||||||
text.alpha = alpha;
|
|
||||||
text.text = "Loading... (" + done + "/" + toBeDone + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
super.update(elapsed);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function cache()
|
|
||||||
{
|
|
||||||
|
|
||||||
var images = [];
|
|
||||||
var music = [];
|
|
||||||
var charts = [];
|
|
||||||
|
|
||||||
trace("caching images...");
|
trace("caching images...");
|
||||||
|
|
||||||
for (i in FileSystem.readDirectory(FileSystem.absolutePath("assets/shared/images/characters")))
|
for (i in FileSystem.readDirectory(FileSystem.absolutePath("assets/shared/images/characters")))
|
||||||
@ -93,6 +95,7 @@ class Caching extends MusicBeatState
|
|||||||
continue;
|
continue;
|
||||||
images.push(i);
|
images.push(i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
trace("caching music...");
|
trace("caching music...");
|
||||||
|
|
||||||
@ -104,13 +107,60 @@ class Caching extends MusicBeatState
|
|||||||
|
|
||||||
toBeDone = Lambda.count(images) + Lambda.count(music);
|
toBeDone = Lambda.count(images) + Lambda.count(music);
|
||||||
|
|
||||||
|
var bar = new FlxBar(10,FlxG.height - 50,FlxBarFillDirection.LEFT_TO_RIGHT,FlxG.width,40,null,"done",0,toBeDone);
|
||||||
|
bar.color = FlxColor.PURPLE;
|
||||||
|
|
||||||
|
add(bar);
|
||||||
|
|
||||||
|
add(kadeLogo);
|
||||||
|
add(text);
|
||||||
|
|
||||||
|
trace('starting caching..');
|
||||||
|
|
||||||
|
// update thread
|
||||||
|
|
||||||
|
sys.thread.Thread.create(() -> {
|
||||||
|
while(!loaded)
|
||||||
|
{
|
||||||
|
if (toBeDone != 0 && done != toBeDone)
|
||||||
|
{
|
||||||
|
var alpha = HelperFunctions.truncateFloat(done / toBeDone * 100,2) / 100;
|
||||||
|
kadeLogo.alpha = alpha;
|
||||||
|
text.alpha = alpha;
|
||||||
|
text.text = "Loading... (" + done + "/" + toBeDone + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// cache thread
|
||||||
|
|
||||||
|
sys.thread.Thread.create(() -> {
|
||||||
|
cache();
|
||||||
|
});
|
||||||
|
|
||||||
|
super.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
var calledDone = false;
|
||||||
|
|
||||||
|
override function update(elapsed)
|
||||||
|
{
|
||||||
|
super.update(elapsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function cache()
|
||||||
|
{
|
||||||
|
|
||||||
trace("LOADING: " + toBeDone + " OBJECTS.");
|
trace("LOADING: " + toBeDone + " OBJECTS.");
|
||||||
|
|
||||||
for (i in images)
|
for (i in images)
|
||||||
{
|
{
|
||||||
var replaced = i.replace(".png","");
|
var replaced = i.replace(".png","");
|
||||||
FlxG.bitmap.add(Paths.image("characters/" + replaced,"shared"));
|
var data:BitmapData = BitmapData.fromFile("assets/shared/images/characters/" + i);
|
||||||
trace("cached " + replaced);
|
trace('id ' + replaced + ' file - assets/shared/images/characters/' + i + ' ${data.width}');
|
||||||
|
bitmapData.set(replaced,data);
|
||||||
done++;
|
done++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +175,10 @@ class Caching extends MusicBeatState
|
|||||||
|
|
||||||
trace("Finished caching...");
|
trace("Finished caching...");
|
||||||
|
|
||||||
|
loaded = true;
|
||||||
|
|
||||||
|
trace(Assets.cache.hasBitmapData('GF_assets'));
|
||||||
|
|
||||||
FlxG.switchState(new TitleState());
|
FlxG.switchState(new TitleState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class Character extends FlxSprite
|
|||||||
{
|
{
|
||||||
case 'gf':
|
case 'gf':
|
||||||
// GIRLFRIEND CODE
|
// GIRLFRIEND CODE
|
||||||
tex = Paths.getSparrowAtlas('characters/GF_assets');
|
tex = Paths.getSparrowAtlas('GF_assets','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
|
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
|
||||||
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
|
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
|
||||||
@ -51,7 +51,7 @@ class Character extends FlxSprite
|
|||||||
playAnim('danceRight');
|
playAnim('danceRight');
|
||||||
|
|
||||||
case 'gf-christmas':
|
case 'gf-christmas':
|
||||||
tex = Paths.getSparrowAtlas('characters/gfChristmas');
|
tex = Paths.getSparrowAtlas('gfChristmas','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
|
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
|
||||||
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
|
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
|
||||||
@ -70,7 +70,7 @@ class Character extends FlxSprite
|
|||||||
playAnim('danceRight');
|
playAnim('danceRight');
|
||||||
|
|
||||||
case 'gf-car':
|
case 'gf-car':
|
||||||
tex = Paths.getSparrowAtlas('characters/gfCar');
|
tex = Paths.getSparrowAtlas('gfCar','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByIndices('singUP', 'GF Dancing Beat Hair blowing CAR', [0], "", 24, false);
|
animation.addByIndices('singUP', 'GF Dancing Beat Hair blowing CAR', [0], "", 24, false);
|
||||||
animation.addByIndices('danceLeft', 'GF Dancing Beat Hair blowing CAR', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
animation.addByIndices('danceLeft', 'GF Dancing Beat Hair blowing CAR', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||||
@ -82,7 +82,7 @@ class Character extends FlxSprite
|
|||||||
playAnim('danceRight');
|
playAnim('danceRight');
|
||||||
|
|
||||||
case 'gf-pixel':
|
case 'gf-pixel':
|
||||||
tex = Paths.getSparrowAtlas('characters/gfPixel');
|
tex = Paths.getSparrowAtlas('gfPixel','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByIndices('singUP', 'GF IDLE', [2], "", 24, false);
|
animation.addByIndices('singUP', 'GF IDLE', [2], "", 24, false);
|
||||||
animation.addByIndices('danceLeft', 'GF IDLE', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
animation.addByIndices('danceLeft', 'GF IDLE', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||||
@ -98,7 +98,7 @@ class Character extends FlxSprite
|
|||||||
|
|
||||||
case 'dad':
|
case 'dad':
|
||||||
// DAD ANIMATION LOADING CODE
|
// DAD ANIMATION LOADING CODE
|
||||||
tex = Paths.getSparrowAtlas('characters/DADDY_DEAREST', 'shared');
|
tex = Paths.getSparrowAtlas('DADDY_DEAREST','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('idle', 'Dad idle dance', 24);
|
animation.addByPrefix('idle', 'Dad idle dance', 24);
|
||||||
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
|
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
|
||||||
@ -110,7 +110,7 @@ class Character extends FlxSprite
|
|||||||
|
|
||||||
playAnim('idle');
|
playAnim('idle');
|
||||||
case 'spooky':
|
case 'spooky':
|
||||||
tex = Paths.getSparrowAtlas('characters/spooky_kids_assets');
|
tex = Paths.getSparrowAtlas('spooky_kids_assets','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('singUP', 'spooky UP NOTE', 24, false);
|
animation.addByPrefix('singUP', 'spooky UP NOTE', 24, false);
|
||||||
animation.addByPrefix('singDOWN', 'spooky DOWN note', 24, false);
|
animation.addByPrefix('singDOWN', 'spooky DOWN note', 24, false);
|
||||||
@ -123,7 +123,7 @@ class Character extends FlxSprite
|
|||||||
|
|
||||||
playAnim('danceRight');
|
playAnim('danceRight');
|
||||||
case 'mom':
|
case 'mom':
|
||||||
tex = Paths.getSparrowAtlas('characters/Mom_Assets');
|
tex = Paths.getSparrowAtlas('Mom_Assets','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
|
|
||||||
animation.addByPrefix('idle', "Mom Idle", 24, false);
|
animation.addByPrefix('idle', "Mom Idle", 24, false);
|
||||||
@ -139,7 +139,7 @@ class Character extends FlxSprite
|
|||||||
playAnim('idle');
|
playAnim('idle');
|
||||||
|
|
||||||
case 'mom-car':
|
case 'mom-car':
|
||||||
tex = Paths.getSparrowAtlas('characters/momCar');
|
tex = Paths.getSparrowAtlas('momCar','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
|
|
||||||
animation.addByPrefix('idle', "Mom Idle", 24, false);
|
animation.addByPrefix('idle', "Mom Idle", 24, false);
|
||||||
@ -154,7 +154,7 @@ class Character extends FlxSprite
|
|||||||
|
|
||||||
playAnim('idle');
|
playAnim('idle');
|
||||||
case 'monster':
|
case 'monster':
|
||||||
tex = Paths.getSparrowAtlas('characters/Monster_Assets');
|
tex = Paths.getSparrowAtlas('Monster_Assets','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('idle', 'monster idle', 24, false);
|
animation.addByPrefix('idle', 'monster idle', 24, false);
|
||||||
animation.addByPrefix('singUP', 'monster up note', 24, false);
|
animation.addByPrefix('singUP', 'monster up note', 24, false);
|
||||||
@ -165,7 +165,7 @@ class Character extends FlxSprite
|
|||||||
loadOffsetFile(curCharacter);
|
loadOffsetFile(curCharacter);
|
||||||
playAnim('idle');
|
playAnim('idle');
|
||||||
case 'monster-christmas':
|
case 'monster-christmas':
|
||||||
tex = Paths.getSparrowAtlas('characters/monsterChristmas');
|
tex = Paths.getSparrowAtlas('monsterChristmas','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('idle', 'monster idle', 24, false);
|
animation.addByPrefix('idle', 'monster idle', 24, false);
|
||||||
animation.addByPrefix('singUP', 'monster up note', 24, false);
|
animation.addByPrefix('singUP', 'monster up note', 24, false);
|
||||||
@ -176,7 +176,7 @@ class Character extends FlxSprite
|
|||||||
loadOffsetFile(curCharacter);
|
loadOffsetFile(curCharacter);
|
||||||
playAnim('idle');
|
playAnim('idle');
|
||||||
case 'pico':
|
case 'pico':
|
||||||
tex = Paths.getSparrowAtlas('characters/Pico_FNF_assetss');
|
tex = Paths.getSparrowAtlas('Pico_FNF_assetss','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('idle', "Pico Idle Dance", 24);
|
animation.addByPrefix('idle', "Pico Idle Dance", 24);
|
||||||
animation.addByPrefix('singUP', 'pico Up note0', 24, false);
|
animation.addByPrefix('singUP', 'pico Up note0', 24, false);
|
||||||
@ -207,7 +207,7 @@ class Character extends FlxSprite
|
|||||||
flipX = true;
|
flipX = true;
|
||||||
|
|
||||||
case 'bf':
|
case 'bf':
|
||||||
var tex = Paths.getSparrowAtlas('characters/BOYFRIEND', 'shared');
|
var tex = Paths.getSparrowAtlas('BOYFRIEND','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
|
|
||||||
trace(tex.frames.length);
|
trace(tex.frames.length);
|
||||||
@ -236,7 +236,7 @@ class Character extends FlxSprite
|
|||||||
flipX = true;
|
flipX = true;
|
||||||
|
|
||||||
case 'bf-christmas':
|
case 'bf-christmas':
|
||||||
var tex = Paths.getSparrowAtlas('characters/bfChristmas');
|
var tex = Paths.getSparrowAtlas('bfChristmas','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('idle', 'BF idle dance', 24, false);
|
animation.addByPrefix('idle', 'BF idle dance', 24, false);
|
||||||
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
|
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
|
||||||
@ -255,7 +255,7 @@ class Character extends FlxSprite
|
|||||||
|
|
||||||
flipX = true;
|
flipX = true;
|
||||||
case 'bf-car':
|
case 'bf-car':
|
||||||
var tex = Paths.getSparrowAtlas('characters/bfCar');
|
var tex = Paths.getSparrowAtlas('bfCar','shared',true);
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('idle', 'BF idle dance', 24, false);
|
animation.addByPrefix('idle', 'BF idle dance', 24, false);
|
||||||
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
|
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
|
||||||
@ -272,7 +272,7 @@ class Character extends FlxSprite
|
|||||||
|
|
||||||
flipX = true;
|
flipX = true;
|
||||||
case 'bf-pixel':
|
case 'bf-pixel':
|
||||||
frames = Paths.getSparrowAtlas('characters/bfPixel');
|
frames = Paths.getSparrowAtlas('bfPixel','shared',true);
|
||||||
animation.addByPrefix('idle', 'BF IDLE', 24, false);
|
animation.addByPrefix('idle', 'BF IDLE', 24, false);
|
||||||
animation.addByPrefix('singUP', 'BF UP NOTE', 24, false);
|
animation.addByPrefix('singUP', 'BF UP NOTE', 24, false);
|
||||||
animation.addByPrefix('singLEFT', 'BF LEFT NOTE', 24, false);
|
animation.addByPrefix('singLEFT', 'BF LEFT NOTE', 24, false);
|
||||||
@ -297,7 +297,7 @@ class Character extends FlxSprite
|
|||||||
|
|
||||||
flipX = true;
|
flipX = true;
|
||||||
case 'bf-pixel-dead':
|
case 'bf-pixel-dead':
|
||||||
frames = Paths.getSparrowAtlas('characters/bfPixelsDEAD');
|
frames = Paths.getSparrowAtlas('bfPixelsDEAD','shared',true);
|
||||||
animation.addByPrefix('singUP', "BF Dies pixel", 24, false);
|
animation.addByPrefix('singUP', "BF Dies pixel", 24, false);
|
||||||
animation.addByPrefix('firstDeath', "BF Dies pixel", 24, false);
|
animation.addByPrefix('firstDeath', "BF Dies pixel", 24, false);
|
||||||
animation.addByPrefix('deathLoop', "Retry Loop", 24, true);
|
animation.addByPrefix('deathLoop', "Retry Loop", 24, true);
|
||||||
@ -313,7 +313,7 @@ class Character extends FlxSprite
|
|||||||
flipX = true;
|
flipX = true;
|
||||||
|
|
||||||
case 'senpai':
|
case 'senpai':
|
||||||
frames = Paths.getSparrowAtlas('characters/senpai');
|
frames = Paths.getSparrowAtlas('senpai','shared',true);
|
||||||
animation.addByPrefix('idle', 'Senpai Idle', 24, false);
|
animation.addByPrefix('idle', 'Senpai Idle', 24, false);
|
||||||
animation.addByPrefix('singUP', 'SENPAI UP NOTE', 24, false);
|
animation.addByPrefix('singUP', 'SENPAI UP NOTE', 24, false);
|
||||||
animation.addByPrefix('singLEFT', 'SENPAI LEFT NOTE', 24, false);
|
animation.addByPrefix('singLEFT', 'SENPAI LEFT NOTE', 24, false);
|
||||||
@ -329,7 +329,7 @@ class Character extends FlxSprite
|
|||||||
|
|
||||||
antialiasing = false;
|
antialiasing = false;
|
||||||
case 'senpai-angry':
|
case 'senpai-angry':
|
||||||
frames = Paths.getSparrowAtlas('characters/senpai');
|
frames = Paths.getSparrowAtlas('senpai','shared',true);
|
||||||
animation.addByPrefix('idle', 'Angry Senpai Idle', 24, false);
|
animation.addByPrefix('idle', 'Angry Senpai Idle', 24, false);
|
||||||
animation.addByPrefix('singUP', 'Angry Senpai UP NOTE', 24, false);
|
animation.addByPrefix('singUP', 'Angry Senpai UP NOTE', 24, false);
|
||||||
animation.addByPrefix('singLEFT', 'Angry Senpai LEFT NOTE', 24, false);
|
animation.addByPrefix('singLEFT', 'Angry Senpai LEFT NOTE', 24, false);
|
||||||
@ -345,7 +345,7 @@ class Character extends FlxSprite
|
|||||||
antialiasing = false;
|
antialiasing = false;
|
||||||
|
|
||||||
case 'spirit':
|
case 'spirit':
|
||||||
frames = Paths.getPackerAtlas('characters/spirit');
|
frames = Paths.getPackerAtlas('spirit','shared',true);
|
||||||
animation.addByPrefix('idle', "idle spirit_", 24, false);
|
animation.addByPrefix('idle', "idle spirit_", 24, false);
|
||||||
animation.addByPrefix('singUP', "up_", 24, false);
|
animation.addByPrefix('singUP', "up_", 24, false);
|
||||||
animation.addByPrefix('singRIGHT', "right_", 24, false);
|
animation.addByPrefix('singRIGHT', "right_", 24, false);
|
||||||
@ -362,7 +362,7 @@ class Character extends FlxSprite
|
|||||||
antialiasing = false;
|
antialiasing = false;
|
||||||
|
|
||||||
case 'parents-christmas':
|
case 'parents-christmas':
|
||||||
frames = Paths.getSparrowAtlas('characters/mom_dad_christmas_assets');
|
frames = Paths.getSparrowAtlas('mom_dad_christmas_assets','shared',true);
|
||||||
animation.addByPrefix('idle', 'Parent Christmas Idle', 24, false);
|
animation.addByPrefix('idle', 'Parent Christmas Idle', 24, false);
|
||||||
animation.addByPrefix('singUP', 'Parent Up Note Dad', 24, false);
|
animation.addByPrefix('singUP', 'Parent Up Note Dad', 24, false);
|
||||||
animation.addByPrefix('singDOWN', 'Parent Down Note Dad', 24, false);
|
animation.addByPrefix('singDOWN', 'Parent Down Note Dad', 24, false);
|
||||||
|
@ -64,7 +64,6 @@ class FreeplayState extends MusicBeatState
|
|||||||
{
|
{
|
||||||
var data:Array<String> = initSonglist[i].split(':');
|
var data:Array<String> = initSonglist[i].split(':');
|
||||||
var meta = new SongMetadata(data[0], Std.parseInt(data[2]), data[1]);
|
var meta = new SongMetadata(data[0], Std.parseInt(data[2]), data[1]);
|
||||||
#if debug
|
|
||||||
songs.push(meta);
|
songs.push(meta);
|
||||||
var format = StringTools.replace(meta.songName, " ", "-");
|
var format = StringTools.replace(meta.songName, " ", "-");
|
||||||
switch (format) {
|
switch (format) {
|
||||||
@ -78,24 +77,7 @@ class FreeplayState extends MusicBeatState
|
|||||||
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
||||||
FreeplayState.songData.set(meta.songName,diffs);
|
FreeplayState.songData.set(meta.songName,diffs);
|
||||||
trace('loaded diffs for ' + meta.songName);
|
trace('loaded diffs for ' + meta.songName);
|
||||||
#else
|
|
||||||
if(Std.parseInt(data[2]) <= FlxG.save.data.weekUnlocked - 1)
|
|
||||||
{
|
|
||||||
songs.push(meta);
|
|
||||||
var format = StringTools.replace(meta.songName, " ", "-");
|
|
||||||
switch (format) {
|
|
||||||
case 'Dad-Battle': format = 'Dadbattle';
|
|
||||||
case 'Philly-Nice': format = 'Philly';
|
|
||||||
}
|
|
||||||
|
|
||||||
var diffs = [];
|
|
||||||
FreeplayState.loadDiff(0,format,meta.songName,diffs);
|
|
||||||
FreeplayState.loadDiff(1,format,meta.songName,diffs);
|
|
||||||
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
|
||||||
FreeplayState.songData.set(meta.songName,diffs);
|
|
||||||
trace('loaded diffs for ' + meta.songName);
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//trace("\n" + diffList);
|
//trace("\n" + diffList);
|
||||||
|
@ -97,6 +97,9 @@ class KadeEngineData
|
|||||||
if (FlxG.save.data.optimize == null)
|
if (FlxG.save.data.optimize == null)
|
||||||
FlxG.save.data.optimize = false;
|
FlxG.save.data.optimize = false;
|
||||||
|
|
||||||
|
if (FlxG.save.data.cacheImages == null)
|
||||||
|
FlxG.save.data.cacheImages = false;
|
||||||
|
|
||||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||||
|
|
||||||
KeyBinds.gamepad = gamepad != null;
|
KeyBinds.gamepad = gamepad != null;
|
||||||
|
@ -119,6 +119,29 @@ class CpuStrums extends Option
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class GraphicLoading extends Option
|
||||||
|
{
|
||||||
|
public function new(desc:String)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
description = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override function press():Bool
|
||||||
|
{
|
||||||
|
FlxG.save.data.cacheImages = !FlxG.save.data.cacheImages;
|
||||||
|
|
||||||
|
display = updateDisplay();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private override function updateDisplay():String
|
||||||
|
{
|
||||||
|
return FlxG.save.data.cacheImages ? "Preload Characters" : "Do not Preload Characters";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
class DownscrollOption extends Option
|
class DownscrollOption extends Option
|
||||||
{
|
{
|
||||||
public function new(desc:String)
|
public function new(desc:String)
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package;
|
package;
|
||||||
|
|
||||||
|
import openfl.utils.Assets;
|
||||||
|
import flixel.graphics.FlxGraphic;
|
||||||
|
import flixel.system.FlxAssets.FlxGraphicAsset;
|
||||||
import flixel.FlxG;
|
import flixel.FlxG;
|
||||||
import flixel.graphics.frames.FlxAtlasFrames;
|
import flixel.graphics.frames.FlxAtlasFrames;
|
||||||
import openfl.utils.AssetType;
|
import openfl.utils.AssetType;
|
||||||
@ -125,13 +128,25 @@ class Paths
|
|||||||
return 'assets/fonts/$key';
|
return 'assets/fonts/$key';
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static public function getSparrowAtlas(key:String, ?library:String)
|
inline static public function getSparrowAtlas(key:String, ?library:String, ?isCharacter:Bool = false)
|
||||||
{
|
{
|
||||||
|
if (isCharacter)
|
||||||
|
return FlxAtlasFrames.fromSparrow(imageCached(key), file('images/characters/$key.xml', library));
|
||||||
return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library));
|
return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static public function getPackerAtlas(key:String, ?library:String)
|
inline static public function imageCached(key:String):FlxGraphic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var data = FlxGraphic.fromBitmapData(Caching.bitmapData.get(key));
|
||||||
|
trace('finding ${key} - ${data.bitmap}');
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static public function getPackerAtlas(key:String, ?library:String, ?isCharacter:Bool = false)
|
||||||
|
{
|
||||||
|
if (isCharacter)
|
||||||
|
return FlxAtlasFrames.fromSpriteSheetPacker(imageCached(key), file('images/$key.txt', library));
|
||||||
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library));
|
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user