public void CreateUI() { // Delete the old button, panel, and object if they're there. UIMultiStateButton oldButton = UIUtils.Find <UIMultiStateButton>(BUTTON_NAME); if (oldButton != null) { GameObject.Destroy(oldButton); } UIPanel oldPanel = UIUtils.Find <UIPanel>(PANEL_NAME); if (oldPanel != null) { GameObject.Destroy(oldPanel); } UIComponent roadsOptionPanel = UIUtils.Find <UIComponent>("DistrictOptionPanel"); if (roadsOptionPanel == null) { // Listen for districts tab if it hasn't been added yet UITabstrip mainToolStrip = UIUtils.Find <UITabstrip>("MainToolstrip"); if (mainToolStrip == null) { CitiesConsole.Warning("Could not find MainToolstrip"); return; } mainToolStrip.eventSelectedIndexChanged += mainToolStrip_eventSelectedIndexChanged; } else { CreateButton(roadsOptionPanel); } }
public override void OnUpdate(float realTimeDelta, float simulationTimeDelta) { if (!uiCreated) { try { streetDirectionViewerUI.appMode = threading.managers.loading.currentMode; streetDirectionViewerUI.CreateUI(); } catch (Exception e) { CitiesConsole.Error(e); } uiCreated = true; } }