Ejemplo n.º 1
0
        public DrawableScore(int index, APIScore score)
        {
            ScoreModsContainer modsContainer;

            RelativeSizeAxes = Axes.X;
            Height           = 30;
            CornerRadius     = 3;
            Masking          = true;
            Children         = new Drawable[]
            {
                background = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Alpha            = 0,
                },
                new OsuSpriteText
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    Text   = $"#{index + 1}",
                    Font   = @"Exo2.0-RegularItalic",
                    Margin = new MarginPadding {
                        Left = side_margin
                    }
                },
                new DrawableFlag(score.User.Country)
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    Size   = new Vector2(30, 20),
                    Margin = new MarginPadding {
                        Left = 60
                    }
                },
                new ClickableUsername
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    User   = score.User,
                    Margin = new MarginPadding {
                        Left = 100
                    }
                },
                modsContainer = new ScoreModsContainer
                {
                    Anchor               = Anchor.CentreLeft,
                    Origin               = Anchor.CentreLeft,
                    AutoSizeAxes         = Axes.Y,
                    RelativeSizeAxes     = Axes.X,
                    Width                = 0.06f,
                    RelativePositionAxes = Axes.X,
                    X = 0.42f
                },
                new DrawableRank(score.Rank)
                {
                    Anchor               = Anchor.CentreLeft,
                    Origin               = Anchor.CentreLeft,
                    Size                 = new Vector2(30, 20),
                    FillMode             = FillMode.Fit,
                    RelativePositionAxes = Axes.X,
                    X = 0.55f
                },
                new OsuSpriteText
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreRight,
                    Text   = $@"{score.TotalScore:N0}",
                    Font   = @"Venera",
                    RelativePositionAxes = Axes.X,
                    X          = 0.75f,
                    FixedWidth = true,
                },
                new OsuSpriteText
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreRight,
                    Text   = $@"{score.Accuracy:P2}",
                    Font   = @"Exo2.0-RegularItalic",
                    RelativePositionAxes = Axes.X,
                    X = 0.85f
                },
                new OsuSpriteText
                {
                    Anchor = Anchor.CentreRight,
                    Origin = Anchor.CentreRight,
                    Text   = $"{score.Statistics[HitResult.Great]}/{score.Statistics[HitResult.Good]}/{score.Statistics[HitResult.Meh]}",
                    Font   = @"Exo2.0-RegularItalic",
                    Margin = new MarginPadding {
                        Right = side_margin
                    }
                },
            };

            foreach (Mod mod in score.Mods)
            {
                modsContainer.Add(new ModIcon(mod)
                {
                    AutoSizeAxes = Axes.Both,
                    Scale        = new Vector2(0.35f),
                });
            }
        }
Ejemplo n.º 2
0
 public DrawableTopScore()
 {
     RelativeSizeAxes = Axes.X;
     Height           = height;
     CornerRadius     = 5;
     BorderThickness  = 4;
     Masking          = true;
     Children         = new Drawable[]
     {
         background = new Box
         {
             RelativeSizeAxes = Axes.Both,
             Alpha            = 0,
             AlwaysPresent    = true, //used for correct border representation
         },
         avatar = new UpdateableAvatar
         {
             Size         = new Vector2(avatar_size),
             Masking      = true,
             CornerRadius = 5,
             EdgeEffect   = new EdgeEffectParameters
             {
                 Type   = EdgeEffectType.Shadow,
                 Colour = Color4.Black.Opacity(0.25f),
                 Offset = new Vector2(0, 2),
                 Radius = 1,
             },
             Margin = new MarginPadding {
                 Top = margin, Left = margin
             }
         },
         flag = new DrawableFlag
         {
             Size     = new Vector2(30, 20),
             Position = new Vector2(margin * 2 + avatar_size, height / 4),
         },
         username = new ClickableUsername
         {
             Origin   = Anchor.BottomLeft,
             TextSize = 30,
             Position = new Vector2(margin * 2 + avatar_size, height / 4),
             Margin   = new MarginPadding {
                 Bottom = 4
             }
         },
         rankText = new OsuSpriteText
         {
             Anchor   = Anchor.TopRight,
             Origin   = Anchor.BottomRight,
             Text     = "#1",
             TextSize = 40,
             Font     = @"Exo2.0-BoldItalic",
             Y        = height / 4,
             Margin   = new MarginPadding {
                 Right = margin
             }
         },
         date = new OsuSpriteText
         {
             Anchor = Anchor.TopRight,
             Origin = Anchor.TopRight,
             Y      = height / 4,
             Margin = new MarginPadding {
                 Right = margin
             }
         },
         new Container
         {
             Anchor           = Anchor.BottomCentre,
             Origin           = Anchor.BottomCentre,
             RelativeSizeAxes = Axes.Both,
             Height           = 0.5f,
             Children         = new Drawable[]
             {
                 bottomBackground = new Box {
                     RelativeSizeAxes = Axes.Both
                 },
                 middleLine = new Box
                 {
                     RelativeSizeAxes = Axes.X,
                     Height           = 1,
                 },
                 rank = new DrawableRank(ScoreRank.F)
                 {
                     Origin   = Anchor.BottomLeft,
                     Size     = new Vector2(avatar_size, 40),
                     FillMode = FillMode.Fit,
                     Y        = height / 4,
                     Margin   = new MarginPadding {
                         Left = margin
                     }
                 },
                 new FillFlowContainer <InfoColumn>
                 {
                     Origin       = Anchor.BottomLeft,
                     AutoSizeAxes = Axes.Both,
                     Position     = new Vector2(height / 2, height / 4),
                     Direction    = FillDirection.Horizontal,
                     Spacing      = new Vector2(15, 0),
                     Children     = new[]
                     {
                         totalScore = new InfoColumn("Score"),
                         accuracy   = new InfoColumn("Accuracy"),
                         statistics = new InfoColumn("300/100/50"),
                     },
                 },
                 modsContainer = new ScoreModsContainer
                 {
                     AutoSizeAxes = Axes.Y,
                     Width        = 80,
                     Position     = new Vector2(height / 2, height / 4),
                 }
             }
         },
     };
 }