Reduce duplication of "Battlefield Control" chat line label
This commit is contained in:
committed by
Paul Chote
parent
3e2022a3dd
commit
1dd1786469
@@ -858,6 +858,11 @@ namespace OpenRA
|
|||||||
state = RunStatus.Success;
|
state = RunStatus.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AddSystemLine(string text)
|
||||||
|
{
|
||||||
|
AddSystemLine("Battlefield Control", text);
|
||||||
|
}
|
||||||
|
|
||||||
public static void AddSystemLine(string name, string text)
|
public static void AddSystemLine(string name, string text)
|
||||||
{
|
{
|
||||||
OrderManager.AddChatLine(name, systemMessageColor, text, systemMessageColor);
|
OrderManager.AddChatLine(name, systemMessageColor, text, systemMessageColor);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ namespace OpenRA.Network
|
|||||||
public static class UnitOrders
|
public static class UnitOrders
|
||||||
{
|
{
|
||||||
public const int ChatMessageMaxLength = 2500;
|
public const int ChatMessageMaxLength = 2500;
|
||||||
const string ServerChatName = "Battlefield Control";
|
|
||||||
|
|
||||||
static Player FindPlayerByClient(this World world, Session.Client c)
|
static Player FindPlayerByClient(this World world, Session.Client c)
|
||||||
{
|
{
|
||||||
@@ -41,7 +40,7 @@ namespace OpenRA.Network
|
|||||||
{
|
{
|
||||||
// Server message
|
// Server message
|
||||||
case "Message":
|
case "Message":
|
||||||
Game.AddSystemLine(ServerChatName, order.TargetString);
|
Game.AddSystemLine(order.TargetString);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Reports that the target player disconnected
|
// Reports that the target player disconnected
|
||||||
@@ -137,7 +136,7 @@ namespace OpenRA.Network
|
|||||||
FieldLoader.GetValue<int>("SaveSyncFrame", saveSyncFrame.Value.Value);
|
FieldLoader.GetValue<int>("SaveSyncFrame", saveSyncFrame.Value.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Game.AddSystemLine(ServerChatName, "The game has started.");
|
Game.AddSystemLine("The game has started.");
|
||||||
|
|
||||||
Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map, WorldType.Regular);
|
Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map, WorldType.Regular);
|
||||||
break;
|
break;
|
||||||
@@ -156,7 +155,7 @@ namespace OpenRA.Network
|
|||||||
|
|
||||||
case "GameSaved":
|
case "GameSaved":
|
||||||
if (!orderManager.World.IsReplay)
|
if (!orderManager.World.IsReplay)
|
||||||
Game.AddSystemLine(ServerChatName, "Game saved");
|
Game.AddSystemLine("Game saved");
|
||||||
|
|
||||||
foreach (var nsr in orderManager.World.WorldActor.TraitsImplementing<INotifyGameSaved>())
|
foreach (var nsr in orderManager.World.WorldActor.TraitsImplementing<INotifyGameSaved>())
|
||||||
nsr.GameSaved(orderManager.World);
|
nsr.GameSaved(orderManager.World);
|
||||||
@@ -176,7 +175,7 @@ namespace OpenRA.Network
|
|||||||
if (orderManager.World.Paused != pause && world != null && world.LobbyInfo.NonBotClients.Count() > 1)
|
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);
|
var pausetext = "The game is {0} by {1}".F(pause ? "paused" : "un-paused", client.Name);
|
||||||
Game.AddSystemLine(ServerChatName, pausetext);
|
Game.AddSystemLine(pausetext);
|
||||||
}
|
}
|
||||||
|
|
||||||
orderManager.World.Paused = pause;
|
orderManager.World.Paused = pause;
|
||||||
|
|||||||
@@ -198,12 +198,15 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
Game.AddChatLine(prefix, c, text);
|
Game.AddChatLine(prefix, c, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Display a system message to the player.")]
|
[Desc("Display a system message to the player. If 'prefix' is nil the default system prefix is used.")]
|
||||||
public void DisplaySystemMessage(string text, string prefix = "Mission")
|
public void DisplaySystemMessage(string text, string prefix = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(text))
|
if (string.IsNullOrEmpty(text))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(prefix))
|
||||||
|
Game.AddSystemLine(text);
|
||||||
|
|
||||||
Game.AddSystemLine(prefix, text);
|
Game.AddSystemLine(prefix, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (info.SuppressNotifications)
|
if (info.SuppressNotifications)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Game.AddSystemLine("Battlefield Control", player.PlayerName + " is defeated.");
|
Game.AddSystemLine(player.PlayerName + " is defeated.");
|
||||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||||
{
|
{
|
||||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||||
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (info.SuppressNotifications)
|
if (info.SuppressNotifications)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Game.AddSystemLine("Battlefield Control", player.PlayerName + " is victorious.");
|
Game.AddSystemLine(player.PlayerName + " is victorious.");
|
||||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||||
{
|
{
|
||||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (info.SuppressNotifications)
|
if (info.SuppressNotifications)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Game.AddSystemLine("Battlefield Control", player.PlayerName + " is defeated.");
|
Game.AddSystemLine(player.PlayerName + " is defeated.");
|
||||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||||
{
|
{
|
||||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||||
@@ -154,7 +154,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (info.SuppressNotifications)
|
if (info.SuppressNotifications)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Game.AddSystemLine("Battlefield Control", player.PlayerName + " is victorious.");
|
Game.AddSystemLine(player.PlayerName + " is victorious.");
|
||||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||||
{
|
{
|
||||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
if (ticksRemaining == m * 60 * ticksPerSecond)
|
if (ticksRemaining == m * 60 * ticksPerSecond)
|
||||||
{
|
{
|
||||||
Game.AddSystemLine("Battlefield Control", Notification.F(m, m > 1 ? "s" : null));
|
Game.AddSystemLine(Notification.F(m, m > 1 ? "s" : null));
|
||||||
|
|
||||||
var faction = self.World.LocalPlayer == null ? null : self.World.LocalPlayer.Faction.InternalName;
|
var faction = self.World.LocalPlayer == null ? null : self.World.LocalPlayer.Faction.InternalName;
|
||||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.World.LocalPlayer, "Speech", info.TimeLimitWarnings[m], faction);
|
Game.Sound.PlayNotification(self.World.Map.Rules, self.World.LocalPlayer, "Speech", info.TimeLimitWarnings[m], faction);
|
||||||
@@ -172,7 +172,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
countdownLabel.GetText = () => null;
|
countdownLabel.GetText = () => null;
|
||||||
|
|
||||||
if (!info.SkipTimerExpiredNotification)
|
if (!info.SkipTimerExpiredNotification)
|
||||||
Game.AddSystemLine("Battlefield Control", "Time limit has expired.");
|
Game.AddSystemLine("Time limit has expired.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (Game.Settings.Sound.Mute)
|
if (Game.Settings.Sound.Mute)
|
||||||
{
|
{
|
||||||
Game.Sound.MuteAudio();
|
Game.Sound.MuteAudio();
|
||||||
Game.AddSystemLine("Battlefield Control", "Audio muted");
|
Game.AddSystemLine("Audio muted");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Game.Sound.UnmuteAudio();
|
Game.Sound.UnmuteAudio();
|
||||||
Game.AddSystemLine("Battlefield Control", "Audio unmuted");
|
Game.AddSystemLine("Audio unmuted");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -281,12 +281,12 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
// Check if selecting actors on the screen has selected new units
|
// Check if selecting actors on the screen has selected new units
|
||||||
if (ownUnitsOnScreen.Count > World.Selection.Actors.Count())
|
if (ownUnitsOnScreen.Count > World.Selection.Actors.Count())
|
||||||
Game.AddSystemLine("Battlefield Control", "Selected across screen");
|
Game.AddSystemLine("Selected across screen");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Select actors in the world that have highest selection priority
|
// Select actors in the world that have highest selection priority
|
||||||
ownUnitsOnScreen = SelectActorsInWorld(World, null, eligiblePlayers).SubsetWithHighestSelectionPriority(e.Modifiers).ToList();
|
ownUnitsOnScreen = SelectActorsInWorld(World, null, eligiblePlayers).SubsetWithHighestSelectionPriority(e.Modifiers).ToList();
|
||||||
Game.AddSystemLine("Battlefield Control", "Selected across map");
|
Game.AddSystemLine("Selected across map");
|
||||||
}
|
}
|
||||||
|
|
||||||
World.Selection.Combine(World, ownUnitsOnScreen, false, false);
|
World.Selection.Combine(World, ownUnitsOnScreen, false, false);
|
||||||
@@ -313,12 +313,12 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
// Check if selecting actors on the screen has selected new units
|
// Check if selecting actors on the screen has selected new units
|
||||||
if (newSelection.Count > World.Selection.Actors.Count())
|
if (newSelection.Count > World.Selection.Actors.Count())
|
||||||
Game.AddSystemLine("Battlefield Control", "Selected across screen");
|
Game.AddSystemLine("Selected across screen");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Select actors in the world that have the same selection class as one of the already selected actors
|
// Select actors in the world that have the same selection class as one of the already selected actors
|
||||||
newSelection = SelectActorsInWorld(World, selectedClasses, eligiblePlayers).ToList();
|
newSelection = SelectActorsInWorld(World, selectedClasses, eligiblePlayers).ToList();
|
||||||
Game.AddSystemLine("Battlefield Control", "Selected across map");
|
Game.AddSystemLine("Selected across map");
|
||||||
}
|
}
|
||||||
|
|
||||||
World.Selection.Combine(World, newSelection, true, false);
|
World.Selection.Combine(World, newSelection, true, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user