diff --git a/hmm.json b/hmm.json index b32de6cc8..57467af02 100644 --- a/hmm.json +++ b/hmm.json @@ -1,81 +1,82 @@ { - "dependencies": [{ - "name": "discord_rpc", - "type": "git", - "dir": null, - "ref": "2d83fa8", - "url": "https://github.com/Aidan63/linc_discord-rpc" - }, - { - "name": "firetongue", - "type": "git", - "dir": null, - "ref": "c5666c8", - "url": "https://github.com/larsiusprime/firetongue" - }, - { - "name": "flixel", - "type": "git", - "dir": null, - "ref": "93a049d6", - "url": "https://github.com/haxeflixel/flixel" - }, - { - "name": "flixel-addons", - "type": "haxelib", - "version": "2.11.0" - }, - { - "name": "flixel-ui", - "type": "haxelib", - "version": "2.4.0" - }, - { - "name": "haxeui-core", - "type": "haxelib", - "version": null - }, - { - "name": "haxeui-flixel", - "type": "haxelib", - "version": null - }, - { - "name": "hscript", - "type": "haxelib", - "version": "2.5.0" - }, - { - "name": "hxcpp", - "type": "haxelib", - "version": "4.2.1" - }, - { - "name": "hxcpp-debug-server", - "type": "haxelib", - "version": "1.2.4" - }, - { - "name": "lime", - "type": "haxelib", - "version": "7.9.0" - }, - { - "name": "openfl", - "type": "haxelib", - "version": "9.1.0" - }, - { - "name": "polymod", - "type": "git", - "dir": null, - "ref": "c858b48", - "url": "https://github.com/larsiusprime/polymod" - }, - { - "name": "thx.semver", - "type": "haxelib", - "version": "0.2.2" - } - ] + "dependencies": [ + { + "name": "discord_rpc", + "type": "git", + "dir": null, + "ref": "2d83fa8", + "url": "https://github.com/Aidan63/linc_discord-rpc" + }, + { + "name": "firetongue", + "type": "git", + "dir": null, + "ref": "c5666c8", + "url": "https://github.com/larsiusprime/firetongue" + }, + { + "name": "flixel", + "type": "git", + "dir": null, + "ref": "93a049d6", + "url": "https://github.com/haxeflixel/flixel" + }, + { + "name": "flixel-addons", + "type": "haxelib", + "version": "2.11.0" + }, + { + "name": "flixel-ui", + "type": "haxelib", + "version": "2.4.0" + }, + { + "name": "haxeui-core", + "type": "haxelib", + "version": "1.5.0" + }, + { + "name": "haxeui-flixel", + "type": "haxelib", + "version": "1.5.0" + }, + { + "name": "hscript", + "type": "haxelib", + "version": "2.5.0" + }, + { + "name": "hxcpp", + "type": "haxelib", + "version": "4.2.1" + }, + { + "name": "hxcpp-debug-server", + "type": "haxelib", + "version": "1.2.4" + }, + { + "name": "lime", + "type": "haxelib", + "version": "7.9.0" + }, + { + "name": "openfl", + "type": "haxelib", + "version": "9.1.0" + }, + { + "name": "polymod", + "type": "git", + "dir": null, + "ref": "c858b48", + "url": "https://github.com/larsiusprime/polymod" + }, + { + "name": "thx.semver", + "type": "haxelib", + "version": "0.2.2" + } + ] } \ No newline at end of file diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 98c77f933..6423b4b0b 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -7,6 +7,7 @@ import flixel.FlxSprite; import flixel.FlxState; import flixel.addons.display.FlxGridOverlay; import flixel.addons.transition.FlxTransitionableState; +import flixel.addons.ui.FlxInputText; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup; import flixel.group.FlxSpriteGroup; @@ -66,6 +67,8 @@ class FreeplayState extends MusicBeatSubstate private var iconArray:Array = []; + var typing:FlxInputText; + override function create() { FlxTransitionableState.skipNextTransIn = true; @@ -260,55 +263,7 @@ class FreeplayState extends MusicBeatSubstate grpTxtScrolls.visible = true; }); - for (i in 0...songs.length) - { - var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, (i * 150) + 160, songs[i].songName); - funnyMenu.targetPos.x = funnyMenu.x; - funnyMenu.ID = i; - funnyMenu.alpha = 0.5; - funnyMenu.songText.visible = false; - - fp.updateScore(0); - - new FlxTimer().start((1 / 24) * i, function(doShit) - { - funnyMenu.doJumpIn = true; - }); - - new FlxTimer().start((0.09 * i) + 0.85, function(lerpTmr) - { - funnyMenu.doLerp = true; - }); - - new FlxTimer().start(((0.20 * i) / (1 + i)) + 0.75, function(swagShi) - { - funnyMenu.songText.visible = true; - funnyMenu.alpha = 1; - }); - - grpCapsules.add(funnyMenu); - - var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false); - songText.x += 100; - songText.isMenuItem = true; - songText.targetY = i; - - // grpSongs.add(songText); - - var icon:HealthIcon = new HealthIcon(songs[i].songCharacter); - // icon.sprTracker = songText; - - // using a FlxGroup is too much fuss! - iconArray.push(icon); - // add(icon); - - // songText.x += 40; - // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! - // songText.screenCenter(X); - } - - changeSelection(); - changeDiff(); + generateSongList(); // FlxG.sound.playMusic(Paths.music('title'), 0); // FlxG.sound.music.fadeIn(2, 0, 0.8); @@ -339,6 +294,15 @@ class FreeplayState extends MusicBeatSubstate funnyCam.bgColor = FlxColor.TRANSPARENT; FlxG.cameras.add(funnyCam); + typing = new FlxInputText(100, 100); + add(typing); + + typing.callback = function(txt, action) + { + generateSongList(new EReg(txt.trim(), "ig")); + trace(action); + }; + forEach(function(bs) { bs.cameras = [funnyCam]; @@ -347,6 +311,81 @@ class FreeplayState extends MusicBeatSubstate super.create(); } + public function generateSongList(?regexp:EReg) + { + curSelected = 0; + + grpCapsules.clear(); + + var regexp:EReg = regexp; + var tempSongs:Array = songs; + if (regexp != null) + tempSongs = songs.filter(item -> regexp.match(item.songName)); + + tempSongs.sort(function(a, b):Int + { + var tempA = a.songName.toUpperCase(); + var tempB = b.songName.toUpperCase(); + + if (tempA < tempB) + return -1; + else if (tempA > tempB) + return 1; + else + return 0; + }); + + for (i in 0...tempSongs.length) + { + var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, (i * 150) + 160, tempSongs[i].songName); + funnyMenu.targetPos.x = funnyMenu.x; + funnyMenu.ID = i; + funnyMenu.alpha = 0.5; + funnyMenu.songText.visible = false; + + fp.updateScore(0); + + new FlxTimer().start((1 / 24) * i, function(doShit) + { + funnyMenu.doJumpIn = true; + }); + + new FlxTimer().start((0.09 * i) + 0.85, function(lerpTmr) + { + funnyMenu.doLerp = true; + }); + + new FlxTimer().start(((0.20 * i) / (1 + i)) + 0.75, function(swagShi) + { + funnyMenu.songText.visible = true; + funnyMenu.alpha = 1; + }); + + grpCapsules.add(funnyMenu); + + var songText:Alphabet = new Alphabet(0, (70 * i) + 30, tempSongs[i].songName, true, false); + songText.x += 100; + songText.isMenuItem = true; + songText.targetY = i; + + // grpSongs.add(songText); + + var icon:HealthIcon = new HealthIcon(tempSongs[i].songCharacter); + // icon.sprTracker = songText; + + // using a FlxGroup is too much fuss! + iconArray.push(icon); + // add(icon); + + // songText.x += 40; + // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! + // songText.screenCenter(X); + } + + changeSelection(); + changeDiff(); + } + public function addSong(songName:String, weekNum:Int, songCharacter:String) { songs.push(new SongMetadata(songName, weekNum, songCharacter)); @@ -382,6 +421,9 @@ class FreeplayState extends MusicBeatSubstate { super.update(elapsed); + if (FlxG.keys.justPressed.T) + typing.hasFocus = true; + if (FlxG.sound.music != null) { if (FlxG.sound.music.volume < 0.7) @@ -496,7 +538,7 @@ class FreeplayState extends MusicBeatSubstate if (controls.UI_RIGHT_P) changeDiff(1); - if (controls.BACK) + if (controls.BACK && !typing.hasFocus) { FlxG.sound.play(Paths.sound('cancelMenu'));