1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-27 01:03:35 +00:00

outdated check

This commit is contained in:
Cameron Taylor 2020-12-25 00:17:21 -05:00
parent afac787076
commit 649ce2bc9d
3 changed files with 22 additions and 12 deletions

View file

@ -87,12 +87,14 @@ class MainMenuState extends MusicBeatState
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(versionShit);
if (versionShit.text != NGio.GAME_VER)
if (versionShit.text != NGio.GAME_VER && !OutdatedSubState.leftState)
{
openSubState(new OutdatedSubState());
trace('OLD VERSION!');
FlxG.switchState(new OutdatedSubState());
}
NG.core.calls.event.logEvent('swag').send();
// NG.core.calls.event.logEvent('swag').send();
changeItem();

View file

@ -2,6 +2,7 @@ package;
import flixel.FlxG;
import flixel.util.FlxSignal;
import flixel.util.FlxTimer;
import io.newgrounds.NG;
import io.newgrounds.components.ScoreBoardComponent.Period;
import io.newgrounds.objects.Medal;
@ -27,6 +28,7 @@ class NGio
public static var ngScoresLoaded(default, null):FlxSignal = new FlxSignal();
public static var GAME_VER:String = "";
public static var gotOnlineVer:Bool = false;
public static function noLogin(api:String)
{
@ -35,13 +37,13 @@ class NGio
NG.create(api);
NG.onCoreReady.add(function()
new FlxTimer().start(2, function(tmr:FlxTimer)
{
trace('READY SHIT??');
var call = NG.core.calls.gateway.getVersion().addDataHandler(function(response:Response<GetVersionResult>)
var call = NG.core.calls.app.getCurrentVersion(GAME_VER).addDataHandler(function(response:Response<GetCurrentVersionResult>)
{
GAME_VER = response.result.data.version;
GAME_VER = response.result.data.current_version;
trace('CURRENT NG VERSION: ' + GAME_VER);
gotOnlineVer = true;
});
call.send();

View file

@ -1,18 +1,23 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxSubState;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import lime.app.Application;
class OutdatedSubState extends MusicBeatSubstate
class OutdatedSubState extends MusicBeatState
{
public function new()
public static var leftState:Bool = false;
override function create()
{
super();
super.create();
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
add(bg);
var ver = "v" + Application.current.meta.get('version');
var txt:FlxText = new FlxText(0, 0, 0,
var txt:FlxText = new FlxText(0, 0, FlxG.width,
"HEY! You're running an outdated version of the game!\nCurrent version is "
+ ver
+ " while the current version is "
@ -32,7 +37,8 @@ class OutdatedSubState extends MusicBeatSubstate
}
if (controls.BACK)
{
close();
leftState = true;
FlxG.switchState(new MainMenuState());
}
super.update(elapsed);
}