public static void Postfix(TerrainNotes __instance) { // remove any previous stashed value from parent object __instance.ParentObject.DeleteStringProperty("HZColorNotes"); // base method already determined whether one or more tracked notes exist // abort if there aren't any if (!__instance.tracked) { return; } // default to "<DEFAULT>" color, because we know *something* is active string colorString = Colors.defaultString; // scan the list of notes in priority order to decide on a color foreach (DictionaryEntry entry in Colors.dict) { // skip this category if it's not applicable if (__instance.notes.Any( (JournalMapNote item) => item.category == (string)entry.Key && item.tracked )) { // map cell has an active note of this category // grab it's color and stop looking colorString = (string)entry.Value; break; } } // stash the chosen colors in the parent GameObject __instance.ParentObject.SetStringProperty("HZColorNotes", colorString); }
public static bool Prefix(TerrainNotes __instance, XRL.World.RenderEvent E, ref bool __result) { // set return value to true // this is a kludge because the original implementation does it by // chaining to its base class, which we can't access from here? __result = true; // bail out unless one or more tracked notes exist if (!__instance.tracked) { // don't execute original implementation return(false); } string colorString = __instance.ParentObject.GetStringProperty("HZColorNotes", Colors.defaultString); E.ColorString += "&" + colorString[DateTime.Now.Second & 1] + "^" + colorString[2]; E.DetailColor = colorString[2].ToString(); // don't execute original implementation return(false); }