Speech bubble icon next to the character when speaking in multiplayer, fixed clients sending every message through radio when wearing a headset
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 17 KiB |
@@ -113,8 +113,7 @@ namespace Barotrauma
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private CharacterInfo info;
|
||||
|
||||
@@ -157,6 +156,8 @@ namespace Barotrauma
|
||||
get { return inventory; }
|
||||
}
|
||||
|
||||
public float SpeechBubbleTimer;
|
||||
|
||||
private float lockHandsTimer;
|
||||
public bool LockHands
|
||||
{
|
||||
@@ -955,6 +956,8 @@ namespace Barotrauma
|
||||
{
|
||||
if (!Enabled) return;
|
||||
|
||||
SpeechBubbleTimer = Math.Max(0.0f, SpeechBubbleTimer - deltaTime);
|
||||
|
||||
obstructVisionAmount = Math.Max(obstructVisionAmount - deltaTime, 0.0f);
|
||||
|
||||
if (inventory!=null)
|
||||
@@ -1133,8 +1136,10 @@ namespace Barotrauma
|
||||
|
||||
GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health / maxHealth, Color.Lerp(Color.Red, Color.Green, health / maxHealth) * 0.8f);
|
||||
|
||||
//GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X - 2, (int)healthBarPos.Y - 2, 100 + 4, 15 + 4), Color.Black, false);
|
||||
//GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f * (health / maxHealth)), 15), Color.Red, true);
|
||||
if (SpeechBubbleTimer > 0.0f)
|
||||
{
|
||||
GUI.SpeechBubbleIcon.Draw(spriteBatch, pos - Vector2.UnitY * 100.0f, Color.White * Math.Min(SpeechBubbleTimer, 1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(AIController.AiState state)
|
||||
|
||||
@@ -52,6 +52,12 @@ namespace Barotrauma
|
||||
get { return submarineIcon; }
|
||||
}
|
||||
|
||||
public static Sprite SpeechBubbleIcon
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public static Sprite Arrow
|
||||
{
|
||||
get { return arrow; }
|
||||
@@ -94,6 +100,9 @@ namespace Barotrauma
|
||||
arrow = new Sprite("Content/UI/uiIcons.png", new Rectangle(80, 240, 16, 16), null);
|
||||
arrow.Origin = arrow.size / 2;
|
||||
|
||||
SpeechBubbleIcon = new Sprite("Content/UI/uiIcons.png", new Rectangle(0, 129, 65, 61), null);
|
||||
SpeechBubbleIcon.Origin = SpeechBubbleIcon.size / 2;
|
||||
|
||||
Style = new GUIStyle("Content/UI/style.xml");
|
||||
}
|
||||
|
||||
|
||||
@@ -977,7 +977,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
string command = ChatMessage.GetChatMessageCommand(message, out message).ToLower();
|
||||
|
||||
if (CanUseRadio(Character.Controlled)) type = ChatMessageType.Radio;
|
||||
if (command=="r" || command=="radio" && CanUseRadio(Character.Controlled)) type = ChatMessageType.Radio;
|
||||
}
|
||||
|
||||
var chatMessage = ChatMessage.Create(
|
||||
|
||||
@@ -243,10 +243,15 @@ namespace Barotrauma.Networking
|
||||
|
||||
string displayedText = message.Text;
|
||||
|
||||
if (message.Type == ChatMessageType.Default && myCharacter != null && message.Sender != null)
|
||||
if (message.Sender != null)
|
||||
{
|
||||
displayedText = message.ApplyDistanceEffect(myCharacter);
|
||||
if (string.IsNullOrWhiteSpace(displayedText)) return;
|
||||
if (message.Type == ChatMessageType.Default && myCharacter != null)
|
||||
{
|
||||
displayedText = message.ApplyDistanceEffect(myCharacter);
|
||||
if (string.IsNullOrWhiteSpace(displayedText)) return;
|
||||
}
|
||||
|
||||
message.Sender.SpeechBubbleTimer = Math.Max(message.Sender.SpeechBubbleTimer, 2.0f);
|
||||
}
|
||||
|
||||
GameMain.NetLobbyScreen.NewChatMessage(message);
|
||||
|
||||
Reference in New Issue
Block a user