From 448c93ffd21ffa75f62adc72941755a49b7a88b1 Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Thu, 20 Jun 2024 22:12:22 +0530 Subject: [PATCH] pre-game stuff --- src/MarbleGame.hx | 4 + src/MarbleWorld.hx | 83 ++++++++++---------- src/gui/GuiMLTextListCtrl.hx | 22 ++++-- src/gui/GuiTextListCtrl.hx | 22 +++++- src/gui/MPPlayMissionGui.hx | 9 --- src/gui/MPPreGameDlg.hx | 143 +++++++++++++++++++++++++++-------- src/gui/PlayGui.hx | 42 +++------- src/net/Net.hx | 12 +++ src/net/NetCommands.hx | 16 +++- 9 files changed, 233 insertions(+), 120 deletions(-) diff --git a/src/MarbleGame.hx b/src/MarbleGame.hx index fdaa917d..4695eda0 100644 --- a/src/MarbleGame.hx +++ b/src/MarbleGame.hx @@ -1,5 +1,6 @@ package src; +import gui.MPPreGameDlg; import gui.MPExitGameDlg; import gui.GuiControl; import gui.MPPlayMissionGui; @@ -200,6 +201,9 @@ class MarbleGame { if (((Key.isPressed(Key.ESCAPE) #if js && paused #end) || Gamepad.isPressed(["start"])) && world.finishTime == null && world._ready) { + if (MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1] is MPPreGameDlg) { + return; // don't pause + } paused = !paused; handlePauseGame(); } diff --git a/src/MarbleWorld.hx b/src/MarbleWorld.hx index bb9a9a1b..859900c6 100644 --- a/src/MarbleWorld.hx +++ b/src/MarbleWorld.hx @@ -531,10 +531,10 @@ class MarbleWorld extends Scheduler { interior.onLevelStart(); for (shape in this.dtsObjects) shape.onLevelStart(); - if (this.isMultiplayer && Net.isClient) - NetCommands.clientIsReady(Net.clientId); + // if (this.isMultiplayer && Net.isClient) + // NetCommands.clientIsReady(Net.clientId); if (this.isMultiplayer && Net.isHost) { - NetCommands.clientIsReady(-1); + // NetCommands.clientIsReady(-1); // Sort all the marbles so that they are updated in a deterministic order this.marbles.sort((a, b) -> @:privateAccess { @@ -1720,50 +1720,53 @@ class MarbleWorld extends Scheduler { var otherMoves = []; var myMove = null; - for (marble in marbles) { - var move = marble.updateServer(fixedDt, collisionWorld, pathedInteriors); - if (marble == this.marble) - myMove = move; - else - otherMoves.push(move); - } + if (serverStartTicks != 0) { + for (marble in marbles) { + var move = marble.updateServer(fixedDt, collisionWorld, pathedInteriors); + if (marble == this.marble) + myMove = move; + else + otherMoves.push(move); + } - if (myMove != null && Net.isClient) { - this.predictions.storeState(marble, myMove.timeState.ticks); - for (client => marble in clientMarbles) { + if (myMove != null && Net.isClient) { this.predictions.storeState(marble, myMove.timeState.ticks); - } - } - if (Net.isHost) { - packets.push(marble.packUpdate(myMove, fixedDt)); - for (othermarble in marbles) { - if (othermarble != this.marble) { - var mv = otherMoves.shift(); - packets.push(othermarble.packUpdate(mv, fixedDt)); + for (client => marble in clientMarbles) { + this.predictions.storeState(marble, myMove.timeState.ticks); } } - // for (client => othermarble in clientMarbles) { // Oh no! - // var mv = otherMoves.shift(); - // packets.push(marble.packUpdate(myMove, fixedDt)); - // packets.push(othermarble.packUpdate(mv, fixedDt)); - // } - var allRecv = true; - for (client => marble in clientMarbles) { // Oh no! - // var pktClone = packets.copy(); - // pktClone.sort((a, b) -> { - // return (a.c == client.id) ? 1 : (b.c == client.id) ? -1 : 0; - // }); - if (client.state != GAME) { - allRecv = false; - continue; // Only send if in game + + if (Net.isHost) { + packets.push(marble.packUpdate(myMove, fixedDt)); + for (othermarble in marbles) { + if (othermarble != this.marble) { + var mv = otherMoves.shift(); + packets.push(othermarble.packUpdate(mv, fixedDt)); + } } - marble.clearNetFlags(); - for (packet in packets) { - client.sendBytes(packet); + // for (client => othermarble in clientMarbles) { // Oh no! + // var mv = otherMoves.shift(); + // packets.push(marble.packUpdate(myMove, fixedDt)); + // packets.push(othermarble.packUpdate(mv, fixedDt)); + // } + var allRecv = true; + for (client => marble in clientMarbles) { // Oh no! + // var pktClone = packets.copy(); + // pktClone.sort((a, b) -> { + // return (a.c == client.id) ? 1 : (b.c == client.id) ? -1 : 0; + // }); + if (client.state != GAME) { + allRecv = false; + continue; // Only send if in game + } + marble.clearNetFlags(); + for (packet in packets) { + client.sendBytes(packet); + } } + if (allRecv) + this.marble.clearNetFlags(); } - if (allRecv) - this.marble.clearNetFlags(); } timeState.ticks++; } diff --git a/src/gui/GuiMLTextListCtrl.hx b/src/gui/GuiMLTextListCtrl.hx index 01d63b9b..8f105e50 100644 --- a/src/gui/GuiMLTextListCtrl.hx +++ b/src/gui/GuiMLTextListCtrl.hx @@ -34,18 +34,28 @@ class GuiMLTextListCtrl extends GuiControl { public var scrollable:Bool = false; - var filter:Filter = null; + var dropShadow:{ + dx:Float, + dy:Float, + color:Int, + alpha:Float + }; var flow:Flow; var _imageLoader:String->Tile; - public function new(font:Font, texts:Array, imageLoader:String->Tile, ?filter:Filter = null) { + public function new(font:Font, texts:Array, imageLoader:String->Tile, ?filter:{ + dx:Float, + dy:Float, + color:Int, + alpha:Float + } = null) { super(); this.font = font; this.texts = texts; this._manualScroll = true; this.textObjs = []; - this.filter = filter; + this.dropShadow = filter; this._imageLoader = imageLoader; for (text in texts) { var tobj = new HtmlText(font); @@ -54,7 +64,7 @@ class GuiMLTextListCtrl extends GuiControl { tobj.text = text; tobj.textColor = 0; if (filter != null) - tobj.filter = filter; + tobj.dropShadow = filter; textObjs.push(tobj); } this.g = new Graphics(); @@ -72,8 +82,8 @@ class GuiMLTextListCtrl extends GuiControl { tobj.lineHeightMode = TextOnly; tobj.text = text; tobj.textColor = 0; - if (filter != null) - tobj.filter = filter; + if (dropShadow != null) + tobj.dropShadow = dropShadow; textObjs.push(tobj); if (this.scrollable) { diff --git a/src/gui/GuiTextListCtrl.hx b/src/gui/GuiTextListCtrl.hx index f99909d9..1eadf2ed 100644 --- a/src/gui/GuiTextListCtrl.hx +++ b/src/gui/GuiTextListCtrl.hx @@ -25,6 +25,7 @@ class GuiTextListCtrl extends GuiControl { public var selectedColor:Int = 0x206464; public var selectedFillColor:Int = 0xC8C8C8; + public var selectedFillColorAlpha:Float = 1.0; public var textColor:Int = 0; public var textYOffset:Int = 0; @@ -33,18 +34,32 @@ class GuiTextListCtrl extends GuiControl { public var scrollable:Bool = false; + var dropShadow:{ + dx:Float, + dy:Float, + color:Int, + alpha:Float + }; + var flow:Flow; - public function new(font:Font, texts:Array, textColor:Int = 0) { + public function new(font:Font, texts:Array, textColor:Int = 0, ?filter:{ + dx:Float, + dy:Float, + color:Int, + alpha:Float + } = null) { super(); this.font = font; this.texts = texts; this.textObjs = []; this.textColor = textColor; + this.dropShadow = filter; for (text in texts) { var tobj = new Text(font); tobj.text = text; tobj.textColor = textColor; + tobj.dropShadow = this.dropShadow; textObjs.push(tobj); } this.g = new Graphics(); @@ -60,6 +75,7 @@ class GuiTextListCtrl extends GuiControl { var tobj = new Text(font); tobj.text = text; tobj.textColor = textColor; + tobj.dropShadow = this.dropShadow; textObjs.push(tobj); if (this.scrollable && this.flow != null) { @@ -171,7 +187,7 @@ class GuiTextListCtrl extends GuiControl { var renderRect = this.getRenderRectangle(); var yStart = renderRect.position.y; var dy = mousePos.y - yStart; - var hoverIndex = Math.floor(dy / (font.size + 4)); + var hoverIndex = Math.floor((dy + this.scroll) / (font.size + 4)); if (hoverIndex >= this.texts.length) { hoverIndex = -1; } @@ -221,7 +237,7 @@ class GuiTextListCtrl extends GuiControl { function redrawSelectionRect(renderRect:Rect) { if (_prevSelected != -1) { g.clear(); - g.beginFill(selectedFillColor); + g.beginFill(selectedFillColor, selectedFillColorAlpha); // Check if we are between the top and bottom, render normally in that case var topY = 2 + (_prevSelected * (font.size + 4)) + g.y; diff --git a/src/gui/MPPlayMissionGui.hx b/src/gui/MPPlayMissionGui.hx index 16d1fab5..dc104f8d 100644 --- a/src/gui/MPPlayMissionGui.hx +++ b/src/gui/MPPlayMissionGui.hx @@ -45,7 +45,6 @@ class MPPlayMissionGui extends GuiImage { #end var playerListCtrl:GuiTextListCtrl; - var playerListCtrlDs:GuiTextListCtrl; public function new(isHost:Bool = true) { MissionList.buildMissionList(); @@ -336,13 +335,6 @@ class MPPlayMissionGui extends GuiImage { playersBox.extent = new Vector(305, 229); window.addChild(playersBox); - playerListCtrlDs = new GuiTextListCtrl(markerFelt18, [], 0x000000); - playerListCtrlDs.position = new Vector(-1, 25); - playerListCtrlDs.extent = new Vector(305, 203); - playerListCtrlDs.scrollable = true; - playerListCtrlDs.textYOffset = -6; - playersBox.addChild(playerListCtrlDs); - playerListCtrl = new GuiTextListCtrl(markerFelt18, [], 0xFFFFFF); playerListCtrl.position = new Vector(0, 26); playerListCtrl.extent = new Vector(305, 203); @@ -616,7 +608,6 @@ class MPPlayMissionGui extends GuiImage { } var playerListCompiled = playerListArr.map(player -> player.name); - playerListCtrlDs.setTexts(playerListCompiled); playerListCtrl.setTexts(playerListCompiled); // if (!showingCustoms) diff --git a/src/gui/MPPreGameDlg.hx b/src/gui/MPPreGameDlg.hx index 98b93b56..fe48d35c 100644 --- a/src/gui/MPPreGameDlg.hx +++ b/src/gui/MPPreGameDlg.hx @@ -1,5 +1,6 @@ package gui; +import net.NetCommands; import h2d.filter.DropShadow; import net.Net; import src.MarbleGame; @@ -7,6 +8,8 @@ import hxd.res.BitmapFont; import h3d.Vector; import src.ResourceLoader; import src.Settings; +import src.Console; +import net.MasterServerClient; class MPPreGameDlg extends GuiControl { public function new() { @@ -53,15 +56,32 @@ class MPPreGameDlg extends GuiControl { leaveBtn.vertSizing = Top; leaveBtn.position = new Vector(499, 388); leaveBtn.extent = new Vector(94, 45); + leaveBtn.pressedAction = (e) -> { + MarbleGame.instance.quitMission(true); + } dialogImg.addChild(leaveBtn); - var playBtn = new GuiButton(loadButtonImages("/data/ui/mp/pre/play")); + var playBtn = new GuiButton(loadButtonImagesExt("/data/ui/mp/pre/play")); playBtn.horizSizing = Right; playBtn.vertSizing = Top; playBtn.position = new Vector(406, 388); playBtn.extent = new Vector(94, 45); playBtn.buttonType = Toggle; - dialogImg.addChild(playBtn); + playBtn.disabled = true; + playBtn.pressedAction = (e) -> { + for (id => client in Net.clientIdMap) { + client.state = GAME; + } + + if (MarbleGame.instance.world != null) { + Console.log('All are ready, starting'); + MarbleGame.instance.world.allClientsReady(); + } + Net.serverInfo.state = "PLAYING"; + MasterServerClient.instance.sendServerInfo(Net.serverInfo); // notify the server of the playing state + } + if (Net.isHost) + dialogImg.addChild(playBtn); var readyBtn = new GuiButton(loadButtonImages("/data/ui/mp/pre/ready")); readyBtn.horizSizing = Right; @@ -144,7 +164,7 @@ class MPPreGameDlg extends GuiControl { playerTitle.text.textColor = 0xDDDDEE; playerTitle.position = new Vector(60, 263); playerTitle.extent = new Vector(525, 14); - playerTitle.text.text = "Player Status"; + playerTitle.text.text = "Player Status"; playerTitle.text.dropShadow = { dx: 1, dy: 1, @@ -161,40 +181,101 @@ class MPPreGameDlg extends GuiControl { // playerList.maxScrollY = 394 * Settings.uiScale; dialogImg.addChild(playerListContainer); - var playerListLeftShadow = new GuiTextListCtrl(markerFelt18, [ - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName - ], 0); - playerListLeftShadow.horizSizing = Width; - playerListLeftShadow.position = new Vector(0, 0); - playerListLeftShadow.extent = new Vector(525, 99); - playerListLeftShadow.scrollable = true; - playerListLeftShadow.textYOffset = -6; - playerListContainer.addChild(playerListLeftShadow); - - var playerListLeft = new GuiTextListCtrl(markerFelt18, [ - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName, - Settings.highscoreName - ], 0xFFFFFF); + var playerListLeft = new GuiTextListCtrl(markerFelt18, [], 0xFFFFFF, { + dx: 1, + dy: 1, + color: 0, + alpha: 1 + }); + playerListLeft.selectedColor = 0xFFFFFF; + playerListLeft.selectedFillColor = 0x6092E5; + playerListLeft.selectedFillColorAlpha = 0.0; playerListLeft.horizSizing = Width; playerListLeft.position = new Vector(-1, -1); - playerListLeft.extent = new Vector(525, 99); + playerListLeft.extent = new Vector(525, 2880); playerListLeft.scrollable = true; playerListLeft.textYOffset = -6; playerListContainer.addChild(playerListLeft); + var playerListRight = new GuiTextListCtrl(markerFelt18, [], 0xFFFFFF, { + dx: 1, + dy: 1, + color: 0, + alpha: 1 + }); + playerListRight.selectedColor = 0xFFFFFF; + playerListRight.selectedFillColor = 0x6092E5; + playerListRight.selectedFillColorAlpha = 0.0; + playerListRight.horizSizing = Width; + playerListRight.position = new Vector(420, -1); + playerListRight.extent = new Vector(300, 2880); + playerListRight.scrollable = true; + playerListRight.textYOffset = -6; + playerListContainer.addChild(playerListRight); playerListContainer.setScrollMax(playerListLeft.calculateFullHeight()); + + this.updatePlayerList = () -> { + var allReady = true; + var playerListArr = []; + if (Net.isHost) { + playerListArr.push({ + name: Settings.highscoreName, + ready: Net.lobbyHostReady + }); + } + if (Net.isClient) { + playerListArr.push({ + name: Settings.highscoreName, + ready: Net.lobbyClientReady + }); + } + if (Net.clientIdMap != null) { + for (c => v in Net.clientIdMap) { + playerListArr.push({ + name: v.name, + ready: v.lobbyReady + }); + } + } + for (p in playerListArr) { + if (!p.ready) { + allReady = false; + break; + } + } + + playBtn.disabled = !allReady; + + var playerListCompiled = playerListArr.map(player -> player.name); + var playerListStateCompiled = playerListArr.map(player -> player.ready ? "[Ready]" : "[Waiting]"); + playerListLeft.setTexts(playerListCompiled); + playerListRight.setTexts(playerListStateCompiled); + + // if (!showingCustoms) + // playerList.setTexts(playerListArr.map(player -> { + // return '${player.name}'; + // })); + } + + readyBtn.pressedAction = (e) -> { + NetCommands.toggleReadiness(Net.isHost ? 0 : Net.clientId); + updatePlayerList(); + } + + // Make everyone un-lobby ready (again!) + for (c in Net.clients) { + c.lobbyReady = false; + } + Net.lobbyClientReady = false; + Net.lobbyHostReady = false; + if (Net.isHost) { + var b = Net.sendPlayerInfosBytes(); + for (cc in Net.clients) { + cc.sendBytes(b); + } + } + updatePlayerList(); } + + public dynamic function updatePlayerList() {} } diff --git a/src/gui/PlayGui.hx b/src/gui/PlayGui.hx index cbbceb82..1ea21713 100644 --- a/src/gui/PlayGui.hx +++ b/src/gui/PlayGui.hx @@ -86,8 +86,6 @@ class PlayGui { var playerListContainer:GuiControl; var playerListCtrl:GuiMLTextListCtrl; var playerListScoresCtrl:GuiMLTextListCtrl; - var playerListShadowCtrl:GuiMLTextListCtrl; - var playerListScoresShadowCtrl:GuiMLTextListCtrl; var playerList:Array = []; var imageResources:Array> = []; @@ -113,12 +111,8 @@ class PlayGui { playerListContainer = null; playerListCtrl.dispose(); playerListCtrl = null; - playerListShadowCtrl.dispose(); - playerListShadowCtrl = null; playerListScoresCtrl.dispose(); playerListScoresCtrl = null; - playerListScoresShadowCtrl.dispose(); - playerListScoresShadowCtrl = null; } gemImageScene.dispose(); @@ -545,23 +539,12 @@ class PlayGui { return null; } - playerListShadowCtrl = new GuiMLTextListCtrl(bfont, [], imgLoader); - - playerListShadowCtrl.position = new Vector(34, 4); - playerListShadowCtrl.extent = new Vector(210, 271); - playerListShadowCtrl.scrollable = true; - playerListShadowCtrl.onSelectedFunc = (sel) -> {} - playerListContainer.addChild(playerListShadowCtrl); - - playerListScoresShadowCtrl = new GuiMLTextListCtrl(bfont, [], imgLoader); - - playerListScoresShadowCtrl.position = new Vector(234, 4); - playerListScoresShadowCtrl.extent = new Vector(210, 271); - playerListScoresShadowCtrl.scrollable = true; - playerListScoresShadowCtrl.onSelectedFunc = (sel) -> {} - playerListContainer.addChild(playerListScoresShadowCtrl); - - playerListCtrl = new GuiMLTextListCtrl(bfont, [], imgLoader); + playerListCtrl = new GuiMLTextListCtrl(bfont, [], imgLoader, { + dx: 1, + dy: 1, + color: 0, + alpha: 1 + }); playerListCtrl.position = new Vector(33, 3); playerListCtrl.extent = new Vector(210, 271); @@ -569,7 +552,12 @@ class PlayGui { playerListCtrl.onSelectedFunc = (sel) -> {} playerListContainer.addChild(playerListCtrl); - playerListScoresCtrl = new GuiMLTextListCtrl(bfont, [], imgLoader); + playerListScoresCtrl = new GuiMLTextListCtrl(bfont, [], imgLoader, { + dx: 1, + dy: 1, + color: 0, + alpha: 1 + }); playerListScoresCtrl.position = new Vector(233, 3); playerListScoresCtrl.extent = new Vector(210, 271); @@ -581,8 +569,6 @@ class PlayGui { public function redrawPlayerList() { var pl = []; var plScores = []; - var plShadow = []; - var plShadowScores = []; var col0 = "#CFB52B"; var col1 = "#CDCDCD"; var col2 = "#D19275"; @@ -602,13 +588,9 @@ class PlayGui { }; pl.push('${i + 1}. ${Util.rightPad(item.name, 25, 3)}'); plScores.push('${item.score}'); - plShadow.push('${i + 1}. ${Util.rightPad(item.name, 25, 3)}'); - plShadowScores.push('${item.score}'); } playerListCtrl.setTexts(pl); playerListScoresCtrl.setTexts(plScores); - playerListShadowCtrl.setTexts(plShadow); - playerListScoresShadowCtrl.setTexts(plShadowScores); } public function addPlayer(id:Int, name:String, us:Bool) { diff --git a/src/net/Net.hx b/src/net/Net.hx index b8382c94..f1a6718f 100644 --- a/src/net/Net.hx +++ b/src/net/Net.hx @@ -1,5 +1,6 @@ package net; +import gui.MPPreGameDlg; import net.NetPacket.ScoreboardPacket; import gui.MPPlayMissionGui; import gui.Canvas; @@ -537,6 +538,10 @@ class Net { if (MarbleGame.canvas.content is MPPlayMissionGui) { cast(MarbleGame.canvas.content, MPPlayMissionGui).updateLobbyNames(); } + + if (MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1] is MPPreGameDlg) { + cast(MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1], MPPreGameDlg).updatePlayerList(); + } } static function onConnectedToServer() { @@ -571,6 +576,10 @@ class Net { if (MarbleGame.canvas.content is MPPlayMissionGui) { cast(MarbleGame.canvas.content, MPPlayMissionGui).updateLobbyNames(); } + + if (MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1] is MPPreGameDlg) { + cast(MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1], MPPreGameDlg).updatePlayerList(); + } } static function onClientHandshakeComplete(conn:ClientConnection) { @@ -758,6 +767,9 @@ class Net { if (MarbleGame.canvas.content is MPPlayMissionGui) { cast(MarbleGame.canvas.content, MPPlayMissionGui).updateLobbyNames(); } + if (MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1] is MPPreGameDlg) { + cast(MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1], MPPreGameDlg).updatePlayerList(); + } case ScoreBoardInfo: var scoreboardPacket = new ScoreboardPacket(); diff --git a/src/net/NetCommands.hx b/src/net/NetCommands.hx index 7fda73d0..50401992 100644 --- a/src/net/NetCommands.hx +++ b/src/net/NetCommands.hx @@ -1,5 +1,6 @@ package net; +import gui.MPPreGameDlg; import gui.MPPlayMissionGui; import net.ClientConnection.NetPlatform; import gui.EndGameGui; @@ -99,6 +100,9 @@ class NetCommands { if (MarbleGame.canvas.content is MPPlayMissionGui) { cast(MarbleGame.canvas.content, MPPlayMissionGui).updateLobbyNames(); } + if (MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1] is MPPreGameDlg) { + cast(MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1], MPPreGameDlg).updatePlayerList(); + } var b = Net.sendPlayerInfosBytes(); for (cc in Net.clients) { cc.sendBytes(b); @@ -108,7 +112,9 @@ class NetCommands { // if (MultiplayerLevelSelectGui.custSelected) { // NetCommands.playCustomLevel(MultiplayerLevelSelectGui.custPath); // } else - NetCommands.playLevel(MPPlayMissionGui.currentCategoryStatic, MPPlayMissionGui.currentSelectionStatic); + if (MarbleGame.instance.world == null) { + NetCommands.playLevel(MPPlayMissionGui.currentCategoryStatic, MPPlayMissionGui.currentSelectionStatic); + } else {} } } } @@ -185,6 +191,11 @@ class NetCommands { @:privateAccess MarbleGame.instance.world.marble.serverTicks = ticks; } MarbleGame.instance.world.startTime = MarbleGame.instance.world.timeState.timeSinceLoad + 3.5 + 0.032; // 1 extra tick + + 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); + } } } @@ -230,6 +241,9 @@ class NetCommands { if (MarbleGame.canvas.content is MPPlayMissionGui) { cast(MarbleGame.canvas.content, MPPlayMissionGui).updateLobbyNames(); } + if (MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1] is MPPreGameDlg) { + cast(MarbleGame.canvas.children[MarbleGame.canvas.children.length - 1], MPPreGameDlg).updatePlayerList(); + } } @:rpc(server) public static function clientJoin(clientId:Int) {}