This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4750f68
commit cd49f1f
Showing
5 changed files
with
465 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
package; | ||
|
||
import haxe.macro.Expr.Case; | ||
import flash.text.TextField; | ||
import flixel.FlxG; | ||
import flixel.FlxSprite; | ||
import flixel.addons.display.FlxGridOverlay; | ||
import flixel.group.FlxGroup.FlxTypedGroup; | ||
import flixel.math.FlxMath; | ||
import flixel.text.FlxText; | ||
import flixel.util.FlxColor; | ||
import lime.utils.Assets; | ||
import DifficultyIcons; | ||
import lime.system.System; | ||
#if sys | ||
import sys.io.File; | ||
import haxe.io.Path; | ||
import openfl.utils.ByteArray; | ||
import lime.media.AudioBuffer; | ||
import sys.FileSystem; | ||
import flash.media.Sound; | ||
#end | ||
import haxe.Json; | ||
import tjson.TJSON; | ||
using StringTools; | ||
|
||
class SelectSortState extends MusicBeatState | ||
{ | ||
|
||
var songs:Array<String> = []; | ||
|
||
var selector:FlxText; | ||
var curSelected:Int = 0; | ||
var curDifficulty:Int = 1; | ||
|
||
var scoreText:FlxText; | ||
var diffText:FlxText; | ||
var lerpScore:Int = 0; | ||
var intendedScore:Int = 0; | ||
var usingCategoryScreen:Bool = false; | ||
private var grpSongs:FlxTypedGroup<Alphabet>; | ||
private var curPlaying:Bool = false; | ||
|
||
override function create() | ||
{ | ||
songs = ["songs", "categories", "weeks"]; | ||
|
||
|
||
// LOAD MUSIC | ||
|
||
// LOAD CHARACTERS | ||
|
||
var bg:FlxSprite = new FlxSprite().loadGraphic('assets/images/menuBGBlue.png'); | ||
add(bg); | ||
|
||
grpSongs = new FlxTypedGroup<Alphabet>(); | ||
add(grpSongs); | ||
|
||
for (i in 0...songs.length) | ||
{ | ||
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i], true, false); | ||
songText.isMenuItem = true; | ||
songText.targetY = i; | ||
grpSongs.add(songText); | ||
// songText.x += 40; | ||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! | ||
// songText.screenCenter(X); | ||
} | ||
|
||
|
||
changeSelection(); | ||
|
||
// FlxG.sound.playMusic('assets/music/title' + TitleState.soundExt, 0); | ||
// FlxG.sound.music.fadeIn(2, 0, 0.8); | ||
|
||
// JUST DOIN THIS SHIT FOR TESTING!!! | ||
/* | ||
var md:String = Markdown.markdownToHtml(Assets.getText('CHANGELOG.md')); | ||
var texFel:TextField = new TextField(); | ||
texFel.width = FlxG.width; | ||
texFel.height = FlxG.height; | ||
// texFel. | ||
texFel.htmlText = md; | ||
FlxG.stage.addChild(texFel); | ||
// scoreText.textField.htmlText = md; | ||
trace(md); | ||
*/ | ||
|
||
super.create(); | ||
} | ||
|
||
override function update(elapsed:Float) | ||
{ | ||
super.update(elapsed); | ||
|
||
if (FlxG.sound.music.volume < 0.7) | ||
{ | ||
FlxG.sound.music.volume += 0.5 * FlxG.elapsed; | ||
} | ||
|
||
|
||
var upP = controls.UP_P; | ||
var downP = controls.DOWN_P; | ||
var accepted = controls.ACCEPT; | ||
|
||
if (upP) | ||
{ | ||
changeSelection(-1); | ||
} | ||
if (downP) | ||
{ | ||
changeSelection(1); | ||
} | ||
|
||
if (controls.BACK) | ||
{ | ||
FlxG.switchState(new SaveDataState()); | ||
} | ||
|
||
if (accepted) | ||
{ | ||
trace(songs[curSelected]); | ||
switch (songs[curSelected]) { | ||
case "songs": | ||
CategoryState.choosingFor = "sorting"; | ||
FlxG.switchState(new CategoryState()); | ||
case "categories": | ||
var coolCategoryJson:Array<SelectSongsState.TCategory> = CoolUtil.parseJson(Assets.getText('assets/data/freeplaySongJson.jsonc')); | ||
var coolCategories:Array<String> = []; | ||
for (coolCategory in coolCategoryJson) | ||
{ | ||
coolCategories.push(coolCategory.name); | ||
} | ||
SortState.stuffToSort = coolCategories; | ||
SortState.sorting = "categories"; | ||
FlxG.switchState(new SortState()); | ||
case "weeks": | ||
// gonna be reallllllllll fucky renaming files | ||
SortState.sorting = "weeks"; | ||
// gonna do weeks ourselves? | ||
var coolWeekJson:StoryMenuState.StorySongsJson = CoolUtil.parseJson(Assets.getText('assets/data/storySonglist.json')); | ||
var coolWeeks:Array<String> = []; | ||
for (i in 0...coolWeekJson.songs.length) { | ||
coolWeeks.push("week"+i); | ||
} | ||
SortState.stuffToSort = coolWeeks; | ||
FlxG.switchState(new SortState()); | ||
} | ||
|
||
} | ||
} | ||
|
||
function changeSelection(change:Int = 0) | ||
{ | ||
|
||
FlxG.sound.play('assets/sounds/scrollMenu' + TitleState.soundExt, 0.4); | ||
|
||
curSelected += change; | ||
|
||
if (curSelected < 0) | ||
curSelected = songs.length - 1; | ||
if (curSelected >= songs.length) | ||
curSelected = 0; | ||
var bullShit:Int = 0; | ||
|
||
for (item in grpSongs.members) | ||
{ | ||
item.targetY = bullShit - curSelected; | ||
bullShit++; | ||
|
||
item.alpha = 0.6; | ||
// item.setGraphicSize(Std.int(item.width * 0.8)); | ||
|
||
if (item.targetY == 0) | ||
{ | ||
item.alpha = 1; | ||
// item.setGraphicSize(Std.int(item.width)); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.