Example #1
0
        /// <summary>
        /// Updates an individual resource entry with the critters found.
        /// </summary>
        /// <param name="quantity">The quantity of this critter which is present.</param>
        internal void UpdateEntry(CritterTotals quantity)
        {
            // Update the tool tip text
            var tooltip = entry.GetComponent <ToolTip>();

            if (tooltip != null)
            {
                tooltip.OnToolTip = OnEntryTooltip;
            }
            // Determine the color for the labels (overdrawn is impossible for critters)
            var color = AVAILABLE_COLOR.Get(entry);

            if (quantity.Available <= 0)
            {
                color = UNAVAILABLE_COLOR.Get(entry);
            }
            LocText qLabel = entry.QuantityLabel, nLabel = entry.NameLabel;

            if (qLabel.color != color)
            {
                qLabel.color = color;
            }
            if (nLabel.color != color)
            {
                nLabel.color = color;
            }
            // Add up overall totals
            qLabel.SetText(quantity.Available.ToString());
        }
Example #2
0
		/// <summary>
		/// Updates the headings for this critter species.
		/// </summary>
		/// <param name="allTotals">The total critter counts for all species.</param>
		/// <param name="ci">The currently active critter inventory.</param>
		internal void UpdateContents(IDictionary<Tag, CritterTotals> allTotals,
				CritterInventory ci) {
			if (!allTotals.TryGetValue(Species, out var totals))
				totals = new CritterTotals();
			References.GetReference<LocText>("AvailableLabel").SetText(GameUtil.
				GetFormattedSimple(totals.Available));
			References.GetReference<LocText>("TotalLabel").SetText(GameUtil.
				GetFormattedSimple(totals.Total));
			References.GetReference<LocText>("ReservedLabel").SetText(GameUtil.
				GetFormattedSimple(totals.Reserved));
			UpdatePinnedState(ci);
		}