mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
more forced version checks
This commit is contained in:
parent
1c28616679
commit
69c81eb5ce
3 changed files with 26 additions and 2 deletions
|
|
@ -231,5 +231,22 @@ class MainMenuGui extends GuiImage {
|
|||
#end
|
||||
}
|
||||
this.addChild(github);
|
||||
|
||||
#if js
|
||||
var urlParams = new js.html.URLSearchParams(js.Browser.window.location.search);
|
||||
var playParam = urlParams.get("app");
|
||||
if (playParam == "1" || playParam == "true") {
|
||||
// Get people to download the native app instead! Bruh
|
||||
if (!Util.isIOS()) {
|
||||
// If we aren't on iOS, then only we force them to download the native app, since thats the only valid use of PWA in this case
|
||||
haxe.Timer.delay(() -> {
|
||||
MarbleGame.canvas.pushDialog(new MessageBoxOkDlg("Please download the native app for a better experience! The game will run better and smoother that way!",
|
||||
() -> {
|
||||
js.Browser.window.open("https://github.com/RandomityGuy/MBHaxe/blob/master/README.md");
|
||||
}));
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import src.ResourceLoader;
|
|||
import src.Settings;
|
||||
|
||||
class MessageBoxOkDlg extends GuiControl {
|
||||
public function new(text:String) {
|
||||
public function new(text:String, ?onOk:() -> Void) {
|
||||
super();
|
||||
this.horizSizing = Width;
|
||||
this.vertSizing = Height;
|
||||
|
|
@ -50,6 +50,9 @@ class MessageBoxOkDlg extends GuiControl {
|
|||
okButton.gamepadAccelerator = ["A"];
|
||||
okButton.pressedAction = (sender) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
if (onOk != null) {
|
||||
onOk();
|
||||
}
|
||||
}
|
||||
yesNoFrame.addChild(okButton);
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,11 @@ class VersionGui extends GuiImage {
|
|||
firstline = StringTools.trim(firstline);
|
||||
if (firstline != MarbleGame.currentVersion) {
|
||||
// We need to update lol
|
||||
var mbo = new MessageBoxOkDlg("New version available! Please update your game.");
|
||||
var mbo = new MessageBoxOkDlg("New version available! Please update your game.", () -> {
|
||||
#if sys
|
||||
hxd.System.openURL("https://github.com/RandomityGuy/MBHaxe/blob/master/README.md");
|
||||
#end
|
||||
});
|
||||
MarbleGame.canvas.pushDialog(mbo);
|
||||
}
|
||||
}, (e) -> {});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue