KevinBlast/marble/client/scripts/version.cs

60 lines
1.3 KiB
C#
Raw Normal View History

2024-06-05 17:06:06 -04:00
$THIS_VERSION = "1.5";
$SERVER_VERSION = "1.5";
2024-03-10 20:27:00 -04:00
$BUILD_VERSION = 1;
$VERSION_MESSAGE = "";
//-------------------------------------
function startVersionCheck()
{
if($pref::checkMOTDAndVersion)
{
new HTTPObject ( Version );
Version.get("kevinthe.horse:80", "/kevinblast/version.html");
2024-03-10 20:27:00 -04:00
echo("Checking Server Version");
}
}
//-------------------------------------
function Version::onLine(%this, %line)
{
%cmd = firstWord(%line);
%rest = restWords(%line);
if (%cmd $= "VERSION")
%this.handleVersion(%rest);
}
//-------------------------------------
function Version::handleVersion(%this, %line)
{
$SERVER_VERSION = firstWord(%line);
$VERSION_MESSAGE = restWords(%line);
echo("Server Version = " @ $SERVER_VERSION);
echo("This Version = " @ $THIS_VERSION);
%this.check();
}
//-------------------------------------
function Version::check()
{
// only pop-up the notice on the "MainMenuGui" which calls this onWake
// just in case we missed it.
$content = canvas.getContent().getName();
if (($SERVER_VERSION > $THIS_VERSION) &&
($content $= "MainMenuGui") && !$VersionCheckDoneOnce)
{
$VersionCheckDoneOnce = true;
StopDemoTimer();
MOTDGuiText.setText("New Version Available!\n" @ $VERSION_MESSAGE);
Canvas.pushDialog(MOTDGui);
}
}