示例#1
0
        private void updateInfo()
        {
            beatmapAuthor.Clear();

            var beatmap = Playlist.FirstOrDefault()?.Beatmap;

            if (beatmap != null)
            {
                beatmapAuthor.AddText("mapped by ", s => s.Colour = OsuColour.Gray(0.8f));
                beatmapAuthor.AddUserLink(beatmap.Value.Metadata.Author);
            }
        }
示例#2
0
        private void load(OsuColour colours)
        {
            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Horizontal,
                Spacing      = new Vector2(10, 0),
                Children     = new Drawable[]
                {
                    avatar = new UpdateableAvatar
                    {
                        Size         = new Vector2(50),
                        Masking      = true,
                        CornerRadius = 10,
                    },
                    new FillFlowContainer
                    {
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical,
                        Children     = new Drawable[]
                        {
                            new OsuSpriteText
                            {
                                Font    = OsuFont.GetFont(size: 30),
                                Current = { BindTarget = RoomName }
                            },
                            hostText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold))
                            {
                                AutoSizeAxes = Axes.Both,
                                Direction    = FillDirection.Horizontal,
                            }
                        }
                    }
                }
            };

            Host.BindValueChanged(host =>
            {
                avatar.User = host.NewValue;

                hostText.Clear();

                if (host.NewValue != null)
                {
                    hostText.AddText("hosted by ");
                    hostText.AddUserLink(host.NewValue);
                }
            }, true);
        }
示例#3
0
            public void UpdateText(List <LocalisableString> filters)
            {
                supporterRequiredText.Clear();

                supporterRequiredText.AddText(
                    BeatmapsStrings.ListingSearchSupporterFilterQuoteDefault(string.Join(" and ", filters), "").ToString(),
                    t =>
                {
                    t.Font   = OsuFont.GetFont(size: 16);
                    t.Colour = Colour4.White;
                }
                    );

                supporterRequiredText.AddLink(BeatmapsStrings.ListingSearchSupporterFilterQuoteLinkText.ToString(), @"/store/products/supporter-tag");
            }
示例#4
0
        private void load()
        {
            LinkFlowContainer beatmapAuthor;

            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes   = Axes.Both,
                Direction      = FillDirection.Horizontal,
                LayoutDuration = 100,
                Spacing        = new Vector2(5, 0),
                Children       = new Drawable[]
                {
                    new ModeTypeInfo(),
                    new Container
                    {
                        AutoSizeAxes = Axes.X,
                        Height       = 30,
                        Margin       = new MarginPadding {
                            Left = 5
                        },
                        Children = new Drawable[]
                        {
                            new BeatmapTitle(),
                            beatmapAuthor = new LinkFlowContainer(s => s.Font = s.Font.With(size: 14))
                            {
                                Anchor       = Anchor.BottomLeft,
                                Origin       = Anchor.BottomLeft,
                                AutoSizeAxes = Axes.Both
                            },
                        },
                    },
                }
            };

            CurrentItem.BindValueChanged(item =>
            {
                beatmapAuthor.Clear();

                var beatmap = item.NewValue?.Beatmap;

                if (beatmap != null)
                {
                    beatmapAuthor.AddText("制作者 ", s => s.Colour = OsuColour.Gray(0.8f));
                    beatmapAuthor.AddUserLink(beatmap.Metadata.Author);
                }
            }, true);
        }
示例#5
0
        private void load()
        {
            LinkFlowContainer beatmapAuthor;

            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes   = Axes.Both,
                Direction      = FillDirection.Horizontal,
                LayoutDuration = 100,
                Spacing        = new Vector2(5, 0),
                Children       = new Drawable[]
                {
                    new ModeTypeInfo(),
                    new Container
                    {
                        AutoSizeAxes = Axes.X,
                        Height       = 30,
                        Margin       = new MarginPadding {
                            Left = 5
                        },
                        Children = new Drawable[]
                        {
                            new BeatmapTitle(),
                            beatmapAuthor = new LinkFlowContainer(s => s.TextSize = 14)
                            {
                                Anchor       = Anchor.BottomLeft,
                                Origin       = Anchor.BottomLeft,
                                AutoSizeAxes = Axes.Both
                            },
                        },
                    },
                }
            };

            CurrentItem.BindValueChanged(item =>
            {
                beatmapAuthor.Clear();

                var beatmap = item?.Beatmap;

                if (beatmap != null)
                {
                    beatmapAuthor.AddText("mapped by ", s => s.Colour = OsuColour.Gray(0.8f));
                    beatmapAuthor.AddLink(beatmap.Metadata.Author.Username, null, LinkAction.OpenUserProfile, beatmap.Metadata.Author.Id.ToString(), "View Profile");
                }
            }, true);
        }
