HTML5 stuff, now going to sleep gn yall

This commit is contained in:
Yoshman29
2022-10-09 03:46:07 +02:00
parent 0a46a5c1d1
commit 44a5f4b1be
10 changed files with 39 additions and 24 deletions
+9 -7
View File
@@ -27,6 +27,7 @@ import flixel.ui.FlxButton;
import flixel.ui.FlxSpriteButton;
import flixel.util.FlxColor;
import haxe.Json;
import haxe.io.Path;
import lime.utils.Assets;
import openfl.events.Event;
import openfl.events.IOErrorEvent;
@@ -79,6 +80,8 @@ class ChartingState extends MusicBeatState
**/
var curSelectedNote:Array<Dynamic>;
var characterList:Array<String>;
var tempBpm:Int = 0;
var vocals:FlxSound;
@@ -89,6 +92,7 @@ class ChartingState extends MusicBeatState
override function create()
{
curSection = lastSection;
characterList = [for(e in Paths.getFolderContent('data/characters/')) if (Path.extension(e).toLowerCase() == "xml") e.substr(0, e.length-4)];
gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16);
add(gridBG);
@@ -176,7 +180,7 @@ class ChartingState extends MusicBeatState
add(curRenderedNotes);
add(curRenderedSustains);
trace(Paths.getFolderContent('data/characters/'));
super.create();
}
@@ -231,17 +235,15 @@ class ChartingState extends MusicBeatState
stepperBPM.value = Conductor.bpm;
stepperBPM.name = 'song_bpm';
var characters:Array<String> = CoolUtil.coolTextFile(Paths.txt('characterList'));
var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characterList, true), function(character:String)
{
_song.player1 = characters[Std.parseInt(character)];
_song.player1 = characterList[Std.parseInt(character)];
});
player1DropDown.selectedLabel = _song.player1;
var player2DropDown = new FlxUIDropDownMenu(140, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
var player2DropDown = new FlxUIDropDownMenu(140, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characterList, true), function(character:String)
{
_song.player2 = characters[Std.parseInt(character)];
_song.player2 = characterList[Std.parseInt(character)];
});
player2DropDown.selectedLabel = _song.player2;
-5
View File
@@ -144,11 +144,6 @@ class LoadingState extends MusicBeatState
return Paths.voices(PlayState.SONG.song);
}
inline static public function loadAndSwitchState(target:FlxState, stopMusic = false)
{
FlxG.switchState(getNextState(target, stopMusic));
}
static function getNextState(target:FlxState, stopMusic = false):FlxState
{
#if NO_PRELOAD_ALL
+1 -1
View File
@@ -118,7 +118,7 @@ class GameOverSubstate extends MusicBeatSubstate
{
FlxG.camera.fade(FlxColor.BLACK, 2, false, function()
{
LoadingState.loadAndSwitchState(new PlayState());
FlxG.switchState(new PlayState());
});
});
}
+1 -1
View File
@@ -1076,7 +1076,7 @@ class PlayState extends MusicBeatState
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase(), difficulty);
FlxG.sound.music.stop();
LoadingState.loadAndSwitchState(new PlayState());
FlxG.switchState(new PlayState());
}
}
else
@@ -2,7 +2,9 @@ package funkin.macros;
import haxe.macro.Expr.Field;
import haxe.macro.Context;
#if sys
import sys.io.File;
#end
class BuildCounterMacro {
// non functional
+3 -3
View File
@@ -220,7 +220,7 @@ class FreeplayState extends MusicBeatState
// PlayState.storyWeek = songs[curSelected].week;
trace('CUR WEEK' + PlayState.storyWeek);
LoadingState.loadAndSwitchState(new PlayState());
FlxG.switchState(new PlayState());
}
}
@@ -277,7 +277,7 @@ class FreeplayState extends MusicBeatState
for (i in 0...iconArray.length)
{
iconArray[i].alpha = lerp(iconArray[i].alpha, songInstPlaying ? 0.45 : 0.6, 0.25);
iconArray[i].alpha = lerp(iconArray[i].alpha, #if PRELOAD_ALL songInstPlaying ? 0.45 : #end 0.6, 0.25);
}
iconArray[curSelected].alpha = 1;
@@ -287,7 +287,7 @@ class FreeplayState extends MusicBeatState
item.targetY = bullShit - curSelected;
bullShit++;
item.alpha = lerp(item.alpha, songInstPlaying ? 0.45 : 0.6, 0.25);
item.alpha = lerp(item.alpha, #if PRELOAD_ALL songInstPlaying ? 0.45 : #end 0.6, 0.25);
// item.setGraphicSize(Std.int(item.width * 0.8));
if (item.targetY == 0)
+1 -1
View File
@@ -326,7 +326,7 @@ class StoryMenuState extends MusicBeatState
PlayState.campaignScore = 0;
new FlxTimer().start(1, function(tmr:FlxTimer)
{
LoadingState.loadAndSwitchState(new PlayState(), true);
FlxG.switchState(new PlayState());
});
}
}
+5 -2
View File
@@ -1,8 +1,6 @@
package funkin.mods;
import lime.utils.Log;
import sys.FileStat;
import sys.FileSystem;
import lime.utils.AssetLibrary;
import lime.utils.AssetManifest;
@@ -17,6 +15,11 @@ import lime.text.Font;
import lime.utils.AssetType;
import lime.utils.Bytes;
#if sys
import sys.FileStat;
import sys.FileSystem;
#end
using StringTools;
class ModsAssetLibrary extends AssetLibrary {
+2
View File
@@ -87,6 +87,7 @@ class ModsFolder {
* @param addRoot Whenever the root should be added to the paths. Defaults to false
*/
public static function getAssetFiles(assets:Array<Dynamic>, rootPath:String, path:String, libraryName:String, prefix:String = "", addRoot:Bool = false) {
#if sys
for(f in FileSystem.readDirectory('$rootPath$path')) {
if (FileSystem.isDirectory('$rootPath$path$f')) {
// fuck you git
@@ -117,6 +118,7 @@ class ModsFolder {
});
}
}
#end
}
public static function checkForOutdatedAssets(assets:ModsAssetLibrary) {
+15 -4
View File
@@ -86,12 +86,12 @@ class Paths
inline static public function voices(song:String)
{
return getPath('songs/${song.toLowerCase()}/Voices.ogg', MUSIC, null);
return getPath('songs/${song.toLowerCase()}/Voices.$SOUND_EXT', MUSIC, null);
}
inline static public function inst(song:String)
{
return getPath('songs/${song.toLowerCase()}/Inst.ogg', MUSIC, null);
return getPath('songs/${song.toLowerCase()}/Inst.$SOUND_EXT', MUSIC, null);
}
inline static public function image(key:String, ?library:String)
@@ -166,12 +166,23 @@ class Paths
}
var content:Array<String> = [];
#if sys
if (library is funkin.mods.ModsAssetLibrary) {
// easy task, can immediatly scan for files!
var lib = cast(library, funkin.mods.ModsAssetLibrary);
content = lib.getFiles(libThing.symbolName);
} else {
// TODO!!
} else
#end
if (library is lime.utils.AssetLibrary) {
var lib = cast(library, lime.utils.AssetLibrary);
@:privateAccess
for(k=>e in lib.paths) {
if (k.startsWith(libThing.symbolName)) {
var barebonesFileName = k.substr(libThing.symbolName.length);
if (!barebonesFileName.contains("/"))
content.push(barebonesFileName);
}
}
}
if (includeSource) {