mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix some ui and game bugs
This commit is contained in:
parent
eaea583c2c
commit
a9149730d5
7 changed files with 47 additions and 19 deletions
|
|
@ -1724,6 +1724,13 @@ class Marble extends GameObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Net.isMP) {
|
||||
if (m.jump && this.outOfBounds) {
|
||||
this.level.cancel(this.oobSchedule);
|
||||
this.level.restart(cast this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MP Only Functions
|
||||
|
|
@ -1860,11 +1867,6 @@ class Marble extends GameObject {
|
|||
playedSounds = [];
|
||||
advancePhysics(timeState, move.move, collisionWorld, pathedInteriors);
|
||||
physicsAccumulator = 0;
|
||||
|
||||
if (move.move.jump && this.outOfBounds && Net.isHost) {
|
||||
this.level.cancel(this.oobSchedule);
|
||||
this.level.restart(cast this);
|
||||
}
|
||||
} else {
|
||||
physicsAccumulator = 0;
|
||||
newPos.load(oldPos);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package src;
|
||||
|
||||
import haxe.io.Path;
|
||||
import gui.MultiplayerGui;
|
||||
import net.MasterServerClient;
|
||||
import gui.MultiplayerLevelSelectGui;
|
||||
import net.NetCommands;
|
||||
|
|
@ -254,10 +256,10 @@ class MarbleGame {
|
|||
quitMission();
|
||||
}));
|
||||
} else {
|
||||
quitMission(Net.isClient);
|
||||
if (Net.isMP && Net.isClient) {
|
||||
Net.disconnect();
|
||||
}
|
||||
quitMission();
|
||||
}
|
||||
}, (sender) -> {
|
||||
@:privateAccess world.playGui.setGuiVisibility(true);
|
||||
|
|
@ -303,7 +305,7 @@ class MarbleGame {
|
|||
return world;
|
||||
}
|
||||
|
||||
public function quitMission() {
|
||||
public function quitMission(weDisconnecting:Bool = false) {
|
||||
Console.log("Quitting mission");
|
||||
if (Net.isMP) {
|
||||
if (Net.isHost) {
|
||||
|
|
@ -313,6 +315,7 @@ class MarbleGame {
|
|||
var watching = world.isWatching;
|
||||
var missionType = world.mission.type;
|
||||
var isNotCustom = !world.mission.isClaMission && !world.mission.isCustom;
|
||||
var lastMis = Path.withoutExtension(Path.withoutDirectory(world.mission.path));
|
||||
world.setCursorLock(false);
|
||||
if (!Settings.levelStatistics.exists(world.mission.path)) {
|
||||
Settings.levelStatistics.set(world.mission.path, {
|
||||
|
|
@ -335,8 +338,14 @@ class MarbleGame {
|
|||
#end
|
||||
} else {
|
||||
if (Net.isMP) {
|
||||
var lobby = new MultiplayerLevelSelectGui(Net.isHost);
|
||||
canvas.setContent(lobby);
|
||||
if (weDisconnecting) {
|
||||
MarbleGame.instance.setPreviewMission(lastMis, () -> {
|
||||
canvas.setContent(new MultiplayerGui());
|
||||
});
|
||||
} else {
|
||||
var lobby = new MultiplayerLevelSelectGui(Net.isHost);
|
||||
canvas.setContent(lobby);
|
||||
}
|
||||
} else {
|
||||
var pmg = new LevelSelectGui(LevelSelectGui.currentDifficultyStatic);
|
||||
if (_exitingToMenu) {
|
||||
|
|
|
|||
|
|
@ -733,7 +733,7 @@ class MarbleWorld extends Scheduler {
|
|||
this.clearSchedule();
|
||||
marble.outOfBounds = false;
|
||||
this.gameMode.onRespawn(marble);
|
||||
if (marble == this.marble)
|
||||
if (marble == this.marble && @:privateAccess !marble.isNetUpdate)
|
||||
AudioManager.playSound(ResourceLoader.getResource('data/sound/spawn_alternate.wav', ResourceLoader.getAudio, this.soundResources));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,12 +71,18 @@ class CreateMatchGui extends GuiImage {
|
|||
var privateGame = false;
|
||||
|
||||
var playerOpt = optionCollection.addOption(1, "Max Players", ["2", "3", "4", "5", "6", "7", "8"], (idx) -> {
|
||||
var newMaxPlayers = idx + 2;
|
||||
if (privateSlots >= newMaxPlayers)
|
||||
return false;
|
||||
maxPlayers = idx + 2;
|
||||
return true;
|
||||
}, 0.5, 118);
|
||||
playerOpt.setCurrentOption(6);
|
||||
|
||||
var privateOpt = optionCollection.addOption(1, "Private Slots", ["None", "1", "2", "3", "4", "5", "6", "7"], (idx) -> {
|
||||
var newPrivateSlotCount = idx;
|
||||
if (newPrivateSlotCount >= maxPlayers)
|
||||
return false;
|
||||
privateSlots = idx;
|
||||
return true;
|
||||
}, 0.5, 118);
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ class GuiXboxButton extends GuiControl {
|
|||
|
||||
public override function update(dt:Float, mouseState:MouseState) {
|
||||
var renderRect = getHitTestRect();
|
||||
renderRect.position = renderRect.position.add(new Vector(16, 22));
|
||||
renderRect.extent = renderRect.extent.sub(new Vector(32, 44));
|
||||
if (renderRect.inRect(mouseState.position) && !disabled) {
|
||||
if (buttonSounds && Key.isPressed(Key.MOUSE_LEFT)) {
|
||||
AudioManager.playSound(ResourceLoader.getResource("data/sound/buttonpress.wav", ResourceLoader.getAudio, this.soundResources));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package gui;
|
||||
|
||||
import net.Net;
|
||||
import hxd.res.BitmapFont;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
|
|
@ -13,6 +14,7 @@ class MultiplayerLoadingGui extends GuiImage {
|
|||
var loadAnim:GuiLoadAnim;
|
||||
var bottomBar:GuiControl;
|
||||
var innerCtrl:GuiControl;
|
||||
var backButton:GuiXboxButton;
|
||||
|
||||
public function new(initialStatus:String) {
|
||||
var res = ResourceLoader.getImage("data/ui/game/CloudBG.jpg").resource.toTile();
|
||||
|
|
@ -81,6 +83,18 @@ class MultiplayerLoadingGui extends GuiImage {
|
|||
bottomBar.horizSizing = Width;
|
||||
bottomBar.vertSizing = Bottom;
|
||||
innerCtrl.addChild(bottomBar);
|
||||
|
||||
backButton = new GuiXboxButton("Cancel", 160);
|
||||
backButton.position = new Vector(960, 0);
|
||||
backButton.vertSizing = Bottom;
|
||||
backButton.horizSizing = Right;
|
||||
backButton.gamepadAccelerator = ["A"];
|
||||
backButton.accelerators = [hxd.Key.ENTER];
|
||||
backButton.pressedAction = (e) -> {
|
||||
Net.disconnect();
|
||||
MarbleGame.canvas.setContent(new MultiplayerGui());
|
||||
};
|
||||
bottomBar.addChild(backButton);
|
||||
}
|
||||
|
||||
public function setLoadingStatus(str:String) {
|
||||
|
|
@ -92,17 +106,11 @@ class MultiplayerLoadingGui extends GuiImage {
|
|||
loadText.text.text = str;
|
||||
loadTextBg.text.text = str;
|
||||
loadAnim.anim.visible = false;
|
||||
|
||||
var backButton = new GuiXboxButton("Ok", 160);
|
||||
backButton.position = new Vector(960, 0);
|
||||
backButton.vertSizing = Bottom;
|
||||
backButton.horizSizing = Right;
|
||||
backButton.gamepadAccelerator = ["A"];
|
||||
backButton.accelerators = [hxd.Key.ENTER];
|
||||
backButton.text.text.text = "Ok";
|
||||
backButton.pressedAction = (e) -> {
|
||||
MarbleGame.canvas.setContent(new MultiplayerGui());
|
||||
};
|
||||
bottomBar.addChild(backButton);
|
||||
|
||||
MarbleGame.canvas.render(MarbleGame.canvas.scene2d);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,8 @@ class MasterServerClient {
|
|||
if (conts.type == "connectResponse") {
|
||||
Console.log("Remote Description Received!");
|
||||
var sdpObj = Json.parse(conts.sdp);
|
||||
@:privateAccess Net.client.setRemoteDescription(sdpObj.sdp, sdpObj.type);
|
||||
if (@:privateAccess Net.client != null)
|
||||
@:privateAccess Net.client.setRemoteDescription(sdpObj.sdp, sdpObj.type);
|
||||
}
|
||||
if (conts.type == "connectFailed") {
|
||||
var loadGui:MultiplayerLoadingGui = cast MarbleGame.canvas.content;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue