diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs index 7fe1028ac..9db7409d8 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs @@ -188,6 +188,7 @@ namespace Barotrauma controlled = this; IsRemotePlayer = false; + GameMain.Client.HasSpawned = true; GameMain.Client.Character = this; GameMain.LightManager.LosEnabled = true; } @@ -286,6 +287,7 @@ namespace Barotrauma if (GameMain.Client.ID == ownerId) { + GameMain.Client.HasSpawned = true; GameMain.Client.Character = character; Controlled = character; diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs index 5e097dffd..e58636d35 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs @@ -44,6 +44,9 @@ namespace Barotrauma.Networking private FileReceiver fileReceiver; + //has the client been given a character to control this round + public bool HasSpawned; + public byte ID { get { return myID; } @@ -480,7 +483,7 @@ namespace Barotrauma.Networking if (gameStarted && Screen.Selected == GameMain.GameScreen) { - endVoteTickBox.Visible = Voting.AllowEndVoting && myCharacter != null; + endVoteTickBox.Visible = Voting.AllowEndVoting && HasSpawned; if (respawnManager != null) { @@ -666,6 +669,7 @@ namespace Barotrauma.Networking private IEnumerable StartGame(NetIncomingMessage inc) { if (Character != null) Character.Remove(); + HasSpawned = false; GameMain.LightManager.LightingEnabled = true; @@ -1281,6 +1285,23 @@ namespace Barotrauma.Networking { base.Draw(spriteBatch); + if (Screen.Selected == GameMain.GameScreen && !GUI.DisableHUD) + { + if (EndVoteCount > 0) + { + if (!HasSpawned) + { + GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 180.0f, 40), + "Votes to end the round (y/n): " + EndVoteCount + "/" + (EndVoteMax - EndVoteCount), Color.White, null, 0, GUI.SmallFont); + } + else + { + GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 140.0f, 40), + "Votes (y/n): " + EndVoteCount + "/" + (EndVoteMax - EndVoteCount), Color.White, null, 0, GUI.SmallFont); + } + } + } + if (fileReceiver != null && fileReceiver.ActiveTransfers.Count > 0) { Vector2 pos = new Vector2(GameMain.NetLobbyScreen.InfoFrame.Rect.X, GameMain.GraphicsHeight - 35); @@ -1564,14 +1585,13 @@ namespace Barotrauma.Networking { if (!gameStarted) return false; - if (!Voting.AllowEndVoting || myCharacter==null) + if (!Voting.AllowEndVoting || !HasSpawned) { tickBox.Visible = false; return false; } Vote(VoteType.EndRound, tickBox.Selected); - return false; } } diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameServer.cs index f146214e8..87919d6b8 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameServer.cs @@ -63,6 +63,15 @@ namespace Barotrauma.Networking log.LogFrame.Draw(spriteBatch); } + if (Screen.Selected == GameMain.GameScreen && !GUI.DisableHUD) + { + if (EndVoteCount > 0) + { + GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 180.0f, 40), + "Votes to end the round (y/n): " + EndVoteCount + "/" + (EndVoteMax - EndVoteCount), Color.White, null, 0, GUI.SmallFont); + } + } + if (!ShowNetStats) return; GUI.Font.DrawString(spriteBatch, "Unique Events: " + entityEventManager.UniqueEvents.Count, new Vector2(10, 50), Color.White); diff --git a/Barotrauma/BarotraumaClient/Source/Networking/NetworkMember.cs b/Barotrauma/BarotraumaClient/Source/Networking/NetworkMember.cs index cfc4b7f22..1bdd6110b 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/NetworkMember.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/NetworkMember.cs @@ -119,20 +119,6 @@ namespace Barotrauma.Networking inGameHUD.Draw(spriteBatch); - if (EndVoteCount > 0) - { - if (GameMain.NetworkMember.myCharacter == null) - { - GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 180.0f, 40), - "Votes to end the round (y/n): " + EndVoteCount + "/" + (EndVoteMax - EndVoteCount), Color.White, null, 0, GUI.SmallFont); - } - else - { - GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 140.0f, 40), - "Votes (y/n): " + EndVoteCount + "/" + (EndVoteMax - EndVoteCount), Color.White, null, 0, GUI.SmallFont); - } - } - if (respawnManager != null) { string respawnInfo = "";