Voting UI fixes:
- The vote count texts are removed when voting is disabled. - Server sends vote status to joining clients (-> clients see the number of votes immediately, not after someone votes something). - Server refreshes vote count texts when a client disconnects.
This commit is contained in:
@@ -19,11 +19,12 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
UpdateVoteTexts(GameMain.Server.ConnectedClients, VoteType.Sub);
|
||||
UpdateVoteTexts(value ? GameMain.Server.ConnectedClients : null, VoteType.Sub);
|
||||
GameMain.Server.UpdateVoteStatus();
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateVoteTexts(null, VoteType.Sub);
|
||||
GameMain.NetLobbyScreen.SubList.Deselect();
|
||||
}
|
||||
}
|
||||
@@ -39,11 +40,12 @@ namespace Barotrauma
|
||||
GameMain.NetLobbyScreen.InfoFrame.FindChild("modevotes", true).Visible = value;
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
UpdateVoteTexts(GameMain.Server.ConnectedClients, VoteType.Mode);
|
||||
UpdateVoteTexts(value ? GameMain.Server.ConnectedClients : null, VoteType.Mode);
|
||||
GameMain.Server.UpdateVoteStatus();
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateVoteTexts(null, VoteType.Mode);
|
||||
GameMain.NetLobbyScreen.ModeList.Deselect();
|
||||
}
|
||||
}
|
||||
@@ -60,10 +62,13 @@ namespace Barotrauma
|
||||
if (voteText != null) comp.RemoveChild(voteText);
|
||||
}
|
||||
|
||||
List<Pair<object, int>> voteList = GetVoteList(voteType, clients);
|
||||
foreach (Pair<object, int> votable in voteList)
|
||||
if (clients != null)
|
||||
{
|
||||
SetVoteText(listBox, votable.First, votable.Second);
|
||||
List<Pair<object, int>> voteList = GetVoteList(voteType, clients);
|
||||
foreach (Pair<object, int> votable in voteList)
|
||||
{
|
||||
SetVoteText(listBox, votable.First, votable.Second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,10 +132,7 @@ namespace Barotrauma
|
||||
AllowSubVoting = inc.ReadBoolean();
|
||||
if (allowSubVoting)
|
||||
{
|
||||
foreach (Submarine sub in Submarine.SavedSubmarines)
|
||||
{
|
||||
SetVoteText(GameMain.NetLobbyScreen.SubList, sub, 0);
|
||||
}
|
||||
UpdateVoteTexts(null, VoteType.Sub);
|
||||
int votableCount = inc.ReadByte();
|
||||
for (int i = 0; i < votableCount; i++)
|
||||
{
|
||||
@@ -143,6 +145,7 @@ namespace Barotrauma
|
||||
AllowModeVoting = inc.ReadBoolean();
|
||||
if (allowModeVoting)
|
||||
{
|
||||
UpdateVoteTexts(null, VoteType.Mode);
|
||||
int votableCount = inc.ReadByte();
|
||||
for (int i = 0; i < votableCount; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user