fix automatic tab selection

This commit is contained in:
Chris Forbes
2010-04-16 18:39:43 +12:00
parent ccd440d461
commit fc327fd074
3 changed files with 16 additions and 6 deletions

View File

@@ -19,6 +19,7 @@
#endregion #endregion
using System.Linq; using System.Linq;
using OpenRA.Widgets;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
@@ -38,7 +39,8 @@ namespace OpenRA.Traits
if (produces == null) if (produces == null)
return; return;
//Game.chrome.SetCurrentTab(produces); Chrome.rootWidget.GetWidget<BuildPaletteWidget>("INGAME_BUILD_PALETTE")
.SetCurrentTab(produces);
} }
} }
} }

View File

@@ -80,11 +80,13 @@ namespace OpenRA.Widgets
public override void Tick(World world) public override void Tick(World world)
{ {
visibleTabs.Clear(); visibleTabs.Clear();
foreach (var q in tabImageNames) foreach (var q in tabImageNames)
if (!Rules.TechTree.BuildableItems(world.LocalPlayer, q.Key).Any()) if (!Rules.TechTree.BuildableItems(world.LocalPlayer, q.Key).Any())
if (currentTab == q.Key) {
currentTab = null; if (currentTab == q.Key)
else currentTab = null;
}
else
visibleTabs.Add(q.Key); visibleTabs.Add(q.Key);
if (currentTab == null) if (currentTab == null)

View File

@@ -308,6 +308,12 @@ Container:
Id:INGAME_POWERS_BIN Id:INGAME_POWERS_BIN
X:0 X:0
Y:25 Y:25
BuildPalette@INGAME_BUILD_PALETTE:
Id:INGAME_BUILD_PALETTE
X:WINDOW_RIGHT - 250
Y:280
Width:250
Height:500
Button@INGAME_OPTIONS_BUTTON: Button@INGAME_OPTIONS_BUTTON:
Id:INGAME_OPTIONS_BUTTON Id:INGAME_OPTIONS_BUTTON
X:0 X:0