protected override void OnPaint(PaintEventArgs e)
        {
            Graphics labelGraphics = e.Graphics;

            labelGraphics.SmoothingMode     = smoothingMode;
            labelGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic;

            OutlineText m_OutlineText = new OutlineText();

            // Text colour, Outline colour, Thickness
            if (drawOutline)
            {
                m_OutlineText.TextOutline(ForeColor, outlineColor, outlineThickness);
            }
            else
            {
                m_OutlineText.TextNoOutline(ForeColor);
            }

            m_OutlineText.EnableShadow(drawShadow);
            m_OutlineText.SetNullShadow();

            if (m_OutlineText.IsShadowEnabled())
            {
                if (drawDiffusedShadow)
                {
                    m_OutlineText.DiffusedShadow(Color.FromArgb(150, 0, 0, 0), shadowThickness, new Point(shadowOffsetHorizontal, shadowOffsetVertical));
                }
                else
                {
                    m_OutlineText.Shadow(Color.FromArgb(150, 0, 0, 0), shadowThickness, new Point(shadowOffsetHorizontal, shadowOffsetVertical));
                }
            }

            if (drawGradient)
            {
                float fStartX = 0.0f;
                float fStartY = 0.0f;

                float fDestWidth  = 0.0f;
                float fDestHeight = 0.0f;

                m_OutlineText.MeasureString(labelGraphics, Font.FontFamily, FontStyle.Regular, FontHeight, Text, new Point(0, 0), StringFormat.GenericTypographic, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);

                LinearGradientBrush gradientBrush = new LinearGradientBrush(new Rectangle(0, 0, (int)fDestWidth, (int)fDestHeight),
                                                                            ForeColor, gradientEndColor, LinearGradientMode.Vertical);

                if (drawOutline)
                {
                    m_OutlineText.TextOutline(gradientBrush, outlineColor, outlineThickness);
                }
                else
                {
                    m_OutlineText.TextNoOutline(gradientBrush);
                }
            }

            m_OutlineText.DrawString(labelGraphics, Font.FontFamily, FontStyle.Regular, FontHeight, Text, new Point(0, 0), StringFormat.GenericTypographic);
        }
    // Use this for initialization
    void Start()
    {
        startTimer();
        FighterController[] fighters = FindObjectsOfType <FighterController>();
        player1 = fighters[0];
        player2 = fighters[1];
        if (fighters[1].playerID < player1.playerID)
        {
            player1 = fighters[1];
            player2 = fighters[0];
        }

        if (RoundManager.player1Wins == 1)
        {
            player1Win_1.fillAmount = 1;
            player1Win_2.fillAmount = 0;
        }
        else if (RoundManager.player1Wins == 0)
        {
            player1Win_1.fillAmount = 0;
            player1Win_2.fillAmount = 0;
        }
        else
        {
            player1Win_1.fillAmount = 0;
            player1Win_2.fillAmount = 0;
        }

        if (RoundManager.player2Wins == 1)
        {
            player2Win_1.fillAmount = 1;
            player2Win_2.fillAmount = 0;
        }
        else if (RoundManager.player2Wins == 0)
        {
            player2Win_1.fillAmount = 0;
            player2Win_2.fillAmount = 0;
        }
        else
        {
            player2Win_1.fillAmount = 0;
            player2Win_2.fillAmount = 0;
        }



        combo1Text = combo1Animator.gameObject.GetComponentInChildren <OutlineText>();
        combo2Text = combo2Animator.gameObject.GetComponentInChildren <OutlineText>();

        koText = FindObjectOfType <KOText>();
    }
Esempio n. 3
0
        public MyVersusPlayerMatchResults(Session session, VersusMatchResults matchResults, int playerIndex, Vector2 tweenFrom, Vector2 tweenTo, List <AwardInfo> awards) : base(session, matchResults, playerIndex, tweenFrom, tweenTo, awards)
        {
            if (session.MatchStats[playerIndex].Won)
            {
                PlayerWins[playerIndex]++;
            }

            if (PlayerWins[playerIndex] > 0)
            {
                winsText              = new OutlineText(TFGame.Font, PlayerWins[playerIndex].ToString(), this.gem.Position);
                winsText.Color        = Color.White;
                winsText.OutlineColor = Color.Black;
                this.Add(winsText);
            }
        }
        private Bitmap TextGradOutline()
        {
            OutlineText outlineText = new OutlineText();

            outlineText.TextGradOutline(ColorTranslator.FromHtml(modelItem.FontColor), Color.FromArgb(template.OutlineColor1), Color.FromArgb(template.OutlineColor2), template.OutlineThickness1);

            outlineText.EnableShadow(template.ShadowEnable);

            if (template.ShadowEnable)
            {
                outlineText.Shadow(Color.FromArgb(template.ShadowColor), template.ShadowThickness, new Point(template.ShadowOffsetX, template.ShadowOffsetY));
            }

            Graphics g = Graphics.FromImage(new Bitmap(1, 1));

            outlineText.MeasureString(g, fontFamily, FontStyle.Regular, modelItem.FontSize, modelItem.Text,
                                      new Point(0, 0), new StringFormat(), ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);

            fDestHeight++;

            Bitmap image = new Bitmap((int)(fStartX + fDestWidth), (int)(fStartY + fDestHeight));

            // FromImage method creates a new Graphics from the specified Image.
            Graphics graphics = Graphics.FromImage(image);

            graphics.SmoothingMode     = SmoothingMode.AntiAlias;
            graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;

            LinearGradientBrush gradientBrush = new LinearGradientBrush(new RectangleF(fStartX, fStartY, fDestWidth - (fStartX - 10), fDestHeight - (fStartY - 10)),
                                                                        ColorTranslator.FromHtml(modelItem.FontColor), Color.FromArgb(template.TextColor2), LinearGradientMode.Vertical);

            if (template.TextGradientEnable)
            {
                outlineText.TextGradOutline(gradientBrush, Color.FromArgb(template.OutlineColor1), Color.FromArgb(template.OutlineColor2), template.OutlineThickness1);
            }

            outlineText.DrawString(graphics, fontFamily, FontStyle.Regular, modelItem.FontSize, modelItem.Text, new Point(0, 0), new StringFormat());

            gradientBrush.Dispose();
            graphics.Dispose();
            g.Dispose();

            return(image);
        }