Build 0.18.5.0
This commit is contained in:
@@ -10,14 +10,15 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
msg.Write((byte)ClientNetObject.CHAT_MESSAGE);
|
||||
msg.Write(NetStateID);
|
||||
msg.Write((byte)Type);
|
||||
msg.WriteRangedInteger((int)Type, 0, Enum.GetValues(typeof(ChatMessageType)).Length - 1);
|
||||
msg.WriteRangedInteger((int)ChatMode, 0, Enum.GetValues(typeof(ChatMode)).Length - 1);
|
||||
msg.Write(Text);
|
||||
}
|
||||
|
||||
public static void ClientRead(IReadMessage msg)
|
||||
{
|
||||
UInt16 id = msg.ReadUInt16();
|
||||
ChatMessageType type = (ChatMessageType)msg.ReadByte();
|
||||
ChatMessageType type = (ChatMessageType)msg.ReadRangedInteger(0, Enum.GetValues(typeof(ChatMessageType)).Length - 1);
|
||||
PlayerConnectionChangeType changeType = PlayerConnectionChangeType.None;
|
||||
string txt = "";
|
||||
string styleSetting = string.Empty;
|
||||
|
||||
@@ -1831,7 +1831,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
AddChatMessage($"ServerMessage.HowToCommunicate~[chatbutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Chat)}~[radiobutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.RadioChat)}", ChatMessageType.Server);
|
||||
// TODO: Re-enable the server message once it's been edited and translated
|
||||
//AddChatMessage($"ServerMessage.HowToCommunicate~[chatbutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Chat)}~[radiobutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.RadioChat)}", ChatMessageType.Server);
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
@@ -2503,6 +2504,7 @@ namespace Barotrauma.Networking
|
||||
message,
|
||||
type,
|
||||
gameStarted && myCharacter != null ? myCharacter : null);
|
||||
chatMessage.ChatMode = GameMain.ActiveChatMode;
|
||||
|
||||
lastQueueChatMsgID++;
|
||||
chatMessage.NetStateID = lastQueueChatMsgID;
|
||||
@@ -2788,19 +2790,21 @@ namespace Barotrauma.Networking
|
||||
GameMain.GameSession = null;
|
||||
}
|
||||
|
||||
public void SendCharacterInfo()
|
||||
public void SendCharacterInfo(string newName = null)
|
||||
{
|
||||
IWriteMessage msg = new WriteOnlyMessage();
|
||||
msg.Write((byte)ClientPacketHeader.UPDATE_CHARACTERINFO);
|
||||
WriteCharacterInfo(msg);
|
||||
WriteCharacterInfo(msg, newName);
|
||||
msg.Write((byte)ServerNetObject.END_OF_MESSAGE);
|
||||
clientPeer?.Send(msg, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
public void WriteCharacterInfo(IWriteMessage msg)
|
||||
public void WriteCharacterInfo(IWriteMessage msg, string newName = null)
|
||||
{
|
||||
msg.Write(characterInfo == null);
|
||||
if (characterInfo == null) return;
|
||||
if (characterInfo == null) { return; }
|
||||
|
||||
msg.Write(newName ?? string.Empty);
|
||||
|
||||
msg.Write((byte)characterInfo.Head.Preset.TagSet.Count);
|
||||
foreach (Identifier tag in characterInfo.Head.Preset.TagSet)
|
||||
@@ -3284,10 +3288,8 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (GUI.KeyboardDispatcher.Subscriber == null)
|
||||
{
|
||||
bool chatKeyHit = PlayerInput.KeyHit(InputType.Chat);
|
||||
bool radioKeyHit = PlayerInput.KeyHit(InputType.RadioChat) && (Character.Controlled == null || Character.Controlled.SpeechImpediment < 100);
|
||||
|
||||
if (chatKeyHit || radioKeyHit)
|
||||
var chatKeyStates = ChatBox.ChatKeyStates.GetChatKeyStates();
|
||||
if (chatKeyStates.AnyHit)
|
||||
{
|
||||
if (msgBox.Selected)
|
||||
{
|
||||
@@ -3298,34 +3300,8 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (Screen.Selected == GameMain.GameScreen)
|
||||
{
|
||||
if (chatKeyHit)
|
||||
{
|
||||
msgBox.AddToGUIUpdateList();
|
||||
ChatBox.GUIFrame.Flash(Color.DarkGreen, 0.5f);
|
||||
if (!chatBox.ToggleOpen)
|
||||
{
|
||||
ChatBox.CloseAfterMessageSent = !ChatBox.ToggleOpen;
|
||||
ChatBox.ToggleOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (radioKeyHit)
|
||||
{
|
||||
msgBox.AddToGUIUpdateList();
|
||||
ChatBox.GUIFrame.Flash(Color.YellowGreen, 0.5f);
|
||||
if (!chatBox.ToggleOpen)
|
||||
{
|
||||
ChatBox.CloseAfterMessageSent = !ChatBox.ToggleOpen;
|
||||
ChatBox.ToggleOpen = true;
|
||||
}
|
||||
|
||||
if (!msgBox.Text.StartsWith(ChatBox.RadioChatString))
|
||||
{
|
||||
msgBox.Text = ChatBox.RadioChatString;
|
||||
}
|
||||
}
|
||||
ChatBox.ApplySelectionInputs(msgBox, false, chatKeyStates);
|
||||
}
|
||||
|
||||
msgBox.Select(msgBox.Text.Length);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Barotrauma.Networking
|
||||
using System;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
partial class OrderChatMessage : ChatMessage
|
||||
{
|
||||
@@ -6,7 +8,7 @@
|
||||
{
|
||||
msg.Write((byte)ClientNetObject.CHAT_MESSAGE);
|
||||
msg.Write(NetStateID);
|
||||
msg.Write((byte)ChatMessageType.Order);
|
||||
msg.WriteRangedInteger((int)ChatMessageType.Order, 0, Enum.GetValues(typeof(ChatMessageType)).Length - 1);
|
||||
WriteOrder(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,20 +227,10 @@ namespace Barotrauma.Networking
|
||||
bool allowEnqueue = overrideSound != null;
|
||||
if (GameMain.WindowActive && SettingsMenu.Instance is null)
|
||||
{
|
||||
ForceLocal = captureTimer > 0 ? ForceLocal : GameSettings.CurrentConfig.Audio.UseLocalVoiceByDefault;
|
||||
bool pttDown = false;
|
||||
if ((PlayerInput.KeyDown(InputType.Voice) || PlayerInput.KeyDown(InputType.LocalVoice)) &&
|
||||
GUI.KeyboardDispatcher.Subscriber == null)
|
||||
bool pttDown = PlayerInput.KeyDown(InputType.Voice) && GUI.KeyboardDispatcher.Subscriber == null;
|
||||
if (pttDown || captureTimer <= 0)
|
||||
{
|
||||
pttDown = true;
|
||||
if (PlayerInput.KeyDown(InputType.LocalVoice))
|
||||
{
|
||||
ForceLocal = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ForceLocal = false;
|
||||
}
|
||||
ForceLocal = GameMain.ActiveChatMode == ChatMode.Local;
|
||||
}
|
||||
if (GameSettings.CurrentConfig.Audio.VoiceSetting == VoiceMode.Activity)
|
||||
{
|
||||
@@ -257,7 +247,6 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allowEnqueue || captureTimer > 0)
|
||||
{
|
||||
LastEnqueueAudio = DateTime.Now;
|
||||
|
||||
Reference in New Issue
Block a user