update crap

This commit is contained in:
KadeDev 2021-03-09 12:23:52 -08:00
parent a02adfb7af
commit 136dd62114
2 changed files with 30 additions and 8 deletions

View File

@ -11,6 +11,8 @@ class OutdatedSubState extends MusicBeatState
{
public static var leftState:Bool = false;
public static var needVer:String = "IDFK LOL";
override function create()
{
super.create();
@ -18,11 +20,11 @@ class OutdatedSubState extends MusicBeatState
add(bg);
var ver = "v" + Application.current.meta.get('version');
var txt:FlxText = new FlxText(0, 0, FlxG.width,
"HEY! You're running an outdated version of the game!\nCurrent version is "
"Kade Engine is Outdated!\n"
+ ver
+ " while the most recent version is "
+ NGio.GAME_VER
+ "! Press Space to go to itch.io, or ESCAPE to ignore this!!",
+ " is your current version while the most recent version is "
+ needVer
+ "! Press Space to go to the github or ESCAPE to ignore this!!",
32);
txt.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, CENTER);
txt.screenCenter();
@ -33,7 +35,7 @@ class OutdatedSubState extends MusicBeatState
{
if (controls.ACCEPT)
{
FlxG.openURL("https://ninja-muffin24.itch.io/funkin");
FlxG.openURL("https://github.com/KadeDev/Kade-Engine/releases/latest");
}
if (controls.BACK)
{

View File

@ -276,11 +276,31 @@ class TitleState extends MusicBeatState
new FlxTimer().start(2, function(tmr:FlxTimer)
{
// Check if version is outdated
var version:String = "v" + Application.current.meta.get('version');
// Get current version of Kade Engine
var http = new haxe.Http("https://raw.githubusercontent.com/KadeDev/Kade-Engine/master/version.downloadMe");
http.onData = function (data:String) {
var result = haxe.Json.parse(data);
if (MainMenuState.kadeEngineVer != result && !OutdatedSubState.leftState)
{
OutdatedSubState.needVer = result;
FlxG.switchState(new OutdatedSubState());
}
else
{
FlxG.switchState(new MainMenuState());
}
}
http.onError = function (error) {
trace('error: $error');
FlxG.switchState(new MainMenuState()); // fail but we go anyway
}
http.request();
FlxG.switchState(new MainMenuState());
});
// FlxG.sound.play(Paths.music('titleShoot'), 0.7);
}