示例#1
0
        private void ProcessHtmlGump(int thisPage, int x, int y, int width, int height, string text, bool hasBack, bool hasScroll, int color)
        {
            UnicodeFont uniFont = Engine.GetUniFont(1);

            if (!hasScroll)
            {
                if (hasBack)
                {
                    GServerBackground gserverBackground = new GServerBackground(this, x, y, width, height, 3004, true);
                    GHtmlLabel        ghtmlLabel        = new GHtmlLabel(text, uniFont, color, gserverBackground.OffsetX - 2, gserverBackground.OffsetY - 1, gserverBackground.UseWidth);
                    ghtmlLabel.Scissor(0, 0, ghtmlLabel.Width, gserverBackground.UseHeight);
                    gserverBackground.Children.Add((Gump)ghtmlLabel);
                    this.Pages(thisPage).Add((Gump)gserverBackground);
                }
                else
                {
                    GHtmlLabel ghtmlLabel = new GHtmlLabel(text, uniFont, color, x - 2, y - 1, width);
                    ghtmlLabel.Scissor(0, 0, ghtmlLabel.Width, height);
                    this.Pages(thisPage).Add((Gump)ghtmlLabel);
                }
            }
            else
            {
                width -= 15;
                GHtmlLabel ghtmlLabel;
                int        num;
                if (hasBack)
                {
                    GServerBackground gserverBackground = new GServerBackground(this, x, y, width, height, 3004, true);
                    ghtmlLabel = new GHtmlLabel(text, uniFont, color, gserverBackground.OffsetX - 2, gserverBackground.OffsetY - 1, gserverBackground.UseWidth);
                    ghtmlLabel.Scissor(0, 0, ghtmlLabel.Width, num = gserverBackground.UseHeight);
                    gserverBackground.Children.Add((Gump)ghtmlLabel);
                    this.Pages(thisPage).Add((Gump)gserverBackground);
                }
                else
                {
                    ghtmlLabel = new GHtmlLabel(text, uniFont, color, x - 2, y - 1, width);
                    ghtmlLabel.Scissor(0, 0, ghtmlLabel.Width, num = height);
                    this.Pages(thisPage).Add((Gump)ghtmlLabel);
                }
                if (height >= 27 && ghtmlLabel.Height > num)
                {
                    this.Pages(thisPage).Add((Gump) new GImage(257, x + width, y));
                    this.Pages(thisPage).Add((Gump) new GImage((int)byte.MaxValue, x + width, y + height - 32));
                    int y1 = y + 30;
                    while (y1 + 32 < y + height)
                    {
                        this.Pages(thisPage).Add((Gump) new GImage(256, x + width, y1));
                        y1 += 30;
                    }
                    GVSlider gvSlider = new GVSlider(254, x + width + 1, y + 1 + 12, 13, height - 2 - 24, 0.0, 0.0, (double)(ghtmlLabel.Height - num), 1.0);
                    gvSlider.SetTag("yBase", (object)ghtmlLabel.Y);
                    gvSlider.SetTag("toScroll", (object)ghtmlLabel);
                    gvSlider.SetTag("viewHeight", (object)num);
                    gvSlider.OnValueChange = new OnValueChange(this.OnScroll);
                    this.Pages(thisPage).Add((Gump)gvSlider);
                    this.Pages(thisPage).Add((Gump) new GHotspot(x + width, y, 15, height, (Gump)gvSlider));
                }
                else
                {
                    this.Pages(thisPage).Add((Gump) new GImage(257, x + width, y));
                    this.Pages(thisPage).Add((Gump) new GImage((int)byte.MaxValue, x + width, y + height - 32));
                    int y1 = y + 30;
                    while (y1 + 32 < y + height)
                    {
                        this.Pages(thisPage).Add((Gump) new GImage(256, x + width, y1));
                        y1 += 30;
                    }
                    this.Pages(thisPage).Add((Gump) new GImage(254, Hues.Grayscale, x + width + 1, y + 1));
                }
            }
        }
示例#2
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);
                 }
             }
         }
     }
 }