Added BuildableItemsChanged event to tech tree.

This lets the Sidebar only repopulate its item list when the items that can be built changes.
This commit is contained in:
Matthew Bowra-Dean
2009-10-07 03:37:35 +13:00
parent 803b18d9b5
commit aa3801eace
3 changed files with 14 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ namespace OpenRa.Game
public Sidebar( Race race, Renderer renderer, Game game )
{
this.techTree = game.LocalPlayer.TechTree;
this.techTree.BuildableItemsChanged += (sender, e) => { PopulateItemList(); };
this.game = game;
region = GRegion.Create(game.viewport, DockStyle.Right, 128, Paint, MouseHandler);
game.viewport.AddRegion( region );
@@ -98,7 +99,7 @@ namespace OpenRa.Game
void Paint()
{
PopulateItemList(); // todo: do this less often, just when things actually change!
// PopulateItemList(); // todo: do this less often, just when things actually change!
foreach (SidebarItem i in items)
i.Paint(spriteRenderer, region.Location);