示例#6
0
        private void updateText()
        {
            // TODO: Refresh this text when new beatmaps are imported. Right now it won't get up-to-date suggestions.

            // Bounce should play every time the filter criteria is updated.
            this.ScaleTo(0.9f)
            .ScaleTo(1f, 1000, Easing.OutElastic);

            textFlow.Clear();

            if (beatmaps.QueryBeatmapSet(s => !s.Protected && !s.DeletePending) == null)
            {
                textFlow.AddParagraph("No beatmaps found!");
                textFlow.AddParagraph(string.Empty);

                textFlow.AddParagraph("Consider using the \"");
                textFlow.AddLink(FirstRunSetupOverlayStrings.FirstRunSetupTitle, () => firstRunSetupOverlay?.Show());
                textFlow.AddText("\" to download or import some beatmaps!");
            }
            else
            {
                textFlow.AddParagraph("No beatmaps match your filter criteria!");
                textFlow.AddParagraph(string.Empty);

                if (string.IsNullOrEmpty(filter?.SearchText))
                {
                    // TODO: Add realm queries to hint at which ruleset results are available in (and allow clicking to switch).
                    // TODO: Make this message more certain by ensuring the osu! beatmaps exist before suggesting.
                    if (filter?.Ruleset.OnlineID > 0 && !filter.AllowConvertedBeatmaps)
                    {
                        textFlow.AddParagraph("Beatmaps may be available by ");
                        textFlow.AddLink("enabling automatic conversion", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true));
                        textFlow.AddText("!");
                    }
                }
                else
                {
                    textFlow.AddParagraph("You can try ");
                    textFlow.AddLink("searching online", LinkAction.SearchBeatmapSet, filter.SearchText);
                    textFlow.AddText(" for this query.");
                }
            }

            // TODO: add clickable link to reset criteria.
        }
        private void updateDisplay(User user)
        {
            topLinkContainer.Clear();
            bottomLinkContainer.Clear();

            if (user == null)
            {
                return;
            }

            if (user.JoinDate.ToUniversalTime().Year < 2008)
            {
                topLinkContainer.AddText("元老级玩家");
            }
            else
            {
                topLinkContainer.AddText("注册时间: ");
                topLinkContainer.AddText(new DrawableDate(user.JoinDate), embolden);
            }

            addSpacer(topLinkContainer);

            if (user.IsOnline)
            {
                topLinkContainer.AddText("当前在线");
                addSpacer(topLinkContainer);
            }
            else if (user.LastVisit.HasValue)
            {
                topLinkContainer.AddText("上次登入 ");
                topLinkContainer.AddText(new DrawableDate(user.LastVisit.Value), embolden);

                addSpacer(topLinkContainer);
            }

            if (user.PlayStyles?.Length > 0)
            {
                topLinkContainer.AddText("惯用 ");
                topLinkContainer.AddText(string.Join(", ", user.PlayStyles.Select(style => style.GetDescription())), embolden);

                addSpacer(topLinkContainer);
            }

            topLinkContainer.AddText("发表了 ");
            topLinkContainer.AddLink($@"{user.PostCount:#,##0} 篇论坛帖子", $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: embolden);

            string websiteWithoutProtcol = user.Website;

            if (!string.IsNullOrEmpty(websiteWithoutProtcol))
            {
                if (Uri.TryCreate(websiteWithoutProtcol, UriKind.Absolute, out var uri))
                {
                    websiteWithoutProtcol = uri.Host + uri.PathAndQuery + uri.Fragment;
                    websiteWithoutProtcol = websiteWithoutProtcol.TrimEnd('/');
                }
            }

            tryAddInfo(FontAwesome.Solid.MapMarker, user.Location);
            tryAddInfo(OsuIcon.Heart, user.Interests);
            tryAddInfo(FontAwesome.Solid.Suitcase, user.Occupation);
            bottomLinkContainer.NewLine();
            if (!string.IsNullOrEmpty(user.Twitter))
            {
                tryAddInfo(FontAwesome.Brands.Twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}");
            }
            tryAddInfo(FontAwesome.Brands.Discord, user.Discord);
            tryAddInfo(FontAwesome.Brands.Skype, user.Skype, @"skype:" + user.Skype + @"?chat");
            tryAddInfo(FontAwesome.Brands.Lastfm, user.Lastfm, $@"https://last.fm/users/{user.Lastfm}");
            tryAddInfo(FontAwesome.Solid.Link, websiteWithoutProtcol, user.Website);
        }
示例#8
0
        private void updateDisplay(User user)
        {
            topLinkContainer.Clear();
            bottomLinkContainer.Clear();

            if (user == null)
            {
                return;
            }

            if (user.JoinDate.ToUniversalTime().Year < 2008)
            {
                topLinkContainer.AddText("Here since the beginning");
            }
            else
            {
                topLinkContainer.AddText("Joined ");
                topLinkContainer.AddText(new DrawableDate(user.JoinDate, italic: false), embolden);
            }

            addSpacer(topLinkContainer);

            if (user.IsOnline)
            {
                topLinkContainer.AddText("Currently online");
                addSpacer(topLinkContainer);
            }
            else if (user.LastVisit.HasValue)
            {
                topLinkContainer.AddText("Last seen ");
                topLinkContainer.AddText(new DrawableDate(user.LastVisit.Value, italic: false), embolden);

                addSpacer(topLinkContainer);
            }

            if (user.PlayStyles?.Length > 0)
            {
                topLinkContainer.AddText("Plays with ");
                topLinkContainer.AddText(string.Join(", ", user.PlayStyles.Select(style => style.GetDescription())), embolden);

                addSpacer(topLinkContainer);
            }

            topLinkContainer.AddText("Contributed ");
            topLinkContainer.AddLink($@"{user.PostCount:#,##0} forum posts", $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: embolden);

            string websiteWithoutProtocol = user.Website;

            if (!string.IsNullOrEmpty(websiteWithoutProtocol))
            {
                if (Uri.TryCreate(websiteWithoutProtocol, UriKind.Absolute, out var uri))
                {
                    websiteWithoutProtocol = uri.Host + uri.PathAndQuery + uri.Fragment;
                    websiteWithoutProtocol = websiteWithoutProtocol.TrimEnd('/');
                }
            }

            bool anyInfoAdded = false;

            anyInfoAdded |= tryAddInfo(FontAwesome.Solid.MapMarker, user.Location);
            anyInfoAdded |= tryAddInfo(OsuIcon.Heart, user.Interests);
            anyInfoAdded |= tryAddInfo(FontAwesome.Solid.Suitcase, user.Occupation);

            if (anyInfoAdded)
            {
                bottomLinkContainer.NewLine();
            }

            if (!string.IsNullOrEmpty(user.Twitter))
            {
                anyInfoAdded |= tryAddInfo(FontAwesome.Brands.Twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}");
            }
            anyInfoAdded |= tryAddInfo(FontAwesome.Brands.Discord, user.Discord);
            anyInfoAdded |= tryAddInfo(FontAwesome.Brands.Skype, user.Skype, @"skype:" + user.Skype + @"?chat");
            anyInfoAdded |= tryAddInfo(FontAwesome.Solid.Link, websiteWithoutProtocol, user.Website);

            // If no information was added to the bottomLinkContainer, hide it to avoid unwanted padding
            bottomLinkContainer.Alpha = anyInfoAdded ? 1 : 0;
        }
示例#9
0
        private void updateDisplay(APIUser user)
        {
            topLinkContainer.Clear();
            bottomLinkContainer.Clear();

            if (user == null)
            {
                return;
            }

            if (user.JoinDate.ToUniversalTime().Year < 2008)
            {
                topLinkContainer.AddText(UsersStrings.ShowFirstMembers);
            }
            else
            {
                topLinkContainer.AddText("Joined ");
                topLinkContainer.AddText(new DrawableDate(user.JoinDate, italic: false), embolden);
            }

            addSpacer(topLinkContainer);

            if (user.IsOnline)
            {
                topLinkContainer.AddText(UsersStrings.ShowLastvisitOnline);
                addSpacer(topLinkContainer);
            }
            else if (user.LastVisit.HasValue)
            {
                topLinkContainer.AddText("Last seen ");
                topLinkContainer.AddText(new DrawableDate(user.LastVisit.Value, italic: false), embolden);

                addSpacer(topLinkContainer);
            }

            if (user.PlayStyles?.Length > 0)
            {
                topLinkContainer.AddText("Plays with ");

                LocalisableString playStylesString = user.PlayStyles[0].GetLocalisableDescription();

                for (int i = 1; i < user.PlayStyles.Length; i++)
                {
                    playStylesString = new TranslatableString(@"_", @"{0}{1}", playStylesString, CommonStrings.ArrayAndWordsConnector);
                    playStylesString = new TranslatableString(@"_", @"{0}{1}", playStylesString, user.PlayStyles[i].GetLocalisableDescription());
                }

                topLinkContainer.AddText(playStylesString, embolden);

                addSpacer(topLinkContainer);
            }

            topLinkContainer.AddText("Contributed ");
            topLinkContainer.AddLink("forum post".ToQuantity(user.PostCount, "#,##0"), $"{api.WebsiteRootUrl}/users/{user.Id}/posts", creationParameters: embolden);

            addSpacer(topLinkContainer);

            topLinkContainer.AddText("Posted ");
            topLinkContainer.AddLink("comment".ToQuantity(user.CommentsCount, "#,##0"), $"{api.WebsiteRootUrl}/comments?user_id={user.Id}", creationParameters: embolden);

            string websiteWithoutProtocol = user.Website;

            if (!string.IsNullOrEmpty(websiteWithoutProtocol))
            {
                if (Uri.TryCreate(websiteWithoutProtocol, UriKind.Absolute, out var uri))
                {
                    websiteWithoutProtocol = uri.Host + uri.PathAndQuery + uri.Fragment;
                    websiteWithoutProtocol = websiteWithoutProtocol.TrimEnd('/');
                }
            }

            bool anyInfoAdded = false;

            anyInfoAdded |= tryAddInfo(FontAwesome.Solid.MapMarker, user.Location);
            anyInfoAdded |= tryAddInfo(OsuIcon.Heart, user.Interests);
            anyInfoAdded |= tryAddInfo(FontAwesome.Solid.Suitcase, user.Occupation);

            if (anyInfoAdded)
            {
                bottomLinkContainer.NewLine();
            }

            if (!string.IsNullOrEmpty(user.Twitter))
            {
                anyInfoAdded |= tryAddInfo(FontAwesome.Brands.Twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}");
            }
            anyInfoAdded |= tryAddInfo(FontAwesome.Brands.Discord, user.Discord);
            anyInfoAdded |= tryAddInfo(FontAwesome.Solid.Link, websiteWithoutProtocol, user.Website);

            // If no information was added to the bottomLinkContainer, hide it to avoid unwanted padding
            bottomLinkContainer.Alpha = anyInfoAdded ? 1 : 0;
        }
        private void load(OsuColour colours)
        {
            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Spacing      = new Vector2(10, 0),
                    Children     = new Drawable[]
                    {
                        avatar = new UpdateableAvatar
                        {
                            Size         = new Vector2(50),
                            Masking      = true,
                            CornerRadius = 10,
                        },
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Vertical,
                            Children     = new Drawable[]
                            {
                                new OsuSpriteText
                                {
                                    Font    = OsuFont.GetFont(size: 30),
                                    Current = { BindTarget = RoomName }
                                },
                                hostText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 20))
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                }
                            }
                        }
                    }
                },
                openSettingsButton = new PurpleTriangleButton
                {
                    Anchor = Anchor.CentreRight,
                    Origin = Anchor.CentreRight,
                    Size   = new Vector2(150, HEIGHT),
                    Text   = "Open settings",
                    Action = () => OpenSettings?.Invoke(),
                    Alpha  = 0
                }
            };

            Host.BindValueChanged(host =>
            {
                avatar.User = host.NewValue;

                hostText.Clear();

                if (host.NewValue != null)
                {
                    hostText.AddText("hosted by ");
                    hostText.AddUserLink(host.NewValue, s => s.Font = s.Font.With(weight: FontWeight.SemiBold));
                }

                openSettingsButton.Alpha = host.NewValue?.Equals(api.LocalUser.Value) == true ? 1 : 0;
            }, true);
        }