/// <summary> /// Closes the panel by destroying the object (removing any ongoing UI overhead). /// </summary> internal static void Close() { GameObject.Destroy(panel); GameObject.Destroy(uiGameObject); panel = null; uiGameObject = null; }
/// <summary> /// Creates the panel object in-game and displays it. /// </summary> internal static void Create() { try { // If no instance already set, create one. if (uiGameObject == null) { // Give it a unique name for easy finding with ModTools. uiGameObject = new GameObject("ABLCBuildingPanel"); uiGameObject.transform.parent = UIView.library.Get <ZonedBuildingWorldInfoPanel>(typeof(ZonedBuildingWorldInfoPanel).Name)?.component.transform; panel = uiGameObject.AddComponent <ABLCBuildingPanel>(); // Set up and show panel. Panel.Setup(uiGameObject.transform.parent); Panel.Show(); } } catch (Exception e) { Logging.LogException(e, "exception creating ABLCBuildingPanel"); } }