예제 #1
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),
                 }
             }
         },
     };
 }
예제 #2
0
        public ProfileHeader(User user)
        {
            RelativeSizeAxes = Axes.X;
            Height           = cover_height + info_height;

            Children = new Drawable[]
            {
                coverContainer = new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = cover_height,
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f))
                        },
                        new Container
                        {
                            Anchor  = Anchor.BottomLeft,
                            Origin  = Anchor.BottomLeft,
                            Padding = new MarginPadding {
                                Left = UserProfileOverlay.CONTENT_X_MARGIN, Bottom = 20, Right = stats_width + UserProfileOverlay.CONTENT_X_MARGIN
                            },
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Children         = new Drawable[]
                            {
                                new UpdateableAvatar
                                {
                                    User         = user,
                                    Size         = new Vector2(avatar_size),
                                    Anchor       = Anchor.BottomLeft,
                                    Origin       = Anchor.BottomLeft,
                                    Masking      = true,
                                    CornerRadius = 5,
                                    EdgeEffect   = new EdgeEffectParameters
                                    {
                                        Type   = EdgeEffectType.Shadow,
                                        Colour = Color4.Black.Opacity(0.25f),
                                        Radius = 4,
                                    },
                                },
                                new Container
                                {
                                    Anchor       = Anchor.BottomLeft,
                                    Origin       = Anchor.BottomLeft,
                                    X            = avatar_size + 10,
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new Drawable[]
                                    {
                                        SupporterTag = new SupporterIcon
                                        {
                                            Alpha  = 0,
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft,
                                            Y      = -75,
                                            Size   = new Vector2(25, 25)
                                        },
                                        new FillFlowContainer
                                        {
                                            Direction    = FillDirection.Horizontal,
                                            AutoSizeAxes = Axes.Both,
                                            Anchor       = Anchor.BottomLeft,
                                            Origin       = Anchor.BottomLeft,
                                            Y            = -48,
                                            Children     = new Drawable[]
                                            {
                                                new OsuSpriteText
                                                {
                                                    Text     = user.Username,
                                                    Font     = @"Exo2.0-RegularItalic",
                                                    TextSize = 30,
                                                },
                                                new ExternalLinkButton($@"https://osu.ppy.sh/users/{user.Id}")
                                                {
                                                    Anchor = Anchor.BottomLeft,
                                                    Origin = Anchor.BottomLeft,
                                                    Margin = new MarginPadding {
                                                        Left = 3, Bottom = 3
                                                    },                                                   //To better lineup with the font
                                                },
                                            }
                                        },
                                        countryFlag = new DrawableFlag(user.Country)
                                        {
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft,
                                            Width  = 30,
                                            Height = 20
                                        }
                                    }
                                },
                                badgeContainer = new BadgeContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Origin           = Anchor.BottomLeft,
                                    Margin           = new MarginPadding {
                                        Bottom = 5
                                    },
                                    Alpha = 0,
                                },
                            }
                        },
                        colourBar = new Box
                        {
                            Anchor = Anchor.BottomLeft,
                            Origin = Anchor.BottomLeft,
                            X      = UserProfileOverlay.CONTENT_X_MARGIN,
                            Height = 5,
                            Width  = info_width,
                            Alpha  = 0
                        }
                    }
                },
                new Box // this is a temporary workaround for incorrect masking behaviour of FillMode.Fill used in UserCoverBackground (see https://github.com/ppy/osu-framework/issues/1675)
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = 1,
                    Y      = cover_height,
                    Colour = OsuColour.Gray(34),
                },
                infoTextLeft = new LinkFlowContainer(t => t.TextSize = 14)
                {
                    X                = UserProfileOverlay.CONTENT_X_MARGIN,
                    Y                = cover_height + 20,
                    Width            = info_width,
                    AutoSizeAxes     = Axes.Y,
                    ParagraphSpacing = 0.8f,
                    LineSpacing      = 0.2f
                },
                infoTextRight = new LinkFlowContainer(t =>
                {
                    t.TextSize = 14;
                    t.Font     = @"Exo2.0-RegularItalic";
                })
                {
                    X                = UserProfileOverlay.CONTENT_X_MARGIN + info_width + 20,
                    Y                = cover_height + 20,
                    Width            = info_width,
                    AutoSizeAxes     = Axes.Y,
                    ParagraphSpacing = 0.8f,
                    LineSpacing      = 0.2f
                },
                new Container
                {
                    X = -UserProfileOverlay.CONTENT_X_MARGIN,
                    RelativeSizeAxes = Axes.Y,
                    Width            = stats_width,
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Y        = level_position,
                            Height   = level_height,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = Color4.Black.Opacity(0.5f),
                                    RelativeSizeAxes = Axes.Both
                                },
                                levelBadge = new Sprite
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Height = 50,
                                    Width  = 50,
                                    Alpha  = 0
                                },
                                levelText = new OsuSpriteText
                                {
                                    Anchor   = Anchor.TopCentre,
                                    Origin   = Anchor.TopCentre,
                                    Y        = 11,
                                    TextSize = 20
                                }
                            }
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Y        = cover_height,
                            Anchor   = Anchor.TopCentre,
                            Origin   = Anchor.BottomCentre,
                            Height   = cover_height - level_height - level_position - 5,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = Color4.Black.Opacity(0.5f),
                                    RelativeSizeAxes = Axes.Both
                                },
                                scoreText = new FillFlowContainer <SpriteText>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding {
                                        Horizontal = 20, Vertical = 18
                                    },
                                    Spacing = new Vector2(0, 2)
                                },
                                scoreNumberText = new FillFlowContainer <SpriteText>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding {
                                        Horizontal = 20, Vertical = 18
                                    },
                                    Spacing = new Vector2(0, 2)
                                },
                                new FillFlowContainer <GradeBadge>
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Anchor       = Anchor.BottomCentre,
                                    Origin       = Anchor.BottomCentre,
                                    Y            = -64,
                                    Spacing      = new Vector2(20, 0),
                                    Children     = new[]
                                    {
                                        gradeSSPlus = new GradeBadge("SSPlus")
                                        {
                                            Alpha = 0
                                        },
                                        gradeSS = new GradeBadge("SS")
                                        {
                                            Alpha = 0
                                        },
                                    }
                                },
                                new FillFlowContainer <GradeBadge>
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Anchor       = Anchor.BottomCentre,
                                    Origin       = Anchor.BottomCentre,
                                    Y            = -18,
                                    Spacing      = new Vector2(20, 0),
                                    Children     = new[]
                                    {
                                        gradeSPlus = new GradeBadge("SPlus")
                                        {
                                            Alpha = 0
                                        },
                                        gradeS = new GradeBadge("S")
                                        {
                                            Alpha = 0
                                        },
                                        gradeA = new GradeBadge("A")
                                        {
                                            Alpha = 0
                                        },
                                    }
                                }
                            }
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Anchor           = Anchor.BottomCentre,
                            Origin           = Anchor.BottomCentre,
                            Height           = info_height - 15,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = Color4.Black.Opacity(0.25f),
                                    RelativeSizeAxes = Axes.Both
                                },
                                rankGraph = new RankGraph
                                {
                                    RelativeSizeAxes = Axes.Both
                                }
                            }
                        }
                    }
                }
            };
        }
