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
using System.Linq;
using OpenRA.Widgets;
namespace OpenRA.Traits
{
@@ -38,7 +39,8 @@ namespace OpenRA.Traits
if (produces == null)
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)
{
visibleTabs.Clear();
foreach (var q in tabImageNames)
if (!Rules.TechTree.BuildableItems(world.LocalPlayer, q.Key).Any())
if (currentTab == q.Key)
currentTab = null;
else
foreach (var q in tabImageNames)
if (!Rules.TechTree.BuildableItems(world.LocalPlayer, q.Key).Any())
{
if (currentTab == q.Key)
currentTab = null;
}
else
visibleTabs.Add(q.Key);
if (currentTab == null)

View File

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