Пример #1
0
        /// <summary>
        /// Refreshes the required conditions for processing, mostly for rockets.
        /// </summary>
        private void RefreshProcess()
        {
            bool rocket = lastSelection.isRocket;
            int  nh = 0, nr = 0, n = processVisible.Count;

            // Thaw and turn off all existing rows
            for (int i = 0; i < n; i++)
            {
                processVisible[i].SetActive(false);
            }
            processVisible.Clear();
            if (rocket)
            {
                if (DlcManager.FeatureClusterSpaceEnabled())
                {
                    RefreshProcessConditions(ProcessConditionType.RocketFlight, ref nh,
                                             ref nr);
                }
                RefreshProcessConditions(ProcessConditionType.RocketPrep, ref nh, ref nr);
                RefreshProcessConditions(ProcessConditionType.RocketStorage, ref nh, ref nr);
                RefreshProcessConditions(ProcessConditionType.RocketBoard, ref nh, ref nr);
            }
            else
            {
                RefreshProcessConditions(ProcessConditionType.All, ref nh, ref nr);
            }
            pendingProcessFreeze = true;
        }
Пример #2
0
 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;
 }
Пример #3
0
			/// <summary>
			/// Applied before RefreshRows runs.
			/// </summary>
			internal static bool Prefix(TableScreen __instance) {
				var identities = HashSetPool<IAssignableIdentity, TableScreen>.Allocate();
				var living = Components.LiveMinionIdentities.Items;
				StoredMinionIdentity smi;
				// Living Duplicants
				for (int i = 0; i < living.Count; i++) {
					var dupe = living[i];
					if (dupe != null)
						identities.Add(dupe);
				}
				// Duplicants in vanilla rockets and similar
				foreach (var minionStorage in Components.MinionStorages.Items)
					foreach (var info in minionStorage.GetStoredMinionInfo()) {
						var dupe = info.serializedMinion;
						if (dupe != null && (smi = dupe.Get<StoredMinionIdentity>()) != null)
							__instance.AddRow(smi);
					}
				ClearAndAddRows(__instance, identities);
				// Add the missing rows
				foreach (var missingMinion in identities)
					__instance.AddRow(missingMinion);
				identities.Recycle();
				if (DlcManager.FeatureClusterSpaceEnabled())
					AddDividers(__instance);
				SortRows(__instance);
				__instance.rows_dirty = false;
				return false;
			}
Пример #4
0
        /// <summary>
        /// Applied before RefreshMinions runs.
        /// </summary>
        internal static bool Prefix(MeterScreen __instance)
        {
            int living         = Components.LiveMinionIdentities.Count;
            int identities     = __instance.GetWorldMinionIdentities().Count;
            var currentMinions = __instance.currentMinions;
            var tt             = __instance.MinionsTooltip;

            if (identities != __instance.cachedMinionCount && currentMinions != null && tt !=
                null)
            {
                string         ttText;
                WorldContainer activeWorld;
                __instance.cachedMinionCount = identities;
                string alive = living.ToString();
                if (DlcManager.FeatureClusterSpaceEnabled() && (activeWorld = ClusterManager.
                                                                              Instance.activeWorld) != null && activeWorld.TryGetComponent(
                        out ClusterGridEntity world))
                {
                    var    text = CACHED_BUILDER;
                    string ids  = identities.ToString();
                    text.Clear().Append(STRINGS.UI.TOOLTIPS.METERSCREEN_POPULATION_CLUSTER);
                    ttText = text.Replace("{0}", world.Name).Replace("{1}", ids).Replace(
                        "{2}", alive).ToString();
                    text.Clear().Append(ids).Append('/').Append(alive);
                    currentMinions.SetText(text);
                }
                else
                {
                    ttText = STRINGS.UI.TOOLTIPS.METERSCREEN_POPULATION.Format(alive);
                    currentMinions.SetText(alive);
                }
                tt.ClearMultiStringTooltip();
                tt.AddMultiStringTooltip(ttText, __instance.ToolTipStyle_Header);
            }
            return(false);
        }