コード例 #1
0
ファイル: Screen.cs プロジェクト: 207h2Flogintvg/LGame
 public virtual void CreateUI(GLEx g)
 {
     if (isClose)
     {
         return;
     }
     if (replaceLoading)
     {
         if (replaceDstScreen == null
                 || !replaceDstScreen.IsOnLoadComplete())
         {
             Repaint(g);
         }
         else if (replaceDstScreen.IsOnLoadComplete())
         {
             if (isScreenFrom)
             {
                 Repaint(g);
                 if (replaceDstScreen.color != null)
                 {
                     g.SetColor(replaceDstScreen.color);
                     g.FillRect(dstPos.X(), dstPos.Y(), GetWidth(),
                             GetHeight());
                     g.ResetColor();
                 }
                 if (replaceDstScreen.currentScreen != null)
                 {
                     g.DrawTexture(replaceDstScreen.currentScreen,
                             dstPos.X(), dstPos.Y(), GetWidth(), GetHeight());
                 }
                 if (dstPos.X() != 0 || dstPos.Y() != 0)
                 {
                     g.SetClip(dstPos.X(), dstPos.Y(), GetWidth(),
                             GetHeight());
                     g.Translate(dstPos.X(), dstPos.Y());
                 }
                 replaceDstScreen.CreateUI(g);
                 if (dstPos.X() != 0 || dstPos.Y() != 0)
                 {
                     g.Translate(-dstPos.X(), -dstPos.Y());
                     g.ClearClip();
                 }
             }
             else
             {
                 if (replaceDstScreen.color != null)
                 {
                     g.SetColor(replaceDstScreen.color);
                     g.FillRect(0, 0, GetWidth(), GetHeight());
                     g.ResetColor();
                 }
                 if (replaceDstScreen.currentScreen != null)
                 {
                     g.DrawTexture(replaceDstScreen.currentScreen, 0, 0,
                             GetWidth(), GetHeight());
                 }
                 replaceDstScreen.CreateUI(g);
                 if (color != null)
                 {
                     g.SetColor(color);
                     g.FillRect(dstPos.X(), dstPos.Y(), GetWidth(),
                             GetHeight());
                     g.ResetColor();
                 }
                 if (GetBackground() != null)
                 {
                     g.DrawTexture(currentScreen, dstPos.X(), dstPos.Y(),
                             GetWidth(), GetHeight());
                 }
                 if (dstPos.X() != 0 || dstPos.Y() != 0)
                 {
                     g.SetClip(dstPos.X(), dstPos.Y(), GetWidth(),
                             GetHeight());
                     g.Translate(dstPos.X(), dstPos.Y());
                 }
                 Repaint(g);
                 if (dstPos.X() != 0 || dstPos.Y() != 0)
                 {
                     g.Translate(-dstPos.X(), -dstPos.Y());
                     g.ClearClip();
                 }
             }
         }
     }
     else
     {
         Repaint(g);
     }
 }
コード例 #2
0
ファイル: LComponent.cs プロジェクト: keppelcao/LGame
        public virtual void CreateUI(GLEx g)
        {
            if (isClose)
            {
                return;
            }
            if (!this.visible)
            {
                return;
            }
            int width = this.GetWidth();
            int height = this.GetHeight();

            if (rotation != 0)
            {
                float centerX = this.screenX + width / 2;
                float centerY = this.screenY + height / 2;
                g.Rotate(centerX, centerY, rotation);
            }
            else if (!(scaleX == 1f && scaleY == 1f))
            {
                g.Scale(scaleX, scaleY);
            }
            else if (this.elastic)
            {
                g.SetClip(this.screenX, this.screenY, width, height);
            }
            if (alpha > 0.1d && alpha < 1.0d)
            {
                g.SetAlpha(alpha);
                if (background != null)
                {
                    g.DrawTexture(background, this.screenX, this.screenY, width,
                            height);
                }
                if (this.customRendering)
                {
                    this.CreateCustomUI(g, this.screenX, this.screenY, width,
                            height);
                }
                else
                {
                    this.CreateUI(g, this.screenX, this.screenY, this, this.imageUI);
                }
                g.SetAlpha(1F);
            }
            else
            {
                if (background != null)
                {
                    g.DrawTexture(background, this.screenX, this.screenY, width,
                            height);
                }
                if (this.customRendering)
                {
                    this.CreateCustomUI(g, this.screenX, this.screenY, width,
                            height);
                }
                else
                {
                    this.CreateUI(g, this.screenX, this.screenY, this, this.imageUI);
                }
            }
            if (rotation != 0 || !(scaleX == 1f && scaleY == 1f))
            {
                g.Restore();
            }
            else if (this.elastic)
            {
                g.ClearClip();
            }
        }