Пример #1
0
        public Rectangle OnBeginRender()
        {
            double elapsed = this.m_Dispose.Elapsed;

            if (elapsed >= (double)this.m_SolidDuration + 1.0)
            {
                this.Visible = false;
                MessageManager.Remove((IMessage)this);
                return(this.m_ImageRect = this.m_Rectangle = Rectangle.Empty);
            }
            if (elapsed >= (double)this.m_SolidDuration)
            {
                this.Alpha = (float)(1.0 - (elapsed - (double)this.m_SolidDuration));
            }
            this.Visible            = true;
            this.X                  = Engine.GameX + 2;
            this.Y                  = MessageManager.yStack - this.Height;
            MessageManager.yStack   = this.Y - 2;
            this.m_Rectangle.X      = this.X;
            this.m_Rectangle.Y      = this.Y;
            this.m_Rectangle.Width  = this.Width;
            this.m_Rectangle.Height = this.Height;
            this.m_ImageRect.X      = this.X + this.Image.xMin;
            this.m_ImageRect.Y      = this.Y + this.Image.yMin;
            this.m_ImageRect.Width  = this.Image.xMax - this.Image.xMin + 1;
            this.m_ImageRect.Height = this.Image.yMax - this.Image.yMin + 1;
            this.Scissor(new Clipper(Engine.GameX, Engine.GameY, Engine.GameWidth, Engine.GameHeight));
            return(this.m_Rectangle);
        }
Пример #2
0
        public static void ClearMessages(IMessageOwner owner)
        {
            int count = MessageManager.m_Messages.Count;

            for (int index = 0; index < count; ++index)
            {
                IMessage m = (IMessage)MessageManager.m_Messages[index];
                if (m is GDynamicMessage && ((GDynamicMessage)m).Owner == owner)
                {
                    MessageManager.Remove(m);
                }
            }
        }
Пример #3
0
 public static void AddMessage(IMessage m)
 {
     Gumps.Desktop.Children.Add((Gump)m);
     MessageManager.m_Messages.Insert(0, (object)m);
     Gumps.Invalidated = true;
     if (m is GDynamicMessage)
     {
         int           num   = 0;
         IMessageOwner owner = ((GDynamicMessage)m).Owner;
         int           count = MessageManager.m_Messages.Count;
         for (int index = 0; index < count; ++index)
         {
             if (MessageManager.m_Messages[index] is GDynamicMessage && ((GDynamicMessage)MessageManager.m_Messages[index]).Owner == owner)
             {
                 if (num >= 3 && !((GDynamicMessage)MessageManager.m_Messages[index]).Unremovable)
                 {
                     MessageManager.Remove((IMessage)MessageManager.m_Messages[index]);
                 }
                 ++num;
             }
         }
     }
     else
     {
         if (!(m is GSystemMessage))
         {
             return;
         }
         GSystemMessage gsystemMessage1 = (GSystemMessage)m;
         DateTime       dateTime        = DateTime.Now - TimeSpan.FromSeconds(1.0);
         int            count           = MessageManager.m_Messages.Count;
         for (int index = 1; index < count; ++index)
         {
             if (MessageManager.m_Messages[index] is GSystemMessage)
             {
                 GSystemMessage gsystemMessage2 = (GSystemMessage)MessageManager.m_Messages[index];
                 if (gsystemMessage2.OrigText == gsystemMessage1.Text && (index == 1 || gsystemMessage2.UpdateTime >= dateTime))
                 {
                     gsystemMessage1.DupeCount = gsystemMessage2.DupeCount + 1;
                     MessageManager.Remove((IMessage)gsystemMessage2);
                     break;
                 }
             }
         }
     }
 }
Пример #4
0
        public Rectangle OnBeginRender()
        {
            double elapsed = this.m_Dispose.Elapsed;

            if (elapsed >= (double)this.m_SolidDuration + 1.0)
            {
                this.Visible = false;
                MessageManager.Remove((IMessage)this);
                return(this.m_ImageRect = this.m_Rectangle = Rectangle.Empty);
            }
            if (elapsed >= (double)this.m_SolidDuration)
            {
                this.Alpha = (float)(1.0 - (elapsed - (double)this.m_SolidDuration));
            }
            if (this.m_Owner.MessageFrame == Renderer.m_ActFrames)
            {
                this.m_Owner.MessageY -= this.Height + 2;
                this.X       = this.m_Owner.MessageX - this.Width / 2;
                this.Y       = this.m_Owner.MessageY;
                this.Visible = true;
            }
            else
            {
                this.Visible = false;
            }
            if (this.m_Owner is Item && !((Agent)this.m_Owner).InWorld)
            {
                if (this.X < 2)
                {
                    this.X = 2;
                }
                else if (this.X + this.Width > Engine.ScreenWidth - 2)
                {
                    this.X = Engine.ScreenWidth - 2 - this.Width;
                }
                if (this.Y < 2)
                {
                    this.Y = 2;
                }
                else if (this.Y + this.Height > Engine.ScreenHeight - 2)
                {
                    this.Y = Engine.ScreenHeight - 2 - this.Height;
                }
            }
            else
            {
                if (this.X < Engine.GameX + 2)
                {
                    this.X = Engine.GameX + 2;
                }
                else if (this.X + this.Width > Engine.GameX + Engine.GameWidth - 2)
                {
                    this.X = Engine.GameX + Engine.GameWidth - 2 - this.Width;
                }
                if (this.Y < Engine.GameY + 2)
                {
                    this.Y = Engine.GameY + 2;
                }
                else if (this.Y + this.Height > Engine.GameY + Engine.GameHeight - 2)
                {
                    this.Y = Engine.GameY + Engine.GameHeight - 2 - this.Height;
                }
            }
            this.m_Rectangle.X      = this.X;
            this.m_Rectangle.Y      = this.Y;
            this.m_Rectangle.Width  = this.Width;
            this.m_Rectangle.Height = this.Height;
            this.m_ImageRect.X      = this.X + this.Image.xMin;
            this.m_ImageRect.Y      = this.Y + this.Image.yMin;
            this.m_ImageRect.Width  = this.Image.xMax - this.Image.xMin + 1;
            this.m_ImageRect.Height = this.Image.yMax - this.Image.yMin + 1;
            return(this.m_Rectangle);
        }