From 6c3f1df72fd495bedfcd0415e145a2df86ca5a6b Mon Sep 17 00:00:00 2001 From: Gede Hari Date: Tue, 5 Jan 2021 16:29:32 +0800 Subject: [PATCH] Move version check screen to TitleState --- source/MainMenuState.hx | 7 ------- source/TitleState.hx | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 1c470084f..e1a1db228 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -89,13 +89,6 @@ class MainMenuState extends MusicBeatState versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); add(versionShit); - if (versionShit.text.trim() != NGio.GAME_VER.trim() && !OutdatedSubState.leftState) - { - trace('OLD VERSION!'); - - FlxG.switchState(new OutdatedSubState()); - } - // NG.core.calls.event.logEvent('swag').send(); changeItem(); diff --git a/source/TitleState.hx b/source/TitleState.hx index 786d2f2cc..c63d37bd3 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -20,9 +20,13 @@ import flixel.tweens.FlxEase; import flixel.tweens.FlxTween; import flixel.util.FlxColor; import flixel.util.FlxTimer; +import io.newgrounds.NG; +import lime.app.Application; import lime.utils.Assets; import polymod.Polymod; +using StringTools; + class TitleState extends MusicBeatState { static var initialized:Bool = false; @@ -261,7 +265,19 @@ class TitleState extends MusicBeatState new FlxTimer().start(2, function(tmr:FlxTimer) { - FlxG.switchState(new MainMenuState()); + // Check if version is outdated + + var version:String = "v" + Application.current.meta.get('version'); + + if (version.trim() != NGio.GAME_VER.trim() && !OutdatedSubState.leftState) + { + trace('OLD VERSION!'); + FlxG.switchState(new OutdatedSubState()); + } + else + { + FlxG.switchState(new MainMenuState()); + } }); // FlxG.sound.play('assets/music/titleShoot' + TitleState.soundExt, 0.7); }