void Manager_OnAdded(Announcement announcement) { AnnouncementView view = new AnnouncementView(GUI, this); AnnouncementViews.Insert(0, view); view.SetAnnouncement(announcement); if (AnnouncementViews.Count > MaxViews) { AnnouncementView oldView = AnnouncementViews.ElementAt(AnnouncementViews.Count - 1); RemoveChild(oldView); AnnouncementViews.RemoveAt(AnnouncementViews.Count - 1); } WaitTimer.Reset(5); UpdateLayout(); }
public override void Update(DwarfTime time) { WaitTimer.Update(time); animation.Update(time); if (WaitTimer.HasTriggered) { if (AnnouncementViews.Count > 0) { TriggerMouseOver = true; AnnouncementView view = AnnouncementViews.ElementAt(AnnouncementViews.Count - 1); RemoveChild(view); AnnouncementViews.RemoveAt(AnnouncementViews.Count - 1); if (AnnouncementViews.Count > 0) { WaitTimer.Reset(); } else { Talker.TweenOut(Drawer2D.Alignment.Bottom); } } else { TriggerMouseOver = false; } } if (AnnouncementViews.Count > 0 && !Talker.IsVisible) { Talker.TweenIn(Drawer2D.Alignment.Bottom); } SpeechBubble.IsVisible = AnnouncementViews.Count > 0; if (SpeechBubble.IsVisible || Talker.IsVisible) { UpdateLayout(); } base.Update(time); }