Freezes map after game ends.

Adds newline.

Disables keyboard hotkeys for units after game ends.
This commit is contained in:
deniz1a
2015-07-09 13:06:36 +03:00
parent ea3a680eda
commit ef143e5f8a
5 changed files with 19 additions and 12 deletions

View File

@@ -106,6 +106,9 @@ namespace OpenRA.Orders
if (self.Owner != self.World.LocalPlayer) if (self.Owner != self.World.LocalPlayer)
return null; return null;
if (self.World.IsGameOver)
return null;
if (self.Disposed || !target.IsValidFor(self)) if (self.Disposed || !target.IsValidFor(self))
return null; return null;

View File

@@ -57,6 +57,16 @@ namespace OpenRA
} }
} }
foreach (var a in newSelection)
foreach (var sel in a.TraitsImplementing<INotifySelected>())
sel.Selected(a);
foreach (var ns in world.WorldActor.TraitsImplementing<INotifySelection>())
ns.SelectionChanged();
if (world.IsGameOver)
return;
// Play the selection voice from one of the selected actors // Play the selection voice from one of the selected actors
// TODO: This probably should only be considering the newly selected actors // TODO: This probably should only be considering the newly selected actors
// TODO: Ship this into an INotifySelection trait to remove the engine dependency on Selectable // TODO: Ship this into an INotifySelection trait to remove the engine dependency on Selectable
@@ -72,12 +82,6 @@ namespace OpenRA
actor.PlayVoice(selectable.Voice); actor.PlayVoice(selectable.Voice);
break; break;
} }
foreach (var a in newSelection)
foreach (var sel in a.TraitsImplementing<INotifySelected>())
sel.Selected(a);
foreach (var ns in world.WorldActor.TraitsImplementing<INotifySelection>())
ns.SelectionChanged();
} }
public IEnumerable<Actor> Actors { get { return actors; } } public IEnumerable<Actor> Actors { get { return actors; } }

View File

@@ -232,13 +232,13 @@ namespace OpenRA.Widgets
if (key == Game.Settings.Keys.PauseKey && World.LocalPlayer != null) // Disable pausing for spectators if (key == Game.Settings.Keys.PauseKey && World.LocalPlayer != null) // Disable pausing for spectators
World.SetPauseState(!World.Paused); World.SetPauseState(!World.Paused);
else if (key == Game.Settings.Keys.SelectAllUnitsKey) else if (key == Game.Settings.Keys.SelectAllUnitsKey && !World.IsGameOver)
{ {
// Select actors on the screen which belong to the current player // Select actors on the screen which belong to the current player
var ownUnitsOnScreen = SelectActorsOnScreen(World, worldRenderer, null, player).SubsetWithHighestSelectionPriority(); var ownUnitsOnScreen = SelectActorsOnScreen(World, worldRenderer, null, player).SubsetWithHighestSelectionPriority();
World.Selection.Combine(World, ownUnitsOnScreen, false, false); World.Selection.Combine(World, ownUnitsOnScreen, false, false);
} }
else if (key == Game.Settings.Keys.SelectUnitsByTypeKey) else if (key == Game.Settings.Keys.SelectUnitsByTypeKey && !World.IsGameOver)
{ {
// Get all the selected actors' selection classes // Get all the selected actors' selection classes
var selectedClasses = World.Selection.Actors var selectedClasses = World.Selection.Actors

View File

@@ -52,12 +52,12 @@ namespace OpenRA
public Player LocalPlayer { get; private set; } public Player LocalPlayer { get; private set; }
public event Action GameOver = () => { }; public event Action GameOver = () => { };
bool gameOver; public bool IsGameOver { get; private set; }
public void EndGame() public void EndGame()
{ {
if (!gameOver) if (!IsGameOver)
{ {
gameOver = true; IsGameOver = true;
foreach (var t in WorldActor.TraitsImplementing<IGameOver>()) foreach (var t in WorldActor.TraitsImplementing<IGameOver>())
t.GameOver(this); t.GameOver(this);

View File

@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Widgets
return ToSelection(); return ToSelection();
// Put all functions that aren't unit-specific before this line! // Put all functions that aren't unit-specific before this line!
if (!world.Selection.Actors.Any()) if (!world.Selection.Actors.Any() || world.IsGameOver)
return false; return false;
if (key == ks.AttackMoveKey) if (key == ks.AttackMoveKey)