From 136dd621146b592a8ef86ffaddad9db9f1bf2fb9 Mon Sep 17 00:00:00 2001 From: KadeDev Date: Tue, 9 Mar 2021 12:23:52 -0800 Subject: [PATCH] update crap --- source/OutdatedSubState.hx | 12 +++++++----- source/TitleState.hx | 26 +++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/source/OutdatedSubState.hx b/source/OutdatedSubState.hx index 962edd9..8cf806a 100644 --- a/source/OutdatedSubState.hx +++ b/source/OutdatedSubState.hx @@ -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) { diff --git a/source/TitleState.hx b/source/TitleState.hx index 13c93ad..8554967 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -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); }