/// <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()); }
/// <summary> /// Applied before RefreshChart runs. /// </summary> internal static bool Prefix(ResourceEntry __instance, GameObject ___sparkChart) { var entry = __instance.GetComponent <CritterResourceEntry>(); if (entry != null) { entry.UpdateChart(___sparkChart); } return(entry == null); }
/// <summary> /// Applied after Hover runs. /// </summary> internal static void Postfix(ResourceEntry __instance, bool is_hovering, Color ___HighlightColor) { var entry = __instance.GetComponent <CritterResourceEntry>(); if (entry != null) { entry.HighlightAllMatching(is_hovering ? ___HighlightColor : Color.black); } }