示例#1
0
 public override void Draw(IDrawAPI drawAPI)
 {
     if (drawAPI is VertexBatch v)
     {
         if (paddingBorderInfo == null)
         {
             paddingBorderInfo = Border.GetPaddingBorderDrawInfo(v.primitiveType, position, width, height, roundCorner, paddingColor, quality);
         }
         if (borderColor != default && borderInfo == null)
         {
             borderInfo = Border.GetBorderDrawInfo(PrimitiveType.LineStrip, position, width, height, roundCorner, borderColor, quality);
             borderInfo.primitiveType = PrimitiveType.LineStrip;
         }
         if (shadowColor != default)
         {
             for (int i = 0; i < 6 / shadowDepth; i++)
             {
                 v.Draw(paddingBorderInfo.Transform(delegate(int z, Vertex v)
                 {
                     return(new Vertex(v.Position.XY() + new Vector2(0, i * 2), shadowColor * 0.05f));
                 }));
             }
         }
         v.Draw(paddingBorderInfo);
         font?.DrawString(v, text, position + new Vector2(width, height) / 2, textColor, CenterType.MiddleCenter, textScale);
         if (highLightTimer != 0)
         {
             v.Draw(paddingBorderInfo.Transform(delegate(int z, Vertex v)
             {
                 return(new Vertex(v.Position, highLightColor * 0.2f * highLightTimer));
             }));
         }
         if (rippleTimer > 0)
         {
             Ripple.DrawRound(v, (int)Helper.Lerp(2 * width + height, 0, 3 + rippleTimer * 0.75f, 4), position, ripplePos, width, height, Color.Transparent.LerpTo(rippleColor, rippleTimer, 1), roundCorner, 1, quality * 3);
         }
         rippleTimer *= 0.95f;
         if (rippleTimer < 0.01f)
         {
             rippleTimer = 0;
         }
         if (borderInfo != null)
         {
             v.Draw(borderInfo);
         }
     }
 }
示例#2
0
 public void Refresh()
 {
     paddingBorderInfo = null;
     borderInfo        = null;
 }