Example #1
0
 public void Remove(Rectangle rect)
 {
     for (int index = this.m_Count - 1; index >= 0; --index)
     {
         Rectangle rectangle = this.m_Rects[index];
         if (rect.IntersectsWith(rectangle))
         {
             this.InternalRemove(index);
             foreach (Rectangle rect1 in RectangleList.Punch(rectangle, rect))
             {
                 this.InternalAdd(rect1);
             }
         }
     }
 }
Example #2
0
 public void Add(Rectangle rect)
 {
     for (int index = 0; index < this.m_Count; ++index)
     {
         Rectangle rectangle = this.m_Rects[index];
         if (rect.IntersectsWith(rectangle))
         {
             foreach (Rectangle rect1 in RectangleList.Punch(rect, rectangle))
             {
                 this.Add(rect1);
             }
             return;
         }
     }
     this.InternalAdd(rect);
 }
Example #3
0
 protected internal override void Render(int X, int Y)
 {
     if (this.m_AlphaRegions.Count == 0)
     {
         base.Render(X, Y);
     }
     else
     {
         if (!this.m_Visible)
         {
             return;
         }
         int X1 = X + this.X;
         int Y1 = Y + this.Y;
         this.Draw(X1, Y1);
         Gump[]        array          = this.m_Children.ToArray();
         RectangleList rectangleList1 = new RectangleList();
         RectangleList rectangleList2 = new RectangleList();
         int           num            = 0;
         for (int index1 = 0; index1 < array.Length; ++index1)
         {
             Gump gump1 = array[index1];
             if (gump1 is GTransparentRegion)
             {
                 ++num;
             }
             else if (num >= this.m_AlphaRegions.Count)
             {
                 gump1.Render(X1, Y1);
             }
             else
             {
                 RectangleList rectangleList3 = rectangleList1;
                 Rectangle     b     = new Rectangle(gump1.X, gump1.Y, gump1.Width, gump1.Height);
                 Rectangle     rect1 = b;
                 rectangleList3.Add(rect1);
                 for (int index2 = num; index2 < this.m_AlphaRegions.Count; ++index2)
                 {
                     Gump gump2 = (Gump)this.m_AlphaRegions[index2];
                     if (gump2 is GTransparentRegion)
                     {
                         Rectangle rect2 = Rectangle.Intersect(new Rectangle(gump2.X, gump2.Y, gump2.Width, gump2.Height), b);
                         rectangleList1.Remove(rect2);
                         rectangleList2.Add(rect2);
                     }
                 }
                 if (rectangleList2.Count > 0)
                 {
                     for (int index2 = index1 + 1; index2 < array.Length; ++index2)
                     {
                         Gump gump2 = array[index2];
                         if (gump2 is GServerBackground)
                         {
                             GServerBackground gserverBackground = (GServerBackground)gump2;
                             Rectangle         rect2             = new Rectangle(gserverBackground.X + gserverBackground.OffsetX, gserverBackground.Y + gserverBackground.OffsetY, gserverBackground.UseWidth, gserverBackground.UseHeight);
                             rectangleList1.Remove(rect2);
                             rectangleList2.Remove(rect2);
                         }
                         else if (gump2 == this.m_AlphaRegions[this.m_AlphaRegions.Count - 1])
                         {
                             break;
                         }
                     }
                     if (rectangleList2.Count == 1 && rectangleList1.Count == 0)
                     {
                         Renderer.PushAlpha(0.5f);
                         gump1.Render(X1, Y1);
                         Renderer.PopAlpha();
                     }
                     else
                     {
                         for (int index2 = 0; index2 < rectangleList1.Count; ++index2)
                         {
                             Rectangle rectangle = rectangleList1[index2];
                             if (Renderer.SetViewport(X1 + rectangle.X, Y1 + rectangle.Y, rectangle.Width, rectangle.Height))
                             {
                                 gump1.Render(X1, Y1);
                             }
                         }
                         for (int index2 = 0; index2 < rectangleList2.Count; ++index2)
                         {
                             Rectangle rectangle = rectangleList2[index2];
                             if (Renderer.SetViewport(X1 + rectangle.X, Y1 + rectangle.Y, rectangle.Width, rectangle.Height))
                             {
                                 Renderer.PushAlpha(0.5f);
                                 gump1.Render(X1, Y1);
                                 Renderer.PopAlpha();
                             }
                         }
                         if (rectangleList1.Count > 0 || rectangleList2.Count > 0)
                         {
                             Renderer.SetViewport(0, 0, Engine.ScreenWidth, Engine.ScreenHeight);
                         }
                     }
                     rectangleList1.Clear();
                     rectangleList2.Clear();
                 }
                 else
                 {
                     gump1.Render(X1, Y1);
                 }
             }
         }
     }
 }