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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user