Add lobby sounds for leave, join and option change
This commit is contained in:
committed by
Gustas
parent
d217ab39c2
commit
a1efb28f0b
@@ -20,6 +20,12 @@ namespace OpenRA.Network
|
||||
{
|
||||
public const int ChatMessageMaxLength = 2500;
|
||||
|
||||
[TranslationReference("player")]
|
||||
const string Joined = "notification-joined";
|
||||
|
||||
[TranslationReference("player")]
|
||||
const string Left = "notification-lobby-disconnected";
|
||||
|
||||
static Player FindPlayerByClient(this World world, Session.Client c)
|
||||
{
|
||||
return world.Players.FirstOrDefault(p => p.ClientIndex == c.Index && p.PlayerReference.Playable);
|
||||
@@ -44,7 +50,12 @@ namespace OpenRA.Network
|
||||
foreach (var node in yaml)
|
||||
{
|
||||
var localizedMessage = new LocalizedMessage(node.Value);
|
||||
TextNotificationsManager.AddSystemLine(localizedMessage.TranslatedText);
|
||||
if (localizedMessage.Key == Joined)
|
||||
TextNotificationsManager.AddPlayerJoinedLine(localizedMessage.TranslatedText);
|
||||
else if (localizedMessage.Key == Left)
|
||||
TextNotificationsManager.AddPlayerLeftLine(localizedMessage.TranslatedText);
|
||||
else
|
||||
TextNotificationsManager.AddSystemLine(localizedMessage.TranslatedText);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -14,7 +14,7 @@ using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
public enum TextNotificationPool { System, Chat, Mission, Feedback, Transients }
|
||||
public enum TextNotificationPool { System, Join, Leave, Chat, Mission, Feedback, Transients }
|
||||
|
||||
public class TextNotification : IEquatable<TextNotification>
|
||||
{
|
||||
|
||||
@@ -51,6 +51,16 @@ namespace OpenRA
|
||||
AddTextNotification(TextNotificationPool.Mission, SystemClientId, prefix, text, prefixColor);
|
||||
}
|
||||
|
||||
public static void AddPlayerJoinedLine(string text)
|
||||
{
|
||||
AddTextNotification(TextNotificationPool.Join, SystemClientId, SystemMessageLabel, text);
|
||||
}
|
||||
|
||||
public static void AddPlayerLeftLine(string text)
|
||||
{
|
||||
AddTextNotification(TextNotificationPool.Leave, SystemClientId, SystemMessageLabel, text);
|
||||
}
|
||||
|
||||
public static void AddSystemLine(string text)
|
||||
{
|
||||
AddSystemLine(SystemMessageLabel, text);
|
||||
@@ -86,11 +96,15 @@ namespace OpenRA
|
||||
{
|
||||
var filters = Game.Settings.Game.TextNotificationPoolFilters;
|
||||
|
||||
return pool == TextNotificationPool.Chat ||
|
||||
pool == TextNotificationPool.System ||
|
||||
pool == TextNotificationPool.Mission ||
|
||||
(pool == TextNotificationPool.Transients && filters.HasFlag(TextNotificationPoolFilters.Transients)) ||
|
||||
(pool == TextNotificationPool.Feedback && filters.HasFlag(TextNotificationPoolFilters.Feedback));
|
||||
switch (pool)
|
||||
{
|
||||
case TextNotificationPool.Transients:
|
||||
return filters.HasFlag(TextNotificationPoolFilters.Transients);
|
||||
case TextNotificationPool.Feedback:
|
||||
return filters.HasFlag(TextNotificationPoolFilters.Feedback);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Clear()
|
||||
|
||||
Reference in New Issue
Block a user