mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-22 09:59:25 +00:00
file and folder detection
This commit is contained in:
parent
d7aba46853
commit
bfcb037b81
|
@ -1,19 +1,17 @@
|
||||||
package;
|
package;
|
||||||
|
|
||||||
import lime.app.Promise;
|
|
||||||
import lime.app.Future;
|
|
||||||
import flixel.FlxG;
|
import flixel.FlxG;
|
||||||
import flixel.FlxState;
|
|
||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
|
import flixel.FlxState;
|
||||||
import flixel.graphics.frames.FlxAtlasFrames;
|
import flixel.graphics.frames.FlxAtlasFrames;
|
||||||
import flixel.util.FlxTimer;
|
import flixel.util.FlxTimer;
|
||||||
|
import haxe.io.Path;
|
||||||
import openfl.utils.Assets;
|
import lime.app.Future;
|
||||||
import lime.utils.Assets as LimeAssets;
|
import lime.app.Promise;
|
||||||
import lime.utils.AssetLibrary;
|
import lime.utils.AssetLibrary;
|
||||||
import lime.utils.AssetManifest;
|
import lime.utils.AssetManifest;
|
||||||
|
import lime.utils.Assets as LimeAssets;
|
||||||
import haxe.io.Path;
|
import openfl.utils.Assets;
|
||||||
|
|
||||||
class LoadingState extends MusicBeatState
|
class LoadingState extends MusicBeatState
|
||||||
{
|
{
|
||||||
|
@ -53,9 +51,7 @@ class LoadingState extends MusicBeatState
|
||||||
add(gfDance);
|
add(gfDance);
|
||||||
add(logo);
|
add(logo);
|
||||||
|
|
||||||
initSongsManifest().onComplete
|
initSongsManifest().onComplete(function(lib)
|
||||||
(
|
|
||||||
function (lib)
|
|
||||||
{
|
{
|
||||||
callbacks = new MultiCallback(onLoad);
|
callbacks = new MultiCallback(onLoad);
|
||||||
var introComplete = callbacks.add("introComplete");
|
var introComplete = callbacks.add("introComplete");
|
||||||
|
@ -71,8 +67,7 @@ class LoadingState extends MusicBeatState
|
||||||
var fadeTime = 0.5;
|
var fadeTime = 0.5;
|
||||||
FlxG.camera.fade(FlxG.camera.bgColor, fadeTime, true);
|
FlxG.camera.fade(FlxG.camera.bgColor, fadeTime, true);
|
||||||
new FlxTimer().start(fadeTime + MIN_TIME, function(_) introComplete());
|
new FlxTimer().start(fadeTime + MIN_TIME, function(_) introComplete());
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkLoadSong(path:String)
|
function checkLoadSong(path:String)
|
||||||
|
@ -86,7 +81,10 @@ class LoadingState extends MusicBeatState
|
||||||
// @:privateAccess
|
// @:privateAccess
|
||||||
// library.pathGroups.set(symbolPath, [library.__cacheBreak(symbolPath)]);
|
// library.pathGroups.set(symbolPath, [library.__cacheBreak(symbolPath)]);
|
||||||
var callback = callbacks.add("song:" + path);
|
var callback = callbacks.add("song:" + path);
|
||||||
Assets.loadSound(path).onComplete(function (_) { callback(); });
|
Assets.loadSound(path).onComplete(function(_)
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +98,10 @@ class LoadingState extends MusicBeatState
|
||||||
throw "Missing library: " + library;
|
throw "Missing library: " + library;
|
||||||
|
|
||||||
var callback = callbacks.add("library:" + library);
|
var callback = callbacks.add("library:" + library);
|
||||||
Assets.loadLibrary(library).onComplete(function (_) { callback(); });
|
Assets.loadLibrary(library).onComplete(function(_)
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +263,7 @@ class MultiCallback
|
||||||
var unfired = new Map<String, Void->Void>();
|
var unfired = new Map<String, Void->Void>();
|
||||||
var fired = new Array<String>();
|
var fired = new Array<String>();
|
||||||
|
|
||||||
public function new (callback:Void->Void, logId:String = null)
|
public function new(callback:Void->Void, logId:String = null)
|
||||||
{
|
{
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.logId = logId;
|
this.logId = logId;
|
||||||
|
@ -274,7 +275,7 @@ class MultiCallback
|
||||||
length++;
|
length++;
|
||||||
numRemaining++;
|
numRemaining++;
|
||||||
var func:Void->Void = null;
|
var func:Void->Void = null;
|
||||||
func = function ()
|
func = function()
|
||||||
{
|
{
|
||||||
if (unfired.exists(id))
|
if (unfired.exists(id))
|
||||||
{
|
{
|
||||||
|
@ -305,6 +306,9 @@ class MultiCallback
|
||||||
trace('$logId: $msg');
|
trace('$logId: $msg');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFired() return fired.copy();
|
public function getFired()
|
||||||
public function getUnfired() return [for (id in unfired.keys()) id];
|
return fired.copy();
|
||||||
|
|
||||||
|
public function getUnfired()
|
||||||
|
return [for (id in unfired.keys()) id];
|
||||||
}
|
}
|
33
source/ModdingSubstate.hx
Normal file
33
source/ModdingSubstate.hx
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
package;
|
||||||
|
|
||||||
|
import flixel.text.FlxText;
|
||||||
|
import sys.FileSystem;
|
||||||
|
|
||||||
|
class ModdingSubstate extends MusicBeatSubstate
|
||||||
|
{
|
||||||
|
public function new():Void
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
// var pathShit
|
||||||
|
|
||||||
|
var modList = [];
|
||||||
|
|
||||||
|
for (file in FileSystem.readDirectory('./mods'))
|
||||||
|
{
|
||||||
|
if (FileSystem.isDirectory("./mods/" + file))
|
||||||
|
modList.push(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
trace(modList);
|
||||||
|
|
||||||
|
var loopNum:Int = 0;
|
||||||
|
for (i in modList)
|
||||||
|
{
|
||||||
|
var txt:FlxText = new FlxText(0, 10 + (40 * loopNum), 0, i, 32);
|
||||||
|
add(txt);
|
||||||
|
|
||||||
|
loopNum++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,10 @@ class OptionsSubState extends MusicBeatSubstate
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
#if desktop
|
||||||
|
textMenuItems.push('Mods');
|
||||||
|
#end
|
||||||
|
|
||||||
grpOptionsTexts = new FlxTypedGroup<FlxText>();
|
grpOptionsTexts = new FlxTypedGroup<FlxText>();
|
||||||
add(grpOptionsTexts);
|
add(grpOptionsTexts);
|
||||||
|
|
||||||
|
@ -64,6 +68,9 @@ class OptionsSubState extends MusicBeatSubstate
|
||||||
case "Controls":
|
case "Controls":
|
||||||
FlxG.state.closeSubState();
|
FlxG.state.closeSubState();
|
||||||
FlxG.state.openSubState(new ControlsSubState());
|
FlxG.state.openSubState(new ControlsSubState());
|
||||||
|
case "Mods":
|
||||||
|
FlxG.state.closeSubState();
|
||||||
|
FlxG.state.openSubState(new ModdingSubstate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue