public static bool Message(Verse.Message msg, bool historical = true) { lock (Messages.liveMessages) { if (!Messages.AcceptsMessage(msg.text, msg.lookTargets)) { return(false); } if (historical && Find.Archive != null) { Find.Archive.Add((IArchivable)msg); } Messages.liveMessages.Add(msg); while (Messages.liveMessages.Count > 12) { Messages.liveMessages.RemoveAt(0); } if (msg.def.sound == null) { return(false); } msg.def.sound.PlayOneShotOnCamera(); } return(false); }
public static bool CollidesWithAnyMessage(ref bool __result, Rect rect, out float messageAlpha) { bool flag = false; float a = 0.0f; lock (Messages.liveMessages) { for (int index = 0; index < Messages.liveMessages.Count; ++index) { Verse.Message liveMessage = Messages.liveMessages[index]; if (rect.Overlaps(liveMessage.lastDrawRect)) { flag = true; a = Mathf.Max(a, liveMessage.Alpha); } } } messageAlpha = a; return(flag); }