mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
add version check and attempt mobile controls fixes
This commit is contained in:
parent
0f11c17cb8
commit
6f374db2ad
7 changed files with 29 additions and 1 deletions
BIN
data/ui/touch/video-camera.png
Normal file
BIN
data/ui/touch/video-camera.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
|
|
@ -1,5 +1,6 @@
|
|||
package;
|
||||
|
||||
import gui.VersionGui;
|
||||
import src.Debug;
|
||||
import src.Marbleland;
|
||||
import src.Console;
|
||||
|
|
@ -103,6 +104,7 @@ class Main extends hxd.App {
|
|||
Marbleland.init();
|
||||
marbleGame = new MarbleGame(s2d, s3d);
|
||||
MarbleGame.canvas.setContent(new MainMenuGui());
|
||||
VersionGui.checkVersion();
|
||||
|
||||
new ProfilerUI(s2d);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ class MarbleGame {
|
|||
|
||||
static var instance:MarbleGame;
|
||||
|
||||
static var currentVersion = "1.5.4";
|
||||
|
||||
var world:MarbleWorld;
|
||||
|
||||
var scene2d:h2d.Scene;
|
||||
|
|
|
|||
|
|
@ -593,6 +593,9 @@ class MarbleWorld extends Scheduler {
|
|||
public function showPreGame() {
|
||||
MarbleGame.canvas.pushDialog(new MPPreGameDlg());
|
||||
this.setCursorLock(false);
|
||||
if (Util.isTouchDevice()) {
|
||||
MarbleGame.instance.touchInput.setControlsEnabled(false);
|
||||
}
|
||||
this.marble.camera.startOverview();
|
||||
|
||||
// Hide all gems
|
||||
|
|
|
|||
|
|
@ -89,4 +89,18 @@ class VersionGui extends GuiImage {
|
|||
});
|
||||
scrollCtrl.addChild(changelogContent);
|
||||
}
|
||||
|
||||
public static function checkVersion() {
|
||||
Http.get("https://raw.githubusercontent.com/RandomityGuy/MBHaxe/master/CHANGELOG.md", (res) -> {
|
||||
var mdtext = res.toString();
|
||||
var firstline = mdtext.split("\n")[0];
|
||||
firstline = StringTools.replace(firstline, "#", "");
|
||||
firstline = StringTools.trim(firstline);
|
||||
if (firstline != MarbleGame.currentVersion) {
|
||||
// We need to update lol
|
||||
var mbo = new MessageBoxOkDlg("New version available! Please update your game.");
|
||||
MarbleGame.canvas.pushDialog(mbo);
|
||||
}
|
||||
}, (e) -> {});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import src.MissionList;
|
|||
import src.Console;
|
||||
import src.Marbleland;
|
||||
import src.Settings;
|
||||
import src.Util;
|
||||
|
||||
@:build(net.RPCMacro.build())
|
||||
class NetCommands {
|
||||
|
|
@ -242,6 +243,10 @@ class NetCommands {
|
|||
if (MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1] is MPPreGameDlg) {
|
||||
MarbleGame.canvas.popDialog(MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1]);
|
||||
MarbleGame.instance.world.setCursorLock(true);
|
||||
if (Util.isTouchDevice()) {
|
||||
MarbleGame.canvas.render(MarbleGame.canvas.scene2d);
|
||||
MarbleGame.instance.touchInput.setControlsEnabled(true);
|
||||
}
|
||||
MarbleGame.instance.world.marble.camera.stopOverview();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package touch;
|
||||
|
||||
import src.MarbleGame;
|
||||
import touch.TouchInput.Touch;
|
||||
import h3d.Vector;
|
||||
import hxd.Window;
|
||||
|
|
@ -8,7 +9,8 @@ import src.Settings;
|
|||
|
||||
class BlastButton extends TouchButton {
|
||||
public function new() {
|
||||
super(ResourceLoader.getImage("data/ui/touch/explosion.png").resource,
|
||||
var mode = MarbleGame.instance.world != null ? @:privateAccess MarbleGame.instance.world.marble.camera.spectate : false;
|
||||
super(ResourceLoader.getImage(mode ? "data/ui/touch/video-camera.png" : "data/ui/touch/explosion.png").resource,
|
||||
new Vector(Settings.touchSettings.blastButtonPos[0], Settings.touchSettings.blastButtonPos[1]), Settings.touchSettings.blastButtonSize);
|
||||
this.setEnabled(false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue