From 34f382ec5727bc628e3ab478d33a89f1666186e4 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Wed, 4 Mar 2015 18:52:38 +0100 Subject: [PATCH 1/2] Prevent unnecessary blinking of the options button in non-mission type games The options button starts blinking when a new objective is added, which happens in all game modes, even skirmish and koth. This change prevents the button from blinking in the latter two cases. This prevents 1) confusion on part of the players, and 2) an unnecessary announcement of the objective since in skirmish and koth it is always the same. --- .../Traits/Player/ConquestVictoryConditions.cs | 2 +- OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs | 6 +++--- .../Traits/Player/StrategicVictoryConditions.cs | 2 +- .../Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs | 2 +- .../Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs index 7137e6de78..1becb442c3 100644 --- a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits if (self.Owner.WinState != WinState.Undefined || self.Owner.NonCombatant) return; if (objectiveID < 0) - objectiveID = mo.Add(self.Owner, "Destroy all opposition!"); + objectiveID = mo.Add(self.Owner, "Destroy all opposition!", ObjectiveType.Primary, true); if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits()) mo.MarkFailed(self.Owner, objectiveID); diff --git a/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs b/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs index ff86f180d0..6d7aa0a1d7 100644 --- a/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs +++ b/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs @@ -72,13 +72,13 @@ namespace OpenRA.Mods.Common.Traits world.ObserveAfterWinOrLose = !info.EarlyGameOver; } - public int Add(Player player, string description, ObjectiveType type = ObjectiveType.Primary) + public int Add(Player player, string description, ObjectiveType type = ObjectiveType.Primary, bool inhibitAnnouncement = false) { var newID = objectives.Count; objectives.Insert(newID, new MissionObjective(type, description)); - ObjectiveAdded(player); + ObjectiveAdded(player, inhibitAnnouncement); foreach (var inou in player.PlayerActor.TraitsImplementing()) inou.OnObjectiveAdded(player, newID); @@ -231,7 +231,7 @@ namespace OpenRA.Mods.Common.Traits MarkFailed(player, id); } - public event Action ObjectiveAdded = player => { player.HasObjectives = true; }; + public event Action ObjectiveAdded = (player, inhibitAnnouncement) => { player.HasObjectives = true; }; public void OnObjectiveAdded(Player player, int id) { } public void OnObjectiveCompleted(Player player, int id) { } diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs index e58e41e443..f1e29c0837 100644 --- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs @@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits if (player.WinState != WinState.Undefined || player.NonCombatant) return; if (objectiveID < 0) - objectiveID = mo.Add(player, "Hold all the strategic positions for a specified time!"); + objectiveID = mo.Add(player, "Hold all the strategic positions for a specified time!", ObjectiveType.Primary, true); if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits()) mo.MarkFailed(self.Owner, objectiveID); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs index f10276ab7d..3f68270eb4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic PopulateObjectivesList(mo, objectivesPanel, template); - Action redrawObjectives = player => + Action redrawObjectives = (player, _) => { if (player == lp) PopulateObjectivesList(mo, objectivesPanel, template); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs index f6972aceae..0e4c082a11 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs @@ -55,9 +55,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (lp != null) { - Action startBlinking = player => + Action startBlinking = (player, inhibitAnnouncement) => { - if (player == world.LocalPlayer) + if (!inhibitAnnouncement && player == world.LocalPlayer) blinking = true; }; From 4e010bd6e67f39e4175a24a0c605ebb0825105ea Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Tue, 26 May 2015 11:45:28 +0200 Subject: [PATCH 2/2] Change *VictoryConditions to use customizable objective descriptions --- .../Traits/Player/ConquestVictoryConditions.cs | 7 +++++-- .../Traits/Player/StrategicVictoryConditions.cs | 7 +++++-- .../Widgets/Logic/Ingame/GameInfoStatsLogic.cs | 5 +++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs index 1becb442c3..85e8fe2237 100644 --- a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs @@ -16,7 +16,10 @@ namespace OpenRA.Mods.Common.Traits public class ConquestVictoryConditionsInfo : ITraitInfo, Requires { [Desc("Delay for the end game notification in milliseconds.")] - public int NotificationDelay = 1500; + public readonly int NotificationDelay = 1500; + + [Desc("Description of the objective.")] + [Translate] public readonly string Objective = "Destroy all opposition!"; public object Create(ActorInitializer init) { return new ConquestVictoryConditions(init.Self, this); } } @@ -38,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits if (self.Owner.WinState != WinState.Undefined || self.Owner.NonCombatant) return; if (objectiveID < 0) - objectiveID = mo.Add(self.Owner, "Destroy all opposition!", ObjectiveType.Primary, true); + objectiveID = mo.Add(self.Owner, info.Objective, ObjectiveType.Primary, true); if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits()) mo.MarkFailed(self.Owner, objectiveID); diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs index f1e29c0837..6648962820 100644 --- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs @@ -31,7 +31,10 @@ namespace OpenRA.Mods.Common.Traits public readonly float RatioRequired = 0.5f; [Desc("Delay for the end game notification in milliseconds.")] - public int NotificationDelay = 1500; + public readonly int NotificationDelay = 1500; + + [Desc("Description of the objective")] + [Translate] public readonly string Objective = "Hold all the strategic positions!"; public object Create(ActorInitializer init) { return new StrategicVictoryConditions(init.Self, this); } } @@ -68,7 +71,7 @@ namespace OpenRA.Mods.Common.Traits if (player.WinState != WinState.Undefined || player.NonCombatant) return; if (objectiveID < 0) - objectiveID = mo.Add(player, "Hold all the strategic positions for a specified time!", ObjectiveType.Primary, true); + objectiveID = mo.Add(player, info.Objective, ObjectiveType.Primary, true); if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits()) mo.MarkFailed(self.Owner, objectiveID); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs index 13b390698c..63c64ba30c 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs @@ -27,6 +27,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic checkbox.IsChecked = () => lp.WinState != WinState.Undefined; checkbox.GetCheckType = () => lp.WinState == WinState.Won ? "checked" : "crossed"; + if (lp.HasObjectives) + { + var mo = lp.PlayerActor.Trait(); + checkbox.GetText = () => mo.Objectives.First().Description; + } var statusLabel = widget.Get("STATS_STATUS");