diff --git a/src/gui/MainMenuGui.hx b/src/gui/MainMenuGui.hx index 65c6d7b1..cc22e515 100644 --- a/src/gui/MainMenuGui.hx +++ b/src/gui/MainMenuGui.hx @@ -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 } } diff --git a/src/gui/MessageBoxOkDlg.hx b/src/gui/MessageBoxOkDlg.hx index 69217aaa..b18e679e 100644 --- a/src/gui/MessageBoxOkDlg.hx +++ b/src/gui/MessageBoxOkDlg.hx @@ -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); diff --git a/src/gui/VersionGui.hx b/src/gui/VersionGui.hx index 9910ac0e..93322ab6 100644 --- a/src/gui/VersionGui.hx +++ b/src/gui/VersionGui.hx @@ -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) -> {});