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.
This commit is contained in:
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (self.Owner.WinState != WinState.Undefined || self.Owner.NonCombatant) return;
|
if (self.Owner.WinState != WinState.Undefined || self.Owner.NonCombatant) return;
|
||||||
|
|
||||||
if (objectiveID < 0)
|
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())
|
if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits())
|
||||||
mo.MarkFailed(self.Owner, objectiveID);
|
mo.MarkFailed(self.Owner, objectiveID);
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
world.ObserveAfterWinOrLose = !info.EarlyGameOver;
|
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;
|
var newID = objectives.Count;
|
||||||
|
|
||||||
objectives.Insert(newID, new MissionObjective(type, description));
|
objectives.Insert(newID, new MissionObjective(type, description));
|
||||||
|
|
||||||
ObjectiveAdded(player);
|
ObjectiveAdded(player, inhibitAnnouncement);
|
||||||
foreach (var inou in player.PlayerActor.TraitsImplementing<INotifyObjectivesUpdated>())
|
foreach (var inou in player.PlayerActor.TraitsImplementing<INotifyObjectivesUpdated>())
|
||||||
inou.OnObjectiveAdded(player, newID);
|
inou.OnObjectiveAdded(player, newID);
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
MarkFailed(player, id);
|
MarkFailed(player, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public event Action<Player> ObjectiveAdded = player => { player.HasObjectives = true; };
|
public event Action<Player, bool> ObjectiveAdded = (player, inhibitAnnouncement) => { player.HasObjectives = true; };
|
||||||
|
|
||||||
public void OnObjectiveAdded(Player player, int id) { }
|
public void OnObjectiveAdded(Player player, int id) { }
|
||||||
public void OnObjectiveCompleted(Player player, int id) { }
|
public void OnObjectiveCompleted(Player player, int id) { }
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (player.WinState != WinState.Undefined || player.NonCombatant) return;
|
if (player.WinState != WinState.Undefined || player.NonCombatant) return;
|
||||||
|
|
||||||
if (objectiveID < 0)
|
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())
|
if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits())
|
||||||
mo.MarkFailed(self.Owner, objectiveID);
|
mo.MarkFailed(self.Owner, objectiveID);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
PopulateObjectivesList(mo, objectivesPanel, template);
|
PopulateObjectivesList(mo, objectivesPanel, template);
|
||||||
|
|
||||||
Action<Player> redrawObjectives = player =>
|
Action<Player, bool> redrawObjectives = (player, _) =>
|
||||||
{
|
{
|
||||||
if (player == lp)
|
if (player == lp)
|
||||||
PopulateObjectivesList(mo, objectivesPanel, template);
|
PopulateObjectivesList(mo, objectivesPanel, template);
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
if (lp != null)
|
if (lp != null)
|
||||||
{
|
{
|
||||||
Action<Player> startBlinking = player =>
|
Action<Player, bool> startBlinking = (player, inhibitAnnouncement) =>
|
||||||
{
|
{
|
||||||
if (player == world.LocalPlayer)
|
if (!inhibitAnnouncement && player == world.LocalPlayer)
|
||||||
blinking = true;
|
blinking = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user