Fixed lobby chat
This commit is contained in:
@@ -57,8 +57,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
TextWithSender = string.IsNullOrWhiteSpace(senderName) ? text : senderName + ": " + text;
|
||||
|
||||
LastID++;
|
||||
netStateID = LastID;
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
LastID++;
|
||||
netStateID = LastID;
|
||||
}
|
||||
}
|
||||
|
||||
public static ChatMessage Create(string senderName, string text, ChatMessageType type, Character sender)
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace Barotrauma.Networking
|
||||
private string saltedPw;
|
||||
|
||||
private UInt32 lastSentChatMsgID = 0; //last message this client has successfully sent
|
||||
private UInt32 lastQueueChatMsgID = 0; //last message added to the queue
|
||||
private List<ChatMessage> chatMsgQueue = new List<ChatMessage>();
|
||||
|
||||
public byte ID
|
||||
@@ -617,6 +618,9 @@ namespace Barotrauma.Networking
|
||||
gameStarted && myCharacter != null ? myCharacter.Name : name,
|
||||
message, (ChatMessageType)type, gameStarted ? myCharacter : null);
|
||||
|
||||
lastQueueChatMsgID++;
|
||||
chatMessage.netStateID = lastQueueChatMsgID;
|
||||
|
||||
chatMsgQueue.Add(chatMessage);
|
||||
}
|
||||
|
||||
|
||||
@@ -623,23 +623,23 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
outmsg.Write((UInt16)0);
|
||||
}
|
||||
outmsg.Write((GameMain.NetLobbyScreen.SubList.SelectedData as Submarine).Name);
|
||||
outmsg.Write((GameMain.NetLobbyScreen.SubList.SelectedData as Submarine).MD5Hash.ToString());
|
||||
outmsg.Write((GameMain.NetLobbyScreen.ShuttleList.SelectedData as Submarine).Name);
|
||||
outmsg.Write((GameMain.NetLobbyScreen.ShuttleList.SelectedData as Submarine).MD5Hash.ToString());
|
||||
|
||||
outmsg.WriteRangedInteger(0, 2, (int)TraitorsEnabled);
|
||||
|
||||
outmsg.WriteRangedInteger(0, Mission.MissionTypes.Count - 1, (GameMain.NetLobbyScreen.MissionTypeIndex));
|
||||
|
||||
outmsg.Write((byte)GameMain.NetLobbyScreen.ModeList.SelectedIndex);
|
||||
outmsg.Write(GameMain.NetLobbyScreen.LevelSeed);
|
||||
|
||||
outmsg.Write(AutoRestart);
|
||||
if (autoRestart)
|
||||
{
|
||||
outmsg.Write(AutoRestartTimer);
|
||||
}
|
||||
outmsg.Write((GameMain.NetLobbyScreen.SubList.SelectedData as Submarine).Name);
|
||||
outmsg.Write((GameMain.NetLobbyScreen.SubList.SelectedData as Submarine).MD5Hash.ToString());
|
||||
outmsg.Write((GameMain.NetLobbyScreen.ShuttleList.SelectedData as Submarine).Name);
|
||||
outmsg.Write((GameMain.NetLobbyScreen.ShuttleList.SelectedData as Submarine).MD5Hash.ToString());
|
||||
|
||||
outmsg.WriteRangedInteger(0, 2, (int)TraitorsEnabled);
|
||||
|
||||
outmsg.WriteRangedInteger(0, Mission.MissionTypes.Count - 1, (GameMain.NetLobbyScreen.MissionTypeIndex));
|
||||
|
||||
outmsg.Write((byte)GameMain.NetLobbyScreen.ModeList.SelectedIndex);
|
||||
outmsg.Write(GameMain.NetLobbyScreen.LevelSeed);
|
||||
|
||||
outmsg.Write(AutoRestart);
|
||||
if (autoRestart)
|
||||
{
|
||||
outmsg.Write(AutoRestartTimer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user