internal LastSelectionDetails(GameObject target) { target.TryGetComponent(out conditions); target.TryGetComponent(out identity); target.TryGetComponent(out modifiers); target.TryGetComponent(out rocketModule); target.TryGetComponent(out selectable); target.TryGetComponent(out world); if (rocketModule != null) { rocketInterface = rocketModule.CraftInterface; // Clustercraft can be pulled from the rocket-to-module interface gridEntity = rocketInterface.m_clustercraft; } else if (target.TryGetComponent(out gridEntity) && gridEntity is Clustercraft craft) { rocketInterface = craft.ModuleInterface; } else { rocketInterface = null; } fertility = target.GetSMI <FertilityMonitor.Instance>(); if (DlcManager.FeatureClusterSpaceEnabled()) { isRocket = target.TryGetComponent(out LaunchPad _) || target. TryGetComponent(out RocketProcessConditionDisplayTarget _); } else { isRocket = target.TryGetComponent(out LaunchableRocket _); } isAsteroid = gridEntity != null && gridEntity is AsteroidGridEntity; }
private void RefreshBreedingChance() { if ((UnityEngine.Object)selectedTarget == (UnityEngine.Object)null) { fertilityPanel.gameObject.SetActive(false); } else { FertilityMonitor.Instance sMI = selectedTarget.GetSMI <FertilityMonitor.Instance>(); if (sMI == null) { fertilityPanel.gameObject.SetActive(false); } else { int num = 0; foreach (FertilityMonitor.BreedingChance breedingChance in sMI.breedingChances) { List <FertilityModifier> forTag = Db.Get().FertilityModifiers.GetForTag(breedingChance.egg); if (forTag.Count > 0) { string text = string.Empty; foreach (FertilityModifier item in forTag) { text += string.Format(UI.DETAILTABS.EGG_CHANCES.CHANCE_MOD_FORMAT, item.GetTooltip()); } fertilityPanel.SetLabel("breeding_" + num++, string.Format(UI.DETAILTABS.EGG_CHANCES.CHANCE_FORMAT, breedingChance.egg.ProperName(), GameUtil.GetFormattedPercent(breedingChance.weight * 100f, GameUtil.TimeSlice.None)), string.Format(UI.DETAILTABS.EGG_CHANCES.CHANCE_FORMAT_TOOLTIP, breedingChance.egg.ProperName(), GameUtil.GetFormattedPercent(breedingChance.weight * 100f, GameUtil.TimeSlice.None), text)); } else { fertilityPanel.SetLabel("breeding_" + num++, string.Format(UI.DETAILTABS.EGG_CHANCES.CHANCE_FORMAT, breedingChance.egg.ProperName(), GameUtil.GetFormattedPercent(breedingChance.weight * 100f, GameUtil.TimeSlice.None)), string.Format(UI.DETAILTABS.EGG_CHANCES.CHANCE_FORMAT_TOOLTIP_NOMOD, breedingChance.egg.ProperName(), GameUtil.GetFormattedPercent(breedingChance.weight * 100f, GameUtil.TimeSlice.None))); } } fertilityPanel.Commit(); } } }