mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-27 15:37:49 +00:00
move files to weeks and load songs individually
This commit is contained in:
parent
baab5f9749
commit
225ee24fc3
56
Project.xml
56
Project.xml
|
@ -40,42 +40,56 @@
|
|||
|
||||
<classpath name="source" />
|
||||
|
||||
<assets path="assets/preload" rename="assets" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/preload" rename="assets" exclude="*.mp3" unless="web"/>
|
||||
<assets path="assets/preload" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/preload" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<define name="PRELOAD_ALL" unless="web" />
|
||||
|
||||
<library name="songs" preload="false" unless="PRELOAD_ALL"/>
|
||||
<library name="songs" preload="true" if="PRELOAD_ALL"/>
|
||||
<assets path="assets/songs" library="songs" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/songs" library="songs" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<library name="songs" preload="false" />
|
||||
<assets path="assets/songs" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/songs" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<library name="shared" preload="false" />
|
||||
<library name="shared" preload="true"/>
|
||||
<!-- <library name="shared" preload="false" unless="PRELOAD_ALL"/>
|
||||
<library name="shared" preload="true" if="PRELOAD_ALL"/> -->
|
||||
<assets path="assets/shared" library="shared" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/shared" library="shared" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<library name="week1" preload="false" />
|
||||
<library name="tutorial" preload="false" unless="PRELOAD_ALL"/>
|
||||
<library name="tutorial" preload="true" if="PRELOAD_ALL"/>
|
||||
<assets path="assets/tutorial" library="tutorial" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/tutorial" library="tutorial" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<library name="week1" preload="false" unless="PRELOAD_ALL"/>
|
||||
<library name="week1" preload="true" if="PRELOAD_ALL"/>
|
||||
<assets path="assets/week1" library="week1" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week1" library="week1" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<!-- <library name="week2" preload="false" />
|
||||
<library name="week2" preload="false" unless="PRELOAD_ALL"/>
|
||||
<library name="week2" preload="true" if="PRELOAD_ALL"/>
|
||||
<assets path="assets/week2" library="week2" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week2" library="week2" exclude="*.mp3" unless="web"/> -->
|
||||
<assets path="assets/week2" library="week2" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<!-- <library name="week3" preload="false" />
|
||||
<library name="week3" preload="false" unless="PRELOAD_ALL"/>
|
||||
<library name="week3" preload="true" if="PRELOAD_ALL"/>
|
||||
<assets path="assets/week3" library="week3" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week3" library="week3" exclude="*.mp3" unless="web"/> -->
|
||||
<assets path="assets/week3" library="week3" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<!-- <library name="week4" preload="false" />
|
||||
<library name="week4" preload="false" unless="PRELOAD_ALL"/>
|
||||
<library name="week4" preload="true" if="PRELOAD_ALL"/>
|
||||
<assets path="assets/week4" library="week4" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week4" library="week4" exclude="*.mp3" unless="web"/> -->
|
||||
<assets path="assets/week4" library="week4" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<!-- <library name="week5" preload="false" />
|
||||
<library name="week5" preload="false" unless="PRELOAD_ALL"/>
|
||||
<library name="week5" preload="true" if="PRELOAD_ALL"/>
|
||||
<assets path="assets/week5" library="week5" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week5" library="week5" exclude="*.mp3" unless="web"/> -->
|
||||
<assets path="assets/week5" library="week5" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<!-- <library name="week6" preload="false" />
|
||||
<library name="week6" preload="false" unless="PRELOAD_ALL"/>
|
||||
<library name="week6" preload="true" if="PRELOAD_ALL"/>
|
||||
<assets path="assets/week6" library="week6" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week6" library="week6" exclude="*.mp3" unless="web"/> -->
|
||||
|
||||
|
||||
<assets path="assets/week6" library="week6" exclude="*.mp3" unless="web"/>
|
||||
|
||||
<assets path='example_mods' rename='mods' embed='false'/>
|
||||
<!-- <template path='mods' /> -->
|
||||
|
@ -101,7 +115,7 @@
|
|||
<haxelib name="flixel-ui" />
|
||||
<haxelib name="newgrounds"/>
|
||||
<haxelib name="faxe" if='switch'/>
|
||||
<haxelib name="polymod"/>
|
||||
<haxelib name="polymod" unless="web"/>
|
||||
|
||||
<!-- <haxelib name="markdown" /> -->
|
||||
<!-- <haxelib name="HtmlParser" /> -->
|
||||
|
|
|
@ -11,7 +11,7 @@ class ChartParser
|
|||
var IMG_WIDTH:Int = 8;
|
||||
var regex:EReg = new EReg("[ \t]*((\r\n)|\r|\n)[ \t]*", "g");
|
||||
|
||||
var csvData = FlxStringUtil.imageToCSV('assets/data/' + songName + '/' + songName + '_section' + section + '.png');
|
||||
var csvData = FlxStringUtil.imageToCSV(Paths.file('data/' + songName + '/' + songName + '_section' + section + '.png'));
|
||||
|
||||
var lines:Array<String> = regex.split(csvData);
|
||||
var rows:Array<String> = lines.filter(function(line) return line != "");
|
||||
|
|
|
@ -225,7 +225,7 @@ class ChartingState extends MusicBeatState
|
|||
stepperBPM.value = Conductor.bpm;
|
||||
stepperBPM.name = 'song_bpm';
|
||||
|
||||
var characters:Array<String> = CoolUtil.coolTextFile('assets/data/characterList.txt');
|
||||
var characters:Array<String> = CoolUtil.coolTextFile(Paths.txt('characterList'));
|
||||
|
||||
var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
|
||||
{
|
||||
|
@ -351,7 +351,7 @@ class ChartingState extends MusicBeatState
|
|||
// vocals.stop();
|
||||
}
|
||||
|
||||
FlxG.sound.playMusic('assets/music/' + daSong + "_Inst" + TitleState.soundExt, 0.6);
|
||||
FlxG.sound.playMusic(Paths.inst(daSong), 0.6);
|
||||
|
||||
// WONT WORK FOR TUTORIAL OR TEST SONG!!! REDO LATER
|
||||
vocals = new FlxSound().loadEmbedded(Paths.music(daSong + "_Voices"));
|
||||
|
|
|
@ -60,24 +60,6 @@ class DialogueBox extends FlxSpriteGroup
|
|||
bgFade.alpha = 0.7;
|
||||
}, 5);
|
||||
|
||||
portraitLeft = new FlxSprite(-20, 40);
|
||||
portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait');
|
||||
portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false);
|
||||
portraitLeft.setGraphicSize(Std.int(portraitLeft.width * PlayState.daPixelZoom * 0.9));
|
||||
portraitLeft.updateHitbox();
|
||||
portraitLeft.scrollFactor.set();
|
||||
add(portraitLeft);
|
||||
portraitLeft.visible = false;
|
||||
|
||||
portraitRight = new FlxSprite(0, 40);
|
||||
portraitRight.frames = Paths.getSparrowAtlas('weeb/bfPortrait');
|
||||
portraitRight.animation.addByPrefix('enter', 'Boyfriend portrait enter', 24, false);
|
||||
portraitRight.setGraphicSize(Std.int(portraitRight.width * PlayState.daPixelZoom * 0.9));
|
||||
portraitRight.updateHitbox();
|
||||
portraitRight.scrollFactor.set();
|
||||
add(portraitRight);
|
||||
portraitRight.visible = false;
|
||||
|
||||
box = new FlxSprite(-20, 45);
|
||||
|
||||
var hasDialog = false;
|
||||
|
@ -107,19 +89,40 @@ class DialogueBox extends FlxSpriteGroup
|
|||
add(face);
|
||||
}
|
||||
|
||||
if (hasDialog)
|
||||
{
|
||||
box.animation.play('normalOpen');
|
||||
box.setGraphicSize(Std.int(box.width * PlayState.daPixelZoom * 0.9));
|
||||
box.updateHitbox();
|
||||
add(box);
|
||||
}
|
||||
this.dialogueList = dialogueList;
|
||||
|
||||
if (!hasDialog)
|
||||
return;
|
||||
|
||||
portraitLeft = new FlxSprite(-20, 40);
|
||||
portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait');
|
||||
portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false);
|
||||
portraitLeft.setGraphicSize(Std.int(portraitLeft.width * PlayState.daPixelZoom * 0.9));
|
||||
portraitLeft.updateHitbox();
|
||||
portraitLeft.scrollFactor.set();
|
||||
add(portraitLeft);
|
||||
portraitLeft.visible = false;
|
||||
|
||||
portraitRight = new FlxSprite(0, 40);
|
||||
portraitRight.frames = Paths.getSparrowAtlas('weeb/bfPortrait');
|
||||
portraitRight.animation.addByPrefix('enter', 'Boyfriend portrait enter', 24, false);
|
||||
portraitRight.setGraphicSize(Std.int(portraitRight.width * PlayState.daPixelZoom * 0.9));
|
||||
portraitRight.updateHitbox();
|
||||
portraitRight.scrollFactor.set();
|
||||
add(portraitRight);
|
||||
portraitRight.visible = false;
|
||||
|
||||
box.animation.play('normalOpen');
|
||||
box.setGraphicSize(Std.int(box.width * PlayState.daPixelZoom * 0.9));
|
||||
box.updateHitbox();
|
||||
add(box);
|
||||
|
||||
box.screenCenter(X);
|
||||
portraitLeft.screenCenter(X);
|
||||
|
||||
handSelect = new FlxSprite(FlxG.width * 0.9, FlxG.height * 0.9).loadGraphic(Paths.image('weeb/pixelUI/hand_textbox'));
|
||||
add(handSelect);
|
||||
|
||||
box.screenCenter(X);
|
||||
portraitLeft.screenCenter(X);
|
||||
|
||||
if (!talkingRight)
|
||||
{
|
||||
|
@ -140,8 +143,6 @@ class DialogueBox extends FlxSpriteGroup
|
|||
dialogue = new Alphabet(0, 80, "", false, true);
|
||||
// dialogue.x = 90;
|
||||
// add(dialogue);
|
||||
|
||||
this.dialogueList = dialogueList;
|
||||
}
|
||||
|
||||
var dialogueOpened:Bool = false;
|
||||
|
|
|
@ -30,7 +30,7 @@ class FreeplayState extends MusicBeatState
|
|||
|
||||
override function create()
|
||||
{
|
||||
songs = CoolUtil.coolTextFile('assets/data/freeplaySonglist.txt');
|
||||
songs = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
|
||||
|
||||
/*
|
||||
if (FlxG.sound.music != null)
|
||||
|
@ -104,7 +104,7 @@ class FreeplayState extends MusicBeatState
|
|||
|
||||
scoreText = new FlxText(FlxG.width * 0.7, 5, 0, "", 32);
|
||||
// scoreText.autoSize = false;
|
||||
scoreText.setFormat("assets/fonts/vcr.ttf", 32, FlxColor.WHITE, RIGHT);
|
||||
scoreText.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, RIGHT);
|
||||
// scoreText.alignment = RIGHT;
|
||||
|
||||
var scoreBG:FlxSprite = new FlxSprite(scoreText.x - 6, 0).makeGraphic(Std.int(FlxG.width * 0.35), 66, 0xFF000000);
|
||||
|
@ -249,7 +249,9 @@ class FreeplayState extends MusicBeatState
|
|||
// lerpScore = 0;
|
||||
#end
|
||||
|
||||
FlxG.sound.playMusic('assets/music/' + songs[curSelected] + "_Inst" + TitleState.soundExt, 0);
|
||||
#if PRELOAD_ALL
|
||||
FlxG.sound.playMusic(Paths.inst(songs[curSelected]), 0);
|
||||
#end
|
||||
|
||||
var bullShit:Int = 0;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package;
|
||||
|
||||
import lime.app.Promise;
|
||||
import lime.app.Future;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxState;
|
||||
import flixel.FlxSprite;
|
||||
|
@ -8,11 +10,8 @@ import flixel.util.FlxTimer;
|
|||
|
||||
import openfl.utils.Assets;
|
||||
import lime.utils.Assets as LimeAssets;
|
||||
import lime.utils.AssetBundle;
|
||||
import lime.utils.AssetLibrary;
|
||||
import lime.utils.AssetManifest;
|
||||
import lime.app.Future;
|
||||
import lime.app.Promise;
|
||||
|
||||
import haxe.io.Path;
|
||||
|
||||
|
@ -38,7 +37,7 @@ class LoadingState extends MusicBeatState
|
|||
override function create()
|
||||
{
|
||||
logo = new FlxSprite(-150, -100);
|
||||
logo.frames = FlxAtlasFrames.fromSparrow('assets/images/logoBumpin.png', 'assets/images/logoBumpin.xml');
|
||||
logo.frames = Paths.getSparrowAtlas('logoBumpin');
|
||||
logo.antialiasing = true;
|
||||
logo.animation.addByPrefix('bump', 'logo bumpin', 24);
|
||||
logo.animation.play('bump');
|
||||
|
@ -47,31 +46,33 @@ class LoadingState extends MusicBeatState
|
|||
// logoBl.color = FlxColor.BLACK;
|
||||
|
||||
gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07);
|
||||
gfDance.frames = FlxAtlasFrames.fromSparrow('assets/images/gfDanceTitle.png', 'assets/images/gfDanceTitle.xml');
|
||||
gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle');
|
||||
gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||
gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
|
||||
gfDance.antialiasing = true;
|
||||
add(gfDance);
|
||||
add(logo);
|
||||
|
||||
// function onSongsManifestInit()
|
||||
// {
|
||||
callbacks = new MultiCallback(onLoad);
|
||||
var introComplete = callbacks.add("introComplete");
|
||||
checkLoadSong(getSongPath());
|
||||
checkLoadSong(getVocalPath());
|
||||
checkLibrary("shared");
|
||||
if (PlayState.storyWeek > 0)
|
||||
checkLibrary("week" + PlayState.storyWeek);
|
||||
else
|
||||
checkLibrary("tutorial");
|
||||
|
||||
var fadeTime = 0.5;
|
||||
FlxG.camera.fade(FlxG.camera.bgColor, fadeTime, true);
|
||||
new FlxTimer().start(fadeTime + MIN_TIME, function(_) introComplete());
|
||||
// }
|
||||
|
||||
// initSongsManifest(onSongsManifestInit);
|
||||
initSongsManifest().onComplete
|
||||
(
|
||||
function (lib)
|
||||
{
|
||||
callbacks = new MultiCallback(onLoad);
|
||||
var introComplete = callbacks.add("introComplete");
|
||||
checkLoadSong(getSongPath());
|
||||
if (PlayState.SONG.needsVoices)
|
||||
checkLoadSong(getVocalPath());
|
||||
checkLibrary("shared");
|
||||
if (PlayState.storyWeek > 0)
|
||||
checkLibrary("week" + PlayState.storyWeek);
|
||||
else
|
||||
checkLibrary("tutorial");
|
||||
|
||||
var fadeTime = 0.5;
|
||||
FlxG.camera.fade(FlxG.camera.bgColor, fadeTime, true);
|
||||
new FlxTimer().start(fadeTime + MIN_TIME, function(_) introComplete());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function checkLoadSong(path:String)
|
||||
|
@ -80,10 +81,10 @@ class LoadingState extends MusicBeatState
|
|||
{
|
||||
var library = Assets.getLibrary("songs");
|
||||
final symbolPath = path.split(":").pop();
|
||||
@:privateAccess
|
||||
library.types.set(symbolPath, SOUND);
|
||||
@:privateAccess
|
||||
library.pathGroups.set(symbolPath, [library.__cacheBreak(symbolPath)]);
|
||||
// @:privateAccess
|
||||
// library.types.set(symbolPath, SOUND);
|
||||
// @:privateAccess
|
||||
// library.pathGroups.set(symbolPath, [library.__cacheBreak(symbolPath)]);
|
||||
var callback = callbacks.add("song:" + path);
|
||||
Assets.loadSound(path).onComplete(function (_) { callback(); });
|
||||
}
|
||||
|
@ -91,8 +92,13 @@ class LoadingState extends MusicBeatState
|
|||
|
||||
function checkLibrary(library:String)
|
||||
{
|
||||
trace(Assets.hasLibrary(library));
|
||||
if (Assets.getLibrary(library) == null)
|
||||
{
|
||||
@:privateAccess
|
||||
if (!LimeAssets.libraryPaths.exists(library))
|
||||
throw "Missing library: " + library;
|
||||
|
||||
var callback = callbacks.add("library:" + library);
|
||||
Assets.loadLibrary(library).onComplete(function (_) { callback(); });
|
||||
}
|
||||
|
@ -114,6 +120,10 @@ class LoadingState extends MusicBeatState
|
|||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
#if debug
|
||||
if (FlxG.keys.justPressed.SPACE)
|
||||
trace('fired: ' + callbacks.getFired() + " unfired:" + callbacks.getUnfired());
|
||||
#end
|
||||
}
|
||||
|
||||
function onLoad()
|
||||
|
@ -141,6 +151,7 @@ class LoadingState extends MusicBeatState
|
|||
|
||||
static function getNextState(target:FlxState, stopMusic = false):FlxState
|
||||
{
|
||||
Paths.setCurrentLevel("week" + PlayState.storyWeek);
|
||||
#if js
|
||||
var loaded = isSoundLoaded(getSongPath())
|
||||
&& (!PlayState.SONG.needsVoices || isSoundLoaded(getVocalPath()))
|
||||
|
@ -174,110 +185,68 @@ class LoadingState extends MusicBeatState
|
|||
callbacks = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* creates the song manifest without loading all the songs so we can load them individually
|
||||
* @param onComplete called on load
|
||||
* @return Future<AssetLibrary>
|
||||
*/
|
||||
static function initSongsManifest(onComplete:Void->Void):Future<AssetLibrary>
|
||||
static function initSongsManifest()
|
||||
{
|
||||
final id = "songs";
|
||||
var id = "songs";
|
||||
var promise = new Promise<AssetLibrary>();
|
||||
|
||||
// #if (tools && !display && !macro)
|
||||
var library = LimeAssets.getLibrary(id);
|
||||
|
||||
if (library != null)
|
||||
{
|
||||
onComplete();
|
||||
return Future.withValue(library);
|
||||
}
|
||||
|
||||
|
||||
var path = id;
|
||||
var rootPath = null;
|
||||
|
||||
// @:privateAccess
|
||||
// if (LimeAssets.bundlePaths.exists(id))
|
||||
// {
|
||||
// AssetBundle.loadFromFile(bundlePaths.get(id)).onComplete(function(bundle)
|
||||
// {
|
||||
// if (bundle == null)
|
||||
// {
|
||||
// promise.error("Cannot load bundle for library \"" + id + "\"");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// var library = AssetLibrary.fromBundle(bundle);
|
||||
|
||||
// if (library == null)
|
||||
// {
|
||||
// promise.error("Cannot open library \"" + id + "\"");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// libraries.set(id, library);
|
||||
// library.onChange.add(LimeAssets.onChange.dispatch);
|
||||
// promise.completeWith(Future.withValue(library));
|
||||
// onComplete();
|
||||
// }
|
||||
// }).onError(function(_)
|
||||
// {
|
||||
// promise.error("There is no asset library with an ID of \"" + id + "\"");
|
||||
// });
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
@:privateAccess
|
||||
final libraryPaths = LimeAssets.libraryPaths;
|
||||
if (libraryPaths.exists(id))
|
||||
@:privateAccess
|
||||
var libraryPaths = LimeAssets.libraryPaths;
|
||||
if (libraryPaths.exists(id))
|
||||
{
|
||||
path = libraryPaths[id];
|
||||
rootPath = Path.directory(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (StringTools.endsWith(path, ".bundle"))
|
||||
{
|
||||
path = libraryPaths[id];
|
||||
rootPath = Path.directory(path);
|
||||
rootPath = path;
|
||||
path += "/library.json";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (StringTools.endsWith(path, ".bundle"))
|
||||
{
|
||||
rootPath = path;
|
||||
path += "/library.json";
|
||||
}
|
||||
else
|
||||
{
|
||||
rootPath = Path.directory(path);
|
||||
}
|
||||
@:privateAccess
|
||||
path = LimeAssets.__cacheBreak(path);
|
||||
rootPath = Path.directory(path);
|
||||
}
|
||||
@:privateAccess
|
||||
path = LimeAssets.__cacheBreak(path);
|
||||
}
|
||||
|
||||
AssetManifest.loadFromFile(path, rootPath).onComplete(function(manifest)
|
||||
{
|
||||
if (manifest == null)
|
||||
{
|
||||
promise.error("Cannot parse asset manifest for library \"" + id + "\"");
|
||||
return;
|
||||
}
|
||||
|
||||
AssetManifest.loadFromFile(path, rootPath).onComplete(function(manifest)
|
||||
{
|
||||
if (manifest == null)
|
||||
{
|
||||
promise.error("Cannot parse asset manifest for library \"" + id + "\"");
|
||||
return;
|
||||
}
|
||||
var library = AssetLibrary.fromManifest(manifest);
|
||||
|
||||
var library = AssetLibrary.fromManifest(manifest);
|
||||
|
||||
if (library == null)
|
||||
{
|
||||
promise.error("Cannot open library \"" + id + "\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
@:privateAccess
|
||||
LimeAssets.libraries.set(id, library);
|
||||
library.onChange.add(LimeAssets.onChange.dispatch);
|
||||
promise.completeWith(Future.withValue(library));
|
||||
onComplete();
|
||||
}
|
||||
}).onError(function(_)
|
||||
if (library == null)
|
||||
{
|
||||
promise.error("There is no asset library with an ID of \"" + id + "\"");
|
||||
});
|
||||
// }
|
||||
// #end
|
||||
promise.error("Cannot open library \"" + id + "\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
@:privateAccess
|
||||
LimeAssets.libraries.set(id, library);
|
||||
library.onChange.add(LimeAssets.onChange.dispatch);
|
||||
promise.completeWith(Future.withValue(library));
|
||||
}
|
||||
}).onError(function(_)
|
||||
{
|
||||
promise.error("There is no asset library with an ID of \"" + id + "\"");
|
||||
});
|
||||
|
||||
return promise.future;
|
||||
}
|
||||
|
@ -337,5 +306,5 @@ class MultiCallback
|
|||
}
|
||||
|
||||
public function getFired() return fired.copy();
|
||||
public function getUnfired() return [for (id in unfired) id];
|
||||
public function getUnfired() return [for (id in unfired.keys()) id];
|
||||
}
|
|
@ -4,7 +4,9 @@ import flixel.FlxSprite;
|
|||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.util.FlxColor;
|
||||
#if polymod
|
||||
import polymod.format.ParseRules.TargetSignatureElement;
|
||||
#end
|
||||
|
||||
using StringTools;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class OptionsMenu extends MusicBeatState
|
|||
override function create()
|
||||
{
|
||||
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
|
||||
controlsStrings = CoolUtil.coolTextFile('assets/data/controls.txt');
|
||||
controlsStrings = CoolUtil.coolTextFile(Paths.txt('controls'));
|
||||
menuBG.color = 0xFFea71fd;
|
||||
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
|
||||
menuBG.updateHitbox();
|
||||
|
|
|
@ -30,7 +30,7 @@ class Paths
|
|||
return levelPath;
|
||||
}
|
||||
|
||||
return 'assets/$file';
|
||||
return 'assets/preload/$file';
|
||||
}
|
||||
|
||||
inline static function getLibraryPath(library:String, file:String)
|
||||
|
@ -43,14 +43,29 @@ class Paths
|
|||
return getPath(file, type);
|
||||
}
|
||||
|
||||
inline static public function sound(key:String)
|
||||
inline static public function txt(key:String)
|
||||
{
|
||||
return getPath('data/$key.txt', TEXT);
|
||||
}
|
||||
|
||||
inline static public function xml(key:String)
|
||||
{
|
||||
return getPath('data/$key.xml', TEXT);
|
||||
}
|
||||
|
||||
inline static public function json(key:String)
|
||||
{
|
||||
return getPath('data/$key.json', TEXT);
|
||||
}
|
||||
|
||||
static public function sound(key:String)
|
||||
{
|
||||
return getPath('sounds/$key.$SOUND_EXT', SOUND);
|
||||
}
|
||||
|
||||
inline static public function soundRandom(key:String, min:Int, max:Int)
|
||||
{
|
||||
return getPath('sounds/$key${FlxG.random.int(min, max)}.$SOUND_EXT', SOUND);
|
||||
return sound(key + FlxG.random.int(min, max));
|
||||
}
|
||||
|
||||
inline static public function music(key:String)
|
||||
|
@ -60,12 +75,12 @@ class Paths
|
|||
|
||||
inline static public function voices(song:String)
|
||||
{
|
||||
return "songs:" + getPath('songs/${song.toLowerCase()}/Voices.$SOUND_EXT', MUSIC);
|
||||
return 'songs:assets/songs/${song.toLowerCase()}/Voices.$SOUND_EXT';
|
||||
}
|
||||
|
||||
inline static public function inst(song:String)
|
||||
{
|
||||
return "songs:" + getPath('songs/${song.toLowerCase()}/Inst.$SOUND_EXT', MUSIC);
|
||||
return 'songs:assets/songs/${song.toLowerCase()}/Inst.$SOUND_EXT';
|
||||
}
|
||||
|
||||
inline static public function image(key:String)
|
||||
|
@ -73,6 +88,11 @@ class Paths
|
|||
return getPath('images/$key.png', IMAGE);
|
||||
}
|
||||
|
||||
inline static public function font(key:String)
|
||||
{
|
||||
return 'assets/fonts/$key';
|
||||
}
|
||||
|
||||
inline static public function getSparrowAtlas(key:String)
|
||||
{
|
||||
return FlxAtlasFrames.fromSparrow(image(key), file('images/$key.xml'));
|
||||
|
|
|
@ -139,7 +139,6 @@ class PlayState extends MusicBeatState
|
|||
|
||||
if (SONG == null)
|
||||
SONG = Song.loadFromJson('tutorial');
|
||||
Paths.setCurrentLevel(SONG.song);
|
||||
|
||||
Conductor.changeBPM(SONG.bpm);
|
||||
|
||||
|
@ -163,11 +162,11 @@ class PlayState extends MusicBeatState
|
|||
"Only then I will even CONSIDER letting you\ndate my daughter!"
|
||||
];
|
||||
case 'senpai':
|
||||
dialogue = CoolUtil.coolTextFile('assets/data/senpai/senpaiDialogue.txt');
|
||||
dialogue = CoolUtil.coolTextFile(Paths.txt('senpai/senpaiDialogue'));
|
||||
case 'roses':
|
||||
dialogue = CoolUtil.coolTextFile('assets/data/roses/rosesDialogue.txt');
|
||||
dialogue = CoolUtil.coolTextFile(Paths.txt('roses/rosesDialogue'));
|
||||
case 'thorns':
|
||||
dialogue = CoolUtil.coolTextFile('assets/data/thorns/thornsDialogue.txt');
|
||||
dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue'));
|
||||
}
|
||||
|
||||
if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south')
|
||||
|
@ -676,7 +675,7 @@ class PlayState extends MusicBeatState
|
|||
add(healthBar);
|
||||
|
||||
scoreTxt = new FlxText(healthBarBG.x + healthBarBG.width - 190, healthBarBG.y + 30, 0, "", 20);
|
||||
scoreTxt.setFormat("assets/fonts/vcr.ttf", 16, FlxColor.WHITE, RIGHT);
|
||||
scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT);
|
||||
scoreTxt.scrollFactor.set();
|
||||
add(scoreTxt);
|
||||
|
||||
|
@ -866,16 +865,16 @@ class PlayState extends MusicBeatState
|
|||
boyfriend.playAnim('idle');
|
||||
|
||||
var introAssets:Map<String, Array<String>> = new Map<String, Array<String>>();
|
||||
introAssets.set('default', ['ready.png', "set.png", "go.png"]);
|
||||
introAssets.set('default', ['ready', "set", "go"]);
|
||||
introAssets.set('school', [
|
||||
'weeb/pixelUI/ready-pixel.png',
|
||||
'weeb/pixelUI/set-pixel.png',
|
||||
'weeb/pixelUI/date-pixel.png'
|
||||
'weeb/pixelUI/ready-pixel',
|
||||
'weeb/pixelUI/set-pixel',
|
||||
'weeb/pixelUI/date-pixel'
|
||||
]);
|
||||
introAssets.set('schoolEvil', [
|
||||
'weeb/pixelUI/ready-pixel.png',
|
||||
'weeb/pixelUI/set-pixel.png',
|
||||
'weeb/pixelUI/date-pixel.png'
|
||||
'weeb/pixelUI/ready-pixel',
|
||||
'weeb/pixelUI/set-pixel',
|
||||
'weeb/pixelUI/date-pixel'
|
||||
]);
|
||||
|
||||
var introAlts:Array<String> = introAssets.get('default');
|
||||
|
@ -896,7 +895,7 @@ class PlayState extends MusicBeatState
|
|||
case 0:
|
||||
FlxG.sound.play(Paths.sound('intro3'), 0.6);
|
||||
case 1:
|
||||
var ready:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + introAlts[0]);
|
||||
var ready:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[0]));
|
||||
ready.scrollFactor.set();
|
||||
ready.updateHitbox();
|
||||
|
||||
|
@ -914,7 +913,7 @@ class PlayState extends MusicBeatState
|
|||
});
|
||||
FlxG.sound.play(Paths.sound('intro2'), 0.6);
|
||||
case 2:
|
||||
var set:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + introAlts[1]);
|
||||
var set:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[1]));
|
||||
set.scrollFactor.set();
|
||||
|
||||
if (curStage.startsWith('school'))
|
||||
|
@ -931,7 +930,7 @@ class PlayState extends MusicBeatState
|
|||
});
|
||||
FlxG.sound.play(Paths.sound('intro1'), 0.6);
|
||||
case 3:
|
||||
var go:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + introAlts[2]);
|
||||
var go:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[2]));
|
||||
go.scrollFactor.set();
|
||||
|
||||
if (curStage.startsWith('school'))
|
||||
|
@ -1743,7 +1742,7 @@ class PlayState extends MusicBeatState
|
|||
pixelShitPart2 = '-pixel';
|
||||
}
|
||||
|
||||
rating.loadGraphic('assets/images/' + pixelShitPart1 + daRating + pixelShitPart2 + ".png");
|
||||
rating.loadGraphic(Paths.image(pixelShitPart1 + daRating + pixelShitPart2));
|
||||
rating.screenCenter();
|
||||
rating.x = coolText.x - 40;
|
||||
rating.y -= 60;
|
||||
|
@ -2041,7 +2040,7 @@ class PlayState extends MusicBeatState
|
|||
if (!boyfriend.stunned)
|
||||
{
|
||||
health -= 0.04;
|
||||
if (combo > 5)
|
||||
if (combo > 5 && gf.animOffsets.exists('sad'))
|
||||
{
|
||||
gf.playAnim('sad');
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class Song
|
|||
|
||||
public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong
|
||||
{
|
||||
var rawJson = Assets.getText('assets/data/' + folder.toLowerCase() + '/' + jsonInput.toLowerCase() + '.json').trim();
|
||||
var rawJson = Assets.getText(Paths.json(folder.toLowerCase() + '/' + jsonInput.toLowerCase())).trim();
|
||||
|
||||
while (!rawJson.endsWith("}"))
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ class StoryMenuState extends MusicBeatState
|
|||
|
||||
var rankText:FlxText = new FlxText(0, 10);
|
||||
rankText.text = 'RANK: GREAT';
|
||||
rankText.setFormat("assets/fonts/vcr.ttf", 32);
|
||||
rankText.setFormat(Paths.font("vcr.ttf"), 32);
|
||||
rankText.size = scoreText.size;
|
||||
rankText.screenCenter(X);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import flixel.util.FlxTimer;
|
|||
import io.newgrounds.NG;
|
||||
import lime.app.Application;
|
||||
import openfl.Assets;
|
||||
import polymod.Polymod;
|
||||
|
||||
using StringTools;
|
||||
|
||||
|
@ -44,8 +43,10 @@ class TitleState extends MusicBeatState
|
|||
|
||||
override public function create():Void
|
||||
{
|
||||
Polymod.init({modRoot: "mods", dirs: ['introMod']});
|
||||
|
||||
#if polymod
|
||||
polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']});
|
||||
#end
|
||||
|
||||
#if (!web)
|
||||
TitleState.soundExt = '.ogg';
|
||||
#end
|
||||
|
@ -206,7 +207,7 @@ class TitleState extends MusicBeatState
|
|||
|
||||
function getIntroTextShit():Array<Array<String>>
|
||||
{
|
||||
var fullText:String = Assets.getText('assets/data/introText.txt');
|
||||
var fullText:String = Assets.getText(Paths.txt('introText'));
|
||||
|
||||
var firstArray:Array<String> = fullText.split('\n');
|
||||
var swagGoodArray:Array<Array<String>> = [];
|
||||
|
|
Loading…
Reference in a new issue