Exemple #1
0
#pragma warning restore IDE0044
#pragma warning restore CS0649

        /// <summary>
        /// Highlights all critters matching this critter type on the active world.
        /// </summary>
        /// <param name="color">The color to highlight the critters.</param>
        internal void HighlightAllMatching(Color color)
        {
            var type = CritterType;
            int id   = ClusterManager.Instance.activeWorldId;

            CritterInventoryUtils.GetCritters(id, (creature) => {
                if (creature.GetCritterType() == type)
                {
                    PUtil.HighlightEntity(creature, color);
                }
            });
        }
			/// <summary>
			/// Applied after Hover runs.
			/// </summary>
			/// <param name="__instance">The current resource entry.</param>
			/// <param name="is_hovering">true if the user is hovering, or false otherwise</param>
			/// <param name="___HighlightColor">The highlight color from the instance.</param>
			internal static void Postfix(ResourceEntry __instance, bool is_hovering,
					Color ___HighlightColor) {
				var info = __instance.gameObject.GetComponent<CritterResourceInfo>();
				if (info != null) {
					var hlc = ___HighlightColor;
					CritterType type = info.CritterType;
					Tag species = __instance.Resource;
					CritterInventoryUtils.IterateCreatures((creature) => {
						if (creature.PrefabID() == species && type.Matches(creature))
							PUtil.HighlightEntity(creature, is_hovering ? hlc : Color.black);
					});
				}
			}
			/// <summary>
			/// Applied after Hover runs.
			/// </summary>
			/// <param name="__instance">The current resource category header.</param>
			/// <param name="is_hovering">true if the user is hovering, or false otherwise.</param>
			/// <param name="___highlightColour">The highlight color from the instance.</param>
			internal static void Postfix(ResourceCategoryHeader __instance,
					bool is_hovering, Color ___highlightColour) {
				var info = __instance.gameObject.GetComponent<CritterResourceInfo>();
				if (info != null) {
					CritterType type = info.CritterType;
					// It is a creature header, highlight all matching
					CritterInventoryUtils.IterateCreatures((creature) => {
						if (type.Matches(creature))
							PUtil.HighlightEntity(creature, is_hovering ? ___highlightColour :
								Color.black);
					});
				}
			}