Beispiel #1
0
        public TestCaseUserProfile()
        {
            var profile = new UserProfileOverlay();

            Add(profile);

            AddStep("Show offline dummy", () => profile.ShowUser(new User
            {
                Username = @"Somebody",
                Id       = 1,
                Country  = new Country {
                    FullName = @"Alien"
                },
                CoverUrl     = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg",
                JoinDate     = DateTimeOffset.Now.AddDays(-1),
                LastVisit    = DateTimeOffset.Now,
                Age          = 1,
                ProfileOrder = new[] { "me" },
                CountryRank  = 1,
                Statistics   = new UserStatistics
                {
                    Rank = 2148,
                    PP   = 4567.89m
                },
                AllRankHistories = new User.RankHistories
                {
                    Osu = new User.RankHistory
                    {
                        Mode = @"osu",
                        Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray()
                    }
                }
            }, false));
            AddStep("Show ppy", () => profile.ShowUser(new User
            {
                Username = @"peppy",
                Id       = 2,
                Country  = new Country {
                    FullName = @"Australia", FlagName = @"AU"
                },
                CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
            }));
            AddStep("Show flyte", () => profile.ShowUser(new User
            {
                Username = @"flyte",
                Id       = 3103765,
                Country  = new Country {
                    FullName = @"Japan", FlagName = @"JP"
                },
                CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
            }));
            AddStep("Hide", profile.Hide);
            AddStep("Show without reload", profile.Show);
        }
Beispiel #2
0
        private void load(UserProfileOverlay profileOverlay)
        {
            LeftFlowContainer.Add(new BeatmapMetadataContainer(beatmap));
            LeftFlowContainer.Add(new FillFlowContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Direction        = FillDirection.Horizontal,
                Children         = new Drawable[]
                {
                    new OsuSpriteText
                    {
                        Text = @"mapped by ",
                        Font = OsuFont.GetFont(size: 12)
                    },
                    mapperContainer = new OsuHoverContainer
                    {
                        AutoSizeAxes = Axes.Both,
                        Children     = new Drawable[]
                        {
                            new OsuSpriteText
                            {
                                Text = beatmap.Metadata.AuthorString,
                                Font = OsuFont.GetFont(size: 12, weight: FontWeight.Medium, italics: true)
                            }
                        }
                    },
                }
            });

            RightFlowContainer.Add(new FillFlowContainer
            {
                Anchor       = Anchor.TopRight,
                Origin       = Anchor.TopRight,
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Horizontal,
                Children     = new[]
                {
                    new OsuSpriteText
                    {
                        Anchor = Anchor.BottomRight,
                        Origin = Anchor.BottomRight,
                        Text   = playCount.ToString(),
                        Font   = OsuFont.GetFont(size: 18, weight: FontWeight.SemiBold, italics: true)
                    },
                    new OsuSpriteText
                    {
                        Anchor = Anchor.BottomRight,
                        Origin = Anchor.BottomRight,
                        Text   = @"times played ",
                        Font   = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true)
                    },
                }
            });

            if (profileOverlay != null)
            {
                mapperContainer.Action = () => profileOverlay.ShowUser(beatmap.BeatmapSet.Metadata.Author);
            }
        }
Beispiel #3
0
        private void load(OsuColour colours, UserProfileOverlay profile)
        {
            Status.ValueChanged += displayStatus;
            Status.ValueChanged += status => statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);

            base.Action = () =>
            {
                Action?.Invoke();
                profile?.ShowUser(user);
            };
        }
Beispiel #4
0
        private void load(UserProfileOverlay profile)
        {
            clickableArea.Action = () =>
            {
                if (avatar.User != null)
                {
                    profile?.ShowUser(avatar.User);
                }
            };

            updateDisplay();
        }
Beispiel #5
0
        private void load(OsuColour colours, UserProfileOverlay profile)
        {
            if (colours == null)
            {
                throw new ArgumentNullException(nameof(colours));
            }

            Status.ValueChanged += displayStatus;
            Status.ValueChanged += status => statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);

            base.Action = ViewProfile = () =>
            {
                Action?.Invoke();
                profile?.ShowUser(user);
            };
        }
 protected override bool OnClick(InputState state)
 {
     profile?.ShowUser(user);
     return(true);
 }
Beispiel #7
0
 /// <summary>
 /// Show a user's profile as an overlay.
 /// </summary>
 /// <param name="userId">The user to display.</param>
 public void ShowUser(long userId) => userProfile.ShowUser(userId);
Beispiel #8
0
 private void load(UserProfileOverlay profile)
 {
     Action = () => profile?.ShowUser(sender);
 }
Beispiel #9
0
 protected override bool OnClick(ClickEvent e)
 {
     profile?.ShowUser(user);
     return(true);
 }
Beispiel #10
0
        private void load(OsuColour colours, UserProfileOverlay profile)
        {
            if (colours == null)
            {
                throw new ArgumentNullException(nameof(colours));
            }

            FillFlowContainer infoContainer;

            UserCoverBackground coverBackground;

            AddInternal(content = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Masking          = true,
                CornerRadius     = 5,
                EdgeEffect       = new EdgeEffectParameters
                {
                    Type   = EdgeEffectType.Shadow,
                    Colour = Color4.Black.Opacity(0.25f),
                    Radius = 4,
                },

                Children = new Drawable[]
                {
                    new DelayedLoadWrapper(coverBackground = new UserCoverBackground(user)
                    {
                        RelativeSizeAxes = Axes.Both,
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        FillMode         = FillMode.Fill,
                    }, 300)
                    {
                        RelativeSizeAxes = Axes.Both
                    },
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4.Black.Opacity(0.7f),
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Padding          = new MarginPadding {
                            Top = content_padding, Horizontal = content_padding
                        },
                        Children = new Drawable[]
                        {
                            new UpdateableAvatar
                            {
                                Size         = new Vector2(height - status_height - content_padding * 2),
                                User         = user,
                                Masking      = true,
                                CornerRadius = 5,
                                OpenOnClick  = { Value = false },
                                EdgeEffect   = new EdgeEffectParameters
                                {
                                    Type   = EdgeEffectType.Shadow,
                                    Colour = Color4.Black.Opacity(0.25f),
                                    Radius = 4,
                                },
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding {
                                    Left = height - status_height - content_padding
                                },
                                Children = new Drawable[]
                                {
                                    new OsuSpriteText
                                    {
                                        Text = user.Username,
                                        Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 18, italics: true),
                                    },
                                    infoContainer = new FillFlowContainer
                                    {
                                        Anchor       = Anchor.BottomLeft,
                                        Origin       = Anchor.BottomLeft,
                                        AutoSizeAxes = Axes.X,
                                        Height       = 20f,
                                        Direction    = FillDirection.Horizontal,
                                        Spacing      = new Vector2(5f, 0f),
                                        Children     = new Drawable[]
                                        {
                                            new DrawableFlag(user.Country)
                                            {
                                                Width            = 30f,
                                                RelativeSizeAxes = Axes.Y,
                                            },
                                        },
                                    },
                                },
                            },
                        },
                    },
                    statusBar = new Container
                    {
                        Anchor           = Anchor.BottomLeft,
                        Origin           = Anchor.BottomLeft,
                        RelativeSizeAxes = Axes.X,
                        Alpha            = 0f,
                        Children         = new Drawable[]
                        {
                            statusBg = new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Alpha            = 0.5f,
                            },
                            new FillFlowContainer
                            {
                                Anchor       = Anchor.Centre,
                                Origin       = Anchor.Centre,
                                AutoSizeAxes = Axes.Both,
                                Spacing      = new Vector2(5f, 0f),
                                Children     = new Drawable[]
                                {
                                    new SpriteIcon
                                    {
                                        Anchor = Anchor.CentreLeft,
                                        Origin = Anchor.CentreLeft,
                                        Icon   = FontAwesome.Regular.Circle,
                                        Shadow = true,
                                        Size   = new Vector2(14),
                                    },
                                    statusMessage = new OsuSpriteText
                                    {
                                        Anchor = Anchor.CentreLeft,
                                        Origin = Anchor.CentreLeft,
                                        Font   = OsuFont.GetFont(weight: FontWeight.SemiBold),
                                    },
                                },
                            },
                        },
                    },
                }
            });

            coverBackground.OnLoadComplete += d => d.FadeInFromZero(400, Easing.Out);

            if (user.IsSupporter)
            {
                infoContainer.Add(new SupporterIcon
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 20f,
                });
            }

            Status.ValueChanged += status => displayStatus(status.NewValue);
            Status.ValueChanged += status => statusBg.FadeColour(status.NewValue?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);

            base.Action = ViewProfile = () =>
            {
                Action?.Invoke();
                profile?.ShowUser(user);
            };
        }
Beispiel #11
0
 private void load(OsuColour colours, UserProfileOverlay profile)
 {
     customUsernameColour = colours.ChatBlue;
     loadProfile          = u => profile?.ShowUser(u);
 }
Beispiel #12
0
 private void load(UserProfileOverlay profile)
 {
     this.profile         = profile;
     clickableArea.Action = () => profile?.ShowUser(avatar.User);
 }
Beispiel #13
0
        private void load(UserProfileOverlay profile)
        {
            if (colours == null)
            {
                throw new InvalidOperationException($"{nameof(colours)} not initialized!");
            }

            FillFlowContainer infoContainer;

            AddInternal(content = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Masking          = true,
                CornerRadius     = 5,
                EdgeEffect       = new EdgeEffectParameters
                {
                    Type   = EdgeEffectType.Shadow,
                    Colour = Color4.Black.Opacity(0.25f),
                    Radius = 4,
                },

                Children = new Drawable[]
                {
                    new DelayedLoadUnloadWrapper(() => new UserCoverBackground
                    {
                        RelativeSizeAxes = Axes.Both,
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        User             = user,
                    }, 300, 5000)
                    {
                        RelativeSizeAxes = Axes.Both,
                    },
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4.Black.Opacity(0.7f),
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Padding          = new MarginPadding {
                            Top = content_padding, Horizontal = content_padding
                        },
                        Children = new Drawable[]
                        {
                            new UpdateableAvatar
                            {
                                Size         = new Vector2(height - status_height - content_padding * 2),
                                User         = user,
                                Masking      = true,
                                CornerRadius = 5,
                                OpenOnClick  = { Value = false },
                                EdgeEffect   = new EdgeEffectParameters
                                {
                                    Type   = EdgeEffectType.Shadow,
                                    Colour = Color4.Black.Opacity(0.25f),
                                    Radius = 4,
                                },
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding {
                                    Left = height - status_height - content_padding
                                },
                                Children = new Drawable[]
                                {
                                    new OsuSpriteText
                                    {
                                        Text = user.Username,
                                        Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 18, italics: true),
                                    },
                                    infoContainer = new FillFlowContainer
                                    {
                                        Anchor       = Anchor.BottomLeft,
                                        Origin       = Anchor.BottomLeft,
                                        AutoSizeAxes = Axes.X,
                                        Height       = 20f,
                                        Direction    = FillDirection.Horizontal,
                                        Spacing      = new Vector2(5f, 0f),
                                        Children     = new Drawable[]
                                        {
                                            new UpdateableFlag(user.Country)
                                            {
                                                Width            = 30f,
                                                RelativeSizeAxes = Axes.Y,
                                            },
                                        },
                                    },
                                },
                            },
                        },
                    },
                    statusBar = new Container
                    {
                        Anchor           = Anchor.BottomLeft,
                        Origin           = Anchor.BottomLeft,
                        RelativeSizeAxes = Axes.X,
                        Alpha            = 0f,
                        Children         = new Drawable[]
                        {
                            statusBg = new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Alpha            = 0.5f,
                            },
                            new FillFlowContainer
                            {
                                Anchor       = Anchor.Centre,
                                Origin       = Anchor.Centre,
                                AutoSizeAxes = Axes.Both,
                                Spacing      = new Vector2(5f, 0f),
                                Children     = new Drawable[]
                                {
                                    new SpriteIcon
                                    {
                                        Anchor = Anchor.CentreLeft,
                                        Origin = Anchor.CentreLeft,
                                        Icon   = FontAwesome.Regular.Circle,
                                        Shadow = true,
                                        Size   = new Vector2(14),
                                    },
                                    statusMessage = new OsuSpriteText
                                    {
                                        Anchor = Anchor.CentreLeft,
                                        Origin = Anchor.CentreLeft,
                                        Font   = OsuFont.GetFont(weight: FontWeight.SemiBold),
                                    },
                                },
                            },
                        },
                    },
                }
            });

            if (user.IsSupporter)
            {
                infoContainer.Add(new SupporterIcon
                {
                    Height       = 20f,
                    SupportLevel = user.SupportLevel
                });
            }

            Status.ValueChanged   += status => displayStatus(status.NewValue, Activity.Value);
            Activity.ValueChanged += activity => displayStatus(Status.Value, activity.NewValue);

            base.Action = ViewProfile = () =>
            {
                Action?.Invoke();
                profile?.ShowUser(user);
            };
        }