diff --git a/TODO.md b/TODO.md index 916b968..40c1c22 100644 --- a/TODO.md +++ b/TODO.md @@ -2,7 +2,7 @@ ## v1.2 (Another small update but affect to gameplay) - [X] Make a switch state when there have no mods folder inside them (like will move to `ActionState` when have no folder contains `meta.json` in the `mods` folder) - [X] Display more thing on `About` state -- [ ] Add credits state on this engine (thought idk is should be?, but we will made mods can also add credits on them too) +- [X] Add credits state on this engine (thought idk is should be?, but we will made mods can also add credits on them too) - [X] Edit more thing on `GameSelectionState` (still same) - [X] Fix card display overlap the About State - [X] Edit more thing on `ActionState` diff --git a/source/CreditsState.hx b/source/CreditsState.hx index 1146df2..e83f640 100644 --- a/source/CreditsState.hx +++ b/source/CreditsState.hx @@ -12,6 +12,10 @@ import flixel.math.FlxMath; import flixel.system.FlxAssets; import flixel.text.FlxText; import flixel.util.FlxColor; +import sys.FileSystem; +import sys.io.File; + +using StringTools; class CreditsState extends FlxState { @@ -45,6 +49,9 @@ class CreditsState extends FlxState camFollow.screenCenter(X); add(camFollow); + for (mod in PolyHandler.getMods()) + pushCredits(mod); + grpCredits = new FlxTypedGroup(); add(grpCredits); @@ -125,4 +132,21 @@ class CreditsState extends FlxState { return creditsList[num].length <= 1; } + function pushCredits(folder:String) + { + var file:String = Paths.file(folder + "/data/credits.txt", "mods"); + trace(file); + if (FileSystem.exists(file)) + { + var firstarray:Array = File.getContent(file).split('\n'); + for (i in firstarray) + { + var arr:Array = i.replace('\\n', '\n').split("::"); + if (arr.length >= 5) + arr.push(folder); + creditsList.push(arr); + } + creditsList.push(['']); + } + } } \ No newline at end of file