/// <summary> /// Applied before RefreshDetails runs. /// </summary> internal static bool Prefix(AdditionalDetailsPanel __instance) { var inst = AdditionalDetailsPanelWrapper.Instance; bool run = inst == null; if (!run) { inst.Update(__instance); } return(run); }
/// <summary> /// Updates the additional details panel. /// </summary> /// <param name="instance">The panel to update.</param> internal void Update(AdditionalDetailsPanel instance) { GameObject target; Element element; if (instance != null && (target = instance.selectedTarget) != null) { var drawer = instance.drawer; bool changed = target != lastSelection.target; if (changed) { var detailsPanel = instance.detailsPanel; lastSelection = new LastSelectionDetails(target); detailsPanel.SetActive(true); if (detailsPanel.TryGetComponent(out CollapsibleDetailContentPanel panel)) { panel.HeaderLabel.SetText(STRINGS.UI.DETAILTABS.DETAILS. GROUPNAME_DETAILS); } } element = lastSelection.element; if (element != null) { string massStr = GameUtil.GetFormattedMass(lastSelection.Mass); var id = element.id; changed |= !SpeedControlScreen.Instance.IsPaused; lastSelection.elementName.AddLine(drawer); drawer.NewLabel(drawer.Format(ELEMENTAL.MASS.NAME, massStr)). Tooltip(drawer.Format(ELEMENTAL.MASS.TOOLTIP, massStr)); AddCreationTime(drawer, changed); AddUptimeStats(drawer, changed); if (id != SimHashes.Vacuum && id != SimHashes.Void) { AddElementInfo(drawer); } AddPhaseChangeInfo(drawer, element); DetailDescriptors(drawer); } } }