public void Update(float dtime, HelpPopupRegion region) { foreach (var v in new List <ProfileHelpPopup>(popups)) { ProfileHelpPopup pop = v; if (v.Region == region) { HelpPopupForm hp; activePopups.TryGetValue(v, out hp); if (v.Completed) { if (hp != null && !hp.IsRemoved) { hp.Completed = true; Program.Instance.Timeout(10, () => { if (!hp.IsRemoved) { GetPopupContainer(pop.Region).ScrollOut(hp); } }); } activePopups.Remove(v); } else { if (v.Enabled) { v.Time -= dtime; } else { if (hp != null && !hp.IsRemoved) { GetPopupContainer(pop.Region).ScrollOut(hp); activePopups.Remove(v); } } if (v.Time <= 0 && v.Enabled && !v.Completed && (hp == null || hp.IsRemoved)) { activePopups[v] = hp = new HelpPopupForm { Text = v.Text, Visible = Program.Settings.DisplayHelpPopups }; hp.Closed += new EventHandler((e, o) => { popups.Remove(pop); }); var po = GetPopupContainer(region); po.AddChild(hp); } } } } }
PopupContainer GetPopupContainer(HelpPopupRegion region) { if (region == HelpPopupRegion.InGame) { return(Game.Game.Instance.Interface.PopupContainer); } else { return(ProgramStates.ProfileMenu.Instance.PopupContainer); } }