-
Trying to make a metadata text called Funkin_SLg0DtfljA.mp4import funkin.modding.module.Module;
import funkin.play.PauseSubState;
import flixel.FlxG;
import Std;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import funkin.play.PlayState;
import funkin.Paths;
import funkin.Assets;
import haxe.Json;
import funkin.modding.PolymodErrorHandler;
import funkin.modding.module.ModuleHandler;
class SilvaGunnerCreditHelper /*Shorten it later*/ extends Module {
var jsonPath = Paths.json("ripsCredits"); // deta/ripsCredits.json
var jsonData; // Shortcut to Json.parse(Assets.getText(jsonPath))
var ripsArray:Array; // Shortcut to Json.parse(Assets.getText(jsonPath)).rips
public function new() {
super("SilvaGunnerCreditHelper", 1);
}
override function onSubStateOpenBegin(event) {
var state = event.targetState;
if (Std.isOfType(state, PauseSubState)) {
if (PlayState.instance != null && Assets.exists(jsonPath) && PlayState.instance.currentChart != null) {
jsonData = Json.parse(Assets.getText(jsonPath));
ripsArray = jsonData.rips;
if (ripsArray != null) {
for (rip in ripsArray) {
if (rip.songID == PlayState.instance.currentSong.id || rip.songID == PlayState.instance.currentSong.songName) {
var ripCredit = new FlxText(20, 175 /*Right below the practice mode text*/, FlxG.width - 40);
ripCredit.text = "Ripper: " + rip.ripper; // Will look for ripper
ripCredit.scrollFactor.set(0, 0);
ripCredit.setFormat(Paths.font("vcr.ttf"), 32, 0xFFffffff, "right");
FlxTween.tween(ripCredit, {y: ripCredit.y + 5}, 1.8, {ease: FlxEase.quartOut, startDelay: 0.6 /*Will tween right after practice mode text*/}); // Here is the tween code, but I copy pasted the rest of the code here if it's needed
state.add(ripCredit);
} else {
// PolymodErrorHandler.showAlert("Song not found", "Couldn't find " + PlayState.instance.currentSong.id + " or " + PlayState.instance.currentSong.songName + " in " + jsonPath + "\n\nDid you double check the name?");
}
}
}
} else {
// ModuleHandler.deactivateModule(this); doesn't work..
}
}
super.onSubStateOpenBegin(event);
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
MAZ12211
Dec 22, 2024
Replies: 2 comments 1 reply
-
for |
Beta Was this translation helpful? Give feedback.
1 reply
-
Putting the entire state.openCallback = function() {
if (ripsArray != null) {
for (rip in ripsArray) {
if (rip.songID == PlayState.instance.currentSong.id || rip.songID == PlayState.instance.currentSong.songName) {
var ripCredit = new FlxText(20, 175 /*Right below the practice mode text*/, FlxG.width - 40);
ripCredit.text = "Ripper: " + rip.ripper; // Will look for ripper
ripCredit.scrollFactor.set(0, 0);
ripCredit.setFormat(Paths.font("vcr.ttf"), 32, 0xFFffffff, "right");
FlxTween.tween(ripCredit, {y: ripCredit.y + 5}, 1.8, {ease: FlxEase.quartOut, startDelay: 0.6 /*Will tween right after practice mode text*/});
state.add(ripCredit);
} else {
// PolymodErrorHandler.showAlert("Song not found", "Couldn't find " + PlayState.instance.currentSong.id + " or " + PlayState.instance.currentSong.songName + " in " + jsonPath + "\n\nDid you double check the name?");
}
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
MAZ12211
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Putting the entire
ripsArray
null check inopenCallback
did the fix