public override void Draw(CanvasAnimatedDrawEventArgs args)
        {
            base.Draw(args);

            // strings
            float fCurrentY = StringsPosition.Y;

            for (int i = 0; i < Strings.Count - 1; i++)
            {
                RichString str = Strings[i].ToRichString();
                str.Draw(args, new Vector2(StringsPosition.X, fCurrentY), StringsFont);
                fCurrentY += (float)StringsTextLayout.LayoutBounds.Height;
            }

            // bar below strings
            args.DrawingSession.DrawLine(BarUnderStringsLeft, BarUnderStringsRight, Colors.White);

            if (Strings.Count > 0)
            {
                RichString str = Strings[Strings.Count - 1].ToRichString();

                // prominent string
                str.Draw(args, ProminentStringPosition, ProminentStringFont);

                // debug
                //CanvasTextLayout layout = new CanvasTextLayout(args.DrawingSession.Device, str.String, ProminentStringFont, 0, 0);
                //Statics.MaxStringWidth = ((int)layout.LayoutBounds.Width > Statics.MaxStringWidth) ? (int)layout.LayoutBounds.Width : Statics.MaxStringWidth;
            }
        }
        public RichString ToRichString()
        {
            RichString rs = new RichString(new RichStringPart(Winner.Name + " ", Winner.Color));
            rs.Add(new RichStringPart(DefeatString + " "));
            rs.Add(new RichStringPart(Loser.Name, Loser.Color));

            return rs;
        }
Example #3
0
        public RichString ToRichString()
        {
            RichString rs = new RichString(new RichStringPart(Winner.Name + " ", Winner.Color));

            rs.Add(new RichStringPart(DefeatString + " "));
            rs.Add(new RichStringPart(Loser.Name, Loser.Color));

            return(rs);
        }
        public void Add(RichString str)
        {
            if (str == null) { return; }

            Strings.Add(str);
            if (Strings.Count > MaxStrings)
            {
                Strings.RemoveAt(0);
            }
        }
        public void Add(RichString str)
        {
            if (str == null)
            {
                return;
            }

            Strings.Add(str);
            if (Strings.Count > MaxStrings)
            {
                Strings.RemoveAt(0);
            }
        }
        public override void Draw(CanvasAnimatedDrawEventArgs args)
        {
            base.Draw(args);

            // draw leaders
            int i = 0;

            for (i = 0; i < Leaders.Count; i++)
            {
                RichString str = Leaders[i].ToRichString();

                //CanvasTextLayout layout = new CanvasTextLayout(args.DrawingSession, str.String, LeadersFont, 0, 0);
                float x = Padding + Position.X;// + (Width - str.Width) / 2;

                str.Draw(args,
                         new Vector2(x, LeadersPosition.Y + i * (float)LeadersTextLayout.LayoutBounds.Height),
                         LeadersFont);
            }

            // draw first column of strings
            float fCurrentY = StringsPosition.Y;

            i = 0;
            while ((fCurrentY + (float)StringsTextLayout.LayoutBounds.Height) < MaxY && i < Strings.Count)
            {
                RichString str = Strings[i].ToRichString();
                str.Draw(args, new Vector2(StringsPosition.X, fCurrentY), StringsFont);
                fCurrentY += (float)StringsTextLayout.LayoutBounds.Height;
                i++;
            }

            // set second column x position
            float fCurrentX = Position.X + Width / 2 + Padding;

            fCurrentY = StringsPosition.Y;

            // draw second column of strings
            while ((fCurrentY + (float)StringsTextLayout.LayoutBounds.Height) < MaxY && i < Strings.Count)
            {
                RichString str = Strings[i].ToRichString();
                str.Draw(args, new Vector2(fCurrentX, fCurrentY), StringsFont);
                fCurrentY += (float)StringsTextLayout.LayoutBounds.Height;
                i++;
            }
        }
 public bool Remove(RichString str)
 {
     return Strings.Remove(str);
 }
 public bool Remove(RichString str)
 {
     return(Strings.Remove(str));
 }