public void RemoveConstructionPanel() { if (constructionPanel != null) { constructionPanel.Close(); RemoveChild(constructionPanel); constructionPanel = null; } }
void Building_OnSelected(object sender, EventArgs e) { RemoveConstructionPanel(); BaseConstruction construction = ((BaseConstruction)sender); constructionPanel = new ConstructionPanel(this.Game, construction); constructionPanel.StackOrder = stackOrder_slots + 15; UpdateConstructionPanelPosition(); AddChild(constructionPanel); constructionPanel.IsVisible = true; constructionPanel.Enabled = true; }