Пример #1
0
        public void ReInitialize()
        {
            if (config.UseDebugMessages)
            {
                Adverts.Register("Every Ten Seconds!?!?!?!?!?", Color.Chartreuse, TimeSpan.FromSeconds(10));
                Adverts.Register("Every Fifteen Seconds!?!?!?!?!?", Color.OrangeRed, TimeSpan.FromSeconds(15));
            }

            foreach (Advert.Message msg in adverts)
            {
                Adverts.Deregister(msg.Index);
            }

            adverts.Clear();

            foreach (var adv in config.Adverts)
            {
                string message = adv.Text;
                Color  color   = (Color)typeof(Color)
                                 .GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int) })
                                 .Invoke(adv.Color.Cast <object>().ToArray());
                TimeSpan delay  = adv.Time.ToTimeSpan();
                TimeSpan offset = adv.Offset.ToTimeSpan();

                if (adv.RunOnce)
                {
                    offset = delay;

                    delay = TimeSpan.MaxValue - TimeSpan.FromDays(1);
                }

                adverts.Add(Adverts.Register(message, color, delay, offset));
            }
        }
Пример #2
0
        private void DeleteConfigAdvert(int index)
        {
            ConfigAdverts.Config.Advert cfad = ConfigAdverts.config.Adverts[index];
            ConfigAdverts.config.Adverts.RemoveNoShift(index);

            foreach (var m in Advert.Instance.Messages)
            {
                if (!EqualityComparer <Advert.Message> .Default.Equals(m, default(Advert.Message)) &&
                    m.Text == cfad.Text && m.Delay == cfad.Time.ToTimeSpan() && m.Offset == cfad.Offset.ToTimeSpan() &&
                    new int[] { m.Color.R, m.Color.G, m.Color.B } == cfad.Color)
                {
                    Adverts.Deregister(m.Index);
                }
            }
        }
Пример #3
0
 public bool Send(Advert.Message m, TSPlayer ply)
 {
     self.Reminders[ply.Index].Remove(m);
     Adverts.Deregister(m.Index);
     return(true);
 }