Fix observer widgets not showing up when a player loses

Fixes #6172.
This commit is contained in:
Oliver Brakmann
2014-08-05 02:54:42 +02:00
parent cacb9fee64
commit b85d5a9193
2 changed files with 17 additions and 2 deletions

View File

@@ -172,7 +172,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
cachedRadarActive = radarActive;
// Switch to observer mode after win/loss
if (world.LocalPlayer.WinState != WinState.Undefined)
if (world.ObserveAfterWinOrLose && world.LocalPlayer.WinState != WinState.Undefined)
Game.RunAfterTick(() =>
{
playerRoot.RemoveChildren();

View File

@@ -23,7 +23,22 @@ namespace OpenRA.Mods.RA.Widgets.Logic
if (world.LocalPlayer == null)
Game.LoadWidget(world, "OBSERVER_WIDGETS", playerRoot, new WidgetArgs());
else
Game.LoadWidget(world, "PLAYER_WIDGETS", playerRoot, new WidgetArgs());
{
var playerWidgets = Game.LoadWidget(world, "PLAYER_WIDGETS", playerRoot, new WidgetArgs());
var sidebarTicker = playerWidgets.Get<LogicTickerWidget>("SIDEBAR_TICKER");
sidebarTicker.OnTick = () =>
{
// Switch to observer mode after win/loss
if (world.ObserveAfterWinOrLose && world.LocalPlayer.WinState != WinState.Undefined)
Game.RunAfterTick(() =>
{
playerRoot.RemoveChildren();
Game.LoadWidget(world, "OBSERVER_WIDGETS", playerRoot, new WidgetArgs());
});
};
}
Game.LoadWidget(world, "CHAT_PANEL", ingameRoot, new WidgetArgs());
}