(1bd090dc7) Show the audio icon next to characters that are speaking in the single player crew menu

This commit is contained in:
Joonas Rikkonen
2019-04-23 15:38:06 +03:00
parent 544cc7ec08
commit 5f3e23f75f
6 changed files with 15 additions and 11 deletions

View File

@@ -654,6 +654,10 @@ namespace Barotrauma
}
if (string.IsNullOrEmpty(text)) { return; }
if (sender != null)
{
GameMain.GameSession.CrewManager.SetCharacterSpeaking(sender);
}
ChatBox.AddMessage(ChatMessage.Create(senderName, text, messageType, sender));
}
@@ -705,15 +709,19 @@ namespace Barotrauma
soundIconDisabled.ToolTip = TextManager.Get(mutedLocally ? "MutedLocally" : "MutedGlobally");
}
public void SetPlayerSpeaking(Client client)
public void SetClientSpeaking(Client client)
{
if (client?.Character == null) { return; }
if (client?.Character != null) { SetCharacterSpeaking(client.Character); }
}
var playerFrame = characterListBox.Content.FindChild(client.Character)?.FindChild(client.Character);
public void SetCharacterSpeaking(Character character)
{
var playerFrame = characterListBox.Content.FindChild(character)?.FindChild(character);
if (playerFrame == null) { return; }
var soundIcon = playerFrame.FindChild("soundicon");
soundIcon.Color = new Color(soundIcon.Color, 1.0f);
}
#endregion
/// <summary>

View File

@@ -631,7 +631,7 @@ namespace Barotrauma.Networking
}
else
{
GameMain.GameSession?.CrewManager?.SetPlayerSpeaking(myClient);
GameMain.GameSession?.CrewManager?.SetClientSpeaking(myClient);
}
}
}

View File

@@ -115,7 +115,7 @@ namespace Barotrauma.Networking
}
}
GameMain.NetLobbyScreen.SetPlayerSpeaking(client);
GameMain.GameSession?.CrewManager?.SetPlayerSpeaking(client);
GameMain.GameSession?.CrewManager?.SetClientSpeaking(client);
}
}

View File

@@ -132,9 +132,6 @@ namespace Barotrauma
{
GameMain.Instance.ShowEditorDisclaimer();
}
OpenDoors();
GameMain.Instance.OnResolutionChanged += OnResolutionChanged;
instance = this;
}
private void ResetVariables()

View File

@@ -279,7 +279,6 @@ namespace Barotrauma
movementSoundVolume = 0.0f;
}
}
}
if (waterAmbiences.Count > 1)
{

View File

@@ -2130,7 +2130,8 @@ namespace Barotrauma
public void Speak(string message, ChatMessageType? messageType = null, float delay = 0.0f, string identifier = "", float minDurationBetweenSimilar = 0.0f)
{
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) return;
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) { return; }
if (string.IsNullOrEmpty(message)) { return; }
//already sent a similar message a moment ago
if (!string.IsNullOrEmpty(identifier) && minDurationBetweenSimilar > 0.0f &&
@@ -2139,7 +2140,6 @@ namespace Barotrauma
{
return;
}
aiChatMessageQueue.Add(new AIChatMessage(message, messageType, identifier, delay));
}