예제 #3
0
        public ProfileHeader(User user)
        {
            RelativeSizeAxes = Axes.X;
            Height           = cover_height + info_height;

            Children = new Drawable[]
            {
                coverContainer = new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = cover_height,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f))
                        },
                        new Container
                        {
                            Anchor       = Anchor.BottomLeft,
                            Origin       = Anchor.BottomLeft,
                            X            = UserProfileOverlay.CONTENT_X_MARGIN,
                            Y            = -20,
                            AutoSizeAxes = Axes.Both,
                            Children     = new Drawable[]
                            {
                                new UpdateableAvatar
                                {
                                    User         = user,
                                    Size         = new Vector2(avatar_size),
                                    Anchor       = Anchor.BottomLeft,
                                    Origin       = Anchor.BottomLeft,
                                    Masking      = true,
                                    CornerRadius = 5,
                                    EdgeEffect   = new EdgeEffectParameters
                                    {
                                        Type   = EdgeEffectType.Shadow,
                                        Colour = Color4.Black.Opacity(0.25f),
                                        Radius = 4,
                                    },
                                },
                                new Container
                                {
                                    Anchor       = Anchor.BottomLeft,
                                    Origin       = Anchor.BottomLeft,
                                    X            = avatar_size + 10,
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new Drawable[]
                                    {
                                        supporterTag = new CircularContainer
                                        {
                                            Anchor          = Anchor.BottomLeft,
                                            Origin          = Anchor.BottomLeft,
                                            Y               = -75,
                                            Size            = new Vector2(25, 25),
                                            Masking         = true,
                                            BorderThickness = 3,
                                            BorderColour    = Color4.White,
                                            Alpha           = 0,
                                            Children        = new Drawable[]
                                            {
                                                new Box
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Alpha            = 0,
                                                    AlwaysPresent    = true
                                                },
                                                new SpriteIcon
                                                {
                                                    Icon   = FontAwesome.fa_heart,
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Size   = new Vector2(12),
                                                }
                                            }
                                        },
                                        new LinkFlowContainer.ProfileLink(user)
                                        {
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft,
                                            Y      = -48,
                                        },
                                        countryFlag = new DrawableFlag(user.Country?.FlagName)
                                        {
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft,
                                            Width  = 30,
                                            Height = 20
                                        }
                                    }
                                }
                            }
                        },
                        colourBar = new Box
                        {
                            Anchor = Anchor.BottomLeft,
                            Origin = Anchor.BottomLeft,
                            X      = UserProfileOverlay.CONTENT_X_MARGIN,
                            Height = 5,
                            Width  = info_width,
                            Alpha  = 0
                        }
                    }
                },
                infoTextLeft = new OsuTextFlowContainer(t =>
                {
                    t.TextSize = 14;
                    t.Alpha    = 0.8f;
                })
                {
                    X                = UserProfileOverlay.CONTENT_X_MARGIN,
                    Y                = cover_height + 20,
                    Width            = info_width,
                    AutoSizeAxes     = Axes.Y,
                    ParagraphSpacing = 0.8f,
                    LineSpacing      = 0.2f
                },
                infoTextRight = new LinkFlowContainer(t =>
                {
                    t.TextSize = 14;
                    t.Font     = @"Exo2.0-RegularItalic";
                })
                {
                    X                = UserProfileOverlay.CONTENT_X_MARGIN + info_width + 20,
                    Y                = cover_height + 20,
                    Width            = info_width,
                    AutoSizeAxes     = Axes.Y,
                    ParagraphSpacing = 0.8f,
                    LineSpacing      = 0.2f
                },
                new Container
                {
                    X = -UserProfileOverlay.CONTENT_X_MARGIN,
                    RelativeSizeAxes = Axes.Y,
                    Width            = 280,
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Y        = level_position,
                            Height   = level_height,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = Color4.Black.Opacity(0.5f),
                                    RelativeSizeAxes = Axes.Both
                                },
                                levelBadge = new Sprite
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Height = 50,
                                    Width  = 50,
                                    Alpha  = 0
                                },
                                levelText = new OsuSpriteText
                                {
                                    Anchor   = Anchor.TopCentre,
                                    Origin   = Anchor.TopCentre,
                                    Y        = 11,
                                    TextSize = 20
                                }
                            }
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Y        = cover_height,
                            Anchor   = Anchor.TopCentre,
                            Origin   = Anchor.BottomCentre,
                            Height   = cover_height - level_height - level_position - 5,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = Color4.Black.Opacity(0.5f),
                                    RelativeSizeAxes = Axes.Both
                                },
                                scoreText = new FillFlowContainer <SpriteText>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding {
                                        Horizontal = 20, Vertical = 18
                                    },
                                    Spacing = new Vector2(0, 2)
                                },
                                scoreNumberText = new FillFlowContainer <SpriteText>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding {
                                        Horizontal = 20, Vertical = 18
                                    },
                                    Spacing = new Vector2(0, 2)
                                },
                                new FillFlowContainer <GradeBadge>
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Anchor       = Anchor.BottomCentre,
                                    Origin       = Anchor.BottomCentre,
                                    Y            = -64,
                                    Spacing      = new Vector2(20, 0),
                                    Children     = new[]
                                    {
                                        gradeSSPlus = new GradeBadge("SSPlus")
                                        {
                                            Alpha = 0
                                        },
                                        gradeSS = new GradeBadge("SS")
                                        {
                                            Alpha = 0
                                        },
                                    }
                                },
                                new FillFlowContainer <GradeBadge>
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Anchor       = Anchor.BottomCentre,
                                    Origin       = Anchor.BottomCentre,
                                    Y            = -18,
                                    Spacing      = new Vector2(20, 0),
                                    Children     = new[]
                                    {
                                        gradeSPlus = new GradeBadge("SPlus")
                                        {
                                            Alpha = 0
                                        },
                                        gradeS = new GradeBadge("S")
                                        {
                                            Alpha = 0
                                        },
                                        gradeA = new GradeBadge("A")
                                        {
                                            Alpha = 0
                                        },
                                    }
                                }
                            }
                        },
                        chartContainer = new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Anchor           = Anchor.BottomCentre,
                            Origin           = Anchor.BottomCentre,
                            Height           = info_height - 15,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = Color4.Black.Opacity(0.25f),
                                    RelativeSizeAxes = Axes.Both
                                }
                            }
                        }
                    }
                }
            };
        }