Bug Fixes

This commit is contained in:
Ilya 2021-03-06 16:56:56 +03:00
parent 7e6669c01f
commit 7ccd65dc68
2 changed files with 12 additions and 1 deletions

View File

@ -277,10 +277,12 @@ namespace MafiaClient
this.FindControl<ListBox>("GameDaySelect").IsEnabled = voting;
if (players.Count != 0)
{
this.FindControl<ListBox>("GameDaySelect").Items = null;
List<ListBoxItem> items = new List<ListBoxItem>();
foreach (Player player in players)
{
items.Add(new ListBoxItem {Content = player.Id + ") " + player.Name});
Console.WriteLine(player.Id + ") " + player.Name);
}
this.FindControl<ListBox>("GameDaySelect").Items = items;
}

View File

@ -68,7 +68,7 @@ namespace MafiaClient
list.Add(message);
listBoxes.Items = list;
}
MainWindow.Instance.FindControl<ScrollViewer>("QueueChatViewer").ScrollToEnd();
MainWindow.Instance.FindControl<ScrollViewer>(chatName).ScrollToEnd();
}
public void SendMessage(ChatType chatType, string text)
@ -76,6 +76,13 @@ namespace MafiaClient
_socket.Send(PacketConverter.ToBytes(new MessageSendPacket(chatType, text)));
}
public void ClearChats()
{
MainWindow.Instance.FindControl<ItemsRepeater>("QueueChat").Items = null;
MainWindow.Instance.FindControl<ItemsRepeater>("GameVotingActiveChat").Items = null;
MainWindow.Instance.FindControl<ItemsRepeater>("GameDayChat").Items = null;
}
public void Disconnect()
{
_connected = false;
@ -224,6 +231,7 @@ namespace MafiaClient
break;
case PacketType.GameStartPacket:
List<Player> players = ((GameStartPacket) packet).Players;
ClearChats();
switch (((GameStartPacket) packet).Role)
{
case Role.Citizen:
@ -299,6 +307,7 @@ namespace MafiaClient
: "Дон";
List<ListBoxItem> items = new List<ListBoxItem>();
MainWindow.Instance.ShowVotingActive("Ты " + rol + ", выбери кого убить!");
MainWindow.Instance.FindControl<ListBox>("GameVotingActiveSelect").Items = null;
foreach (Player player in players)
{
ListBoxItem item = new ListBoxItem