System messages should be yellow to distinguish them from normal
This commit is contained in:
@@ -465,6 +465,9 @@ namespace OpenRA
|
||||
Log.Write("nat", e.ToString());
|
||||
}
|
||||
|
||||
chatMessageColor = ChromeMetrics.Get<Color>("ChatMessageColor");
|
||||
systemMessageColor = ChromeMetrics.Get<Color>("SystemMessageColor");
|
||||
|
||||
ModData.LoadScreen.StartGame(args);
|
||||
}
|
||||
|
||||
@@ -524,6 +527,8 @@ namespace OpenRA
|
||||
// Note: These delayed actions should only be used by widgets or disposing objects
|
||||
// - things that depend on a particular world should be queuing them on the world actor.
|
||||
static volatile ActionQueue delayedActions = new ActionQueue();
|
||||
static Color systemMessageColor;
|
||||
static Color chatMessageColor;
|
||||
public static void RunAfterTick(Action a) { delayedActions.Add(a, RunTime); }
|
||||
public static void RunAfterDelay(int delayMilliseconds, Action a) { delayedActions.Add(a, RunTime + delayMilliseconds); }
|
||||
|
||||
@@ -836,14 +841,19 @@ namespace OpenRA
|
||||
state = RunStatus.Success;
|
||||
}
|
||||
|
||||
public static void AddChatLine(Color color, string name, string text)
|
||||
public static void AddSystemLine(string name, string text)
|
||||
{
|
||||
OrderManager.AddChatLine(color, name, text);
|
||||
OrderManager.AddChatLine(name, systemMessageColor, text, systemMessageColor);
|
||||
}
|
||||
|
||||
public static void AddChatLine(string name, Color nameColor, string text)
|
||||
{
|
||||
OrderManager.AddChatLine(name, nameColor, text, chatMessageColor);
|
||||
}
|
||||
|
||||
public static void Debug(string s, params object[] args)
|
||||
{
|
||||
AddChatLine(Color.White, "Debug", string.Format(s, args));
|
||||
AddSystemLine("Debug", string.Format(s, args));
|
||||
}
|
||||
|
||||
public static void Disconnect()
|
||||
|
||||
@@ -105,10 +105,10 @@ namespace OpenRA.Network
|
||||
localOrders.Add(order);
|
||||
}
|
||||
|
||||
public Action<Color, string, string> AddChatLine = (c, n, s) => { };
|
||||
void CacheChatLine(Color color, string name, string text)
|
||||
public Action<string, Color, string, Color> AddChatLine = (n, nc, s, tc) => { };
|
||||
void CacheChatLine(string name, Color nameColor, string text, Color textColor)
|
||||
{
|
||||
chatCache.Add(new ChatLine(color, name, text));
|
||||
chatCache.Add(new ChatLine(name, nameColor, text, textColor));
|
||||
}
|
||||
|
||||
public void TickImmediate()
|
||||
@@ -219,12 +219,14 @@ namespace OpenRA.Network
|
||||
public readonly Color Color;
|
||||
public readonly string Name;
|
||||
public readonly string Text;
|
||||
public readonly Color TextColor;
|
||||
|
||||
public ChatLine(Color c, string n, string t)
|
||||
public ChatLine(string name, Color nameColor, string text, Color textColor)
|
||||
{
|
||||
Color = c;
|
||||
Name = n;
|
||||
Text = t;
|
||||
Color = nameColor;
|
||||
Name = name;
|
||||
Text = text;
|
||||
TextColor = textColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Network
|
||||
{
|
||||
// Server message
|
||||
case "Message":
|
||||
Game.AddChatLine(Color.White, ServerChatName, order.TargetString);
|
||||
Game.AddSystemLine(ServerChatName, order.TargetString);
|
||||
break;
|
||||
|
||||
// Reports that the target player disconnected
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Network
|
||||
if (orderManager.LocalClient != null && client != orderManager.LocalClient && client.Team > 0 && client.Team == orderManager.LocalClient.Team)
|
||||
suffix += " (Ally)";
|
||||
|
||||
Game.AddChatLine(client.Color, client.Name + suffix, message);
|
||||
Game.AddChatLine(client.Name + suffix, client.Color, message);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace OpenRA.Network
|
||||
{
|
||||
var prefix = order.ExtraData == uint.MaxValue ? "[Spectators] " : "[Team] ";
|
||||
if (orderManager.LocalClient != null && client.Team == orderManager.LocalClient.Team)
|
||||
Game.AddChatLine(client.Color, prefix + client.Name, message);
|
||||
Game.AddChatLine(prefix + client.Name, client.Color, message);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Network
|
||||
{
|
||||
// Validate before adding the line
|
||||
if (client.IsObserver || (player != null && player.WinState != WinState.Undefined))
|
||||
Game.AddChatLine(client.Color, "[Spectators] " + client.Name, message);
|
||||
Game.AddChatLine("[Spectators] " + client.Name, client.Color, message);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ namespace OpenRA.Network
|
||||
&& world.LocalPlayer.WinState == WinState.Undefined;
|
||||
|
||||
if (valid && (isSameTeam || world.IsReplay))
|
||||
Game.AddChatLine(client.Color, "[Team" + (world.IsReplay ? " " + order.ExtraData : "") + "] " + client.Name, message);
|
||||
Game.AddChatLine("[Team" + (world.IsReplay ? " " + order.ExtraData : "") + "] " + client.Name, client.Color, message);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ namespace OpenRA.Network
|
||||
FieldLoader.GetValue<int>("SaveSyncFrame", saveSyncFrame.Value.Value);
|
||||
}
|
||||
else
|
||||
Game.AddChatLine(Color.White, ServerChatName, "The game has started.");
|
||||
Game.AddSystemLine(ServerChatName, "The game has started.");
|
||||
|
||||
Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map, WorldType.Regular);
|
||||
break;
|
||||
@@ -157,7 +157,7 @@ namespace OpenRA.Network
|
||||
|
||||
case "GameSaved":
|
||||
if (!orderManager.World.IsReplay)
|
||||
Game.AddChatLine(Color.White, ServerChatName, "Game saved");
|
||||
Game.AddSystemLine(ServerChatName, "Game saved");
|
||||
|
||||
foreach (var nsr in orderManager.World.WorldActor.TraitsImplementing<INotifyGameSaved>())
|
||||
nsr.GameSaved(orderManager.World);
|
||||
@@ -177,7 +177,7 @@ namespace OpenRA.Network
|
||||
if (orderManager.World.Paused != pause && world != null && world.LobbyInfo.NonBotClients.Count() > 1)
|
||||
{
|
||||
var pausetext = "The game is {0} by {1}".F(pause ? "paused" : "un-paused", client.Name);
|
||||
Game.AddChatLine(Color.White, ServerChatName, pausetext);
|
||||
Game.AddSystemLine(ServerChatName, pausetext);
|
||||
}
|
||||
|
||||
orderManager.World.Paused = pause;
|
||||
|
||||
Reference in New Issue
Block a user