Fixed selecting none in spec dropdown should set none as active panel

This commit is contained in:
teinarss
2019-07-23 19:37:35 +02:00
committed by Paul Chote
parent cc84daacea
commit b5c387774c

View File

@@ -50,7 +50,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly WorldRenderer worldRenderer; readonly WorldRenderer worldRenderer;
readonly string clickSound = ChromeMetrics.Get<string>("ClickSound"); readonly string clickSound = ChromeMetrics.Get<string>("ClickSound");
bool noneSelected = true;
ObserverStatsPanel activePanel; ObserverStatsPanel activePanel;
[ObjectCreator.UseCtor] [ObjectCreator.UseCtor]
@@ -113,7 +112,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
IsSelected = () => activePanel == panel, IsSelected = () => activePanel == panel,
OnClick = () => OnClick = () =>
{ {
noneSelected = false;
ClearStats(); ClearStats();
playerStatsPanel.Visible = true; playerStatsPanel.Visible = true;
statsDropDown.GetText = () => title; statsDropDown.GetText = () => title;
@@ -132,13 +130,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
new StatsDropDownOption new StatsDropDownOption
{ {
Title = "Information: None", Title = "Information: None",
IsSelected = () => noneSelected, IsSelected = () => activePanel == ObserverStatsPanel.None,
OnClick = () => OnClick = () =>
{ {
noneSelected = true;
statsDropDown.GetText = () => "Information: None"; statsDropDown.GetText = () => "Information: None";
playerStatsPanel.Visible = false; playerStatsPanel.Visible = false;
ClearStats(); ClearStats();
activePanel = ObserverStatsPanel.None;
} }
}, },
createStatsOption("Basic", ObserverStatsPanel.Basic, basicPlayerTemplate, () => DisplayStats(BasicStats)), createStatsOption("Basic", ObserverStatsPanel.Basic, basicPlayerTemplate, () => DisplayStats(BasicStats)),