Exemplo n.º 1
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,
                            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 SupporterIcon
                                        {
                                            Alpha  = 0,
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft,
                                            Y      = -75,
                                            Size   = new Vector2(25, 25)
                                        },
                                        new ProfileLink(user)
                                        {
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft,
                                            Y      = -48,
                                        },
                                        countryFlag = new DrawableFlag(user.Country)
                                        {
                                            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)
                {
                    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
                                        },
                                    }
                                }
                            }
                        },
                        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
                                }
                            }
                        }
                    }
                }
            };
        }
Exemplo n.º 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
                                }
                            }
                        }
                    }
                }
            };
        }