public NotSupporterPlaceholder()
        {
            LinkFlowContainer text;

            AutoSizeAxes = Axes.Both;
            Child        = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Vertical,
                Spacing      = new Vector2(0, 20),
                Children     = new Drawable[]
                {
                    new OsuSpriteText
                    {
                        Anchor = Anchor.TopCentre,
                        Origin = Anchor.TopCentre,
                        Text   = BeatmapsetsStrings.ShowScoreboardSupporterOnly,
                        Font   = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
                    },
                    text = new LinkFlowContainer(t => t.Font = t.Font.With(size: 11))
                    {
                        Anchor       = Anchor.TopCentre,
                        Origin       = Anchor.TopCentre,
                        Direction    = FillDirection.Horizontal,
                        AutoSizeAxes = Axes.Both,
                    }
                }
            };

            text.AddText("Click ");
            text.AddLink("here", "/home/support");
            text.AddText(" to see all the fancy features that you can get!");
        }
        public NotSupporterPlaceholder()
        {
            LinkFlowContainer text;

            AutoSizeAxes = Axes.Both;
            Child        = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Vertical,
                Spacing      = new Vector2(0, 10),
                Children     = new Drawable[]
                {
                    new OsuSpriteText
                    {
                        Anchor = Anchor.TopCentre,
                        Origin = Anchor.TopCentre,
                        Text   = @"You need to be an osu!supporter to access the friend and country rankings!",
                        Font   = OsuFont.GetFont(weight: FontWeight.Bold),
                    },
                    text = new LinkFlowContainer(t => t.Font = t.Font.With(size: 12))
                    {
                        Anchor       = Anchor.TopCentre,
                        Origin       = Anchor.TopCentre,
                        Direction    = FillDirection.Horizontal,
                        AutoSizeAxes = Axes.Both,
                    }
                }
            };

            text.AddText("Click ");
            text.AddLink("here", "/home/support");
            text.AddText(" to see all the fancy features that you can get!");
        }
Beispiel #3
0
        private void load(OsuColour colours)
        {
            InternalChildren = new Drawable[]
            {
                icon = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Icon   = OsuIcon.Logo,
                    Size   = new Vector2(icon_size),
                    Y      = icon_y,
                },
                fill = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Y        = icon_y,
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.TopCentre,
                    Children = new Drawable[]
                    {
                        textFlow = new LinkFlowContainer
                        {
                            Width        = 680,
                            AutoSizeAxes = Axes.Y,
                            TextAnchor   = Anchor.TopCentre,
                            Anchor       = Anchor.TopCentre,
                            Origin       = Anchor.TopCentre,
                            Spacing      = new Vector2(0, 2),
                        },
                    }
                },
                supportFlow = new LinkFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    TextAnchor       = Anchor.BottomCentre,
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    Padding          = new MarginPadding(20),
                    Alpha            = 0,
                    Spacing          = new Vector2(0, 2),
                },
            };

            textFlow.AddText("this is osu!", t => t.Font = t.Font.With(Typeface.Torus, 30, FontWeight.Regular));

            expendableText.Add(textFlow.AddText("lazer", t =>
            {
                t.Font   = t.Font.With(Typeface.Torus, 30, FontWeight.Regular);
                t.Colour = colours.PinkLight;
            }));
Beispiel #4
0
        private void load(OsuColour colours, IAPIProvider api)
        {
            InternalChildren = new Drawable[]
            {
                icon = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Icon   = FontAwesome.Solid.Flask,
                    Size   = new Vector2(icon_size),
                    Y      = icon_y,
                },
                fill = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Y        = icon_y,
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.TopCentre,
                    Children = new Drawable[]
                    {
                        textFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Spacing          = new Vector2(0, 2),
                            LayoutDuration   = 2000,
                            LayoutEasing     = Easing.OutQuint
                        },
                        supportFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Alpha            = 0,
                            Spacing          = new Vector2(0, 2),
                        },
                    }
                }
            };

            textFlow.AddText("This project is an ongoing ", t => t.Font = t.Font.With(Typeface.Torus, 30, FontWeight.Light));
            textFlow.AddText("work in progress", t => t.Font            = t.Font.With(Typeface.Torus, 30, FontWeight.SemiBold));

            textFlow.NewParagraph();
Beispiel #5
0
        private void load(OsuColour colours, IAPIProvider api)
        {
            InternalChildren = new Drawable[]
            {
                icon = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Icon   = FontAwesome.Solid.ExclamationTriangle,
                    Size   = new Vector2(icon_size),
                    Y      = icon_y,
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Y        = icon_y + icon_size,
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.TopCentre,
                    Children = new Drawable[]
                    {
                        textFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Spacing          = new Vector2(0, 2),
                        },
                        supportFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Alpha            = 0,
                            Spacing          = new Vector2(0, 2),
                        },
                    }
                }
            };

            textFlow.AddText("This is an ", t => t.Font             = t.Font.With(Typeface.Exo, 30, FontWeight.Light));
            textFlow.AddText("early development build", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.SemiBold));

            textFlow.AddParagraph("Things may not work as expected", t => t.Font = t.Font.With(size: 20));
            textFlow.NewParagraph();
Beispiel #6
0
        public MultiplayerConsent()
        {
            LinkFlowContainer textFlow;

            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Spacing          = new Vector2(0, 20),
                    Children         = new Drawable[]
                    {
                        textFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Spacing          = new Vector2(0, 2)
                        },
                        new TriangleButton {
                            Text   = "I Understand",
                            Width  = 200,
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Action = () =>
                            {
                                config.Set(OsuSetting.MultiplayerConsentAcknowledged, true);
                                this.Exit();
                            }
                        }
                    }
                }
            };

            textFlow.AddText("Before you start...", t => t.Font = t.Font.With(Typeface.Torus, 30, FontWeight.Bold));
            textFlow.NewParagraph();

            textFlow.AddText(
                "Please do not use this mod while accessing public game servers with unsuspecting players.\n" +
                "This is meant for single player and/or matched play with consenting participants. Thank you!",
                t => t.Font = t.Font.With(Typeface.Torus, 24, FontWeight.SemiBold)
                );
        }
        private void tryAddInfo(IconUsage icon, string content, string link = null)
        {
            if (string.IsNullOrEmpty(content))
            {
                return;
            }

            // newlines could be contained in API returned user content.
            content = content.Replace("\n", " ");

            bottomLinkContainer.AddIcon(icon, text =>
            {
                text.Font   = text.Font.With(size: 10);
                text.Colour = iconColour;
            });

            if (link != null)
            {
                bottomLinkContainer.AddLink(" " + content, link, creationParameters: embolden);
            }
            else
            {
                bottomLinkContainer.AddText(" " + content, embolden);
            }

            addSpacer(bottomLinkContainer);
        }
Beispiel #8
0
        public NotSupporterPlaceholder()
        {
            LinkFlowContainer text;

            AutoSizeAxes = Axes.Both;
            Child        = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Vertical,
                Spacing      = new Vector2(0, 20),
                Children     = new Drawable[]
                {
                    new OsuSpriteText
                    {
                        Anchor = Anchor.TopCentre,
                        Origin = Anchor.TopCentre,
                        Text   = @"你需要成爲 osu!supporter 才可以訪問好友和國家排名!",
                        Font   = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
                    },
                    text = new LinkFlowContainer(t => t.Font = t.Font.With(size: 11))
                    {
                        Anchor       = Anchor.TopCentre,
                        Origin       = Anchor.TopCentre,
                        Direction    = FillDirection.Horizontal,
                        AutoSizeAxes = Axes.Both,
                    }
                }
            };

            text.AddLink("點擊這裏", "/home/support");
            text.AddText(" 來確定都會得到哪些附加功能!");
        }
Beispiel #9
0
        private void load(OsuColour colours)
        {
            Children = new Drawable[]
            {
                icon = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Icon   = FontAwesome.fa_warning,
                    Size   = new Vector2(30),
                    RelativePositionAxes = Axes.Both,
                    Y = icon_y,
                },
                textFlow = new LinkFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = new MarginPadding(50),
                    TextAnchor       = Anchor.TopCentre,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Spacing          = new Vector2(0, 2),
                }
            };

            textFlow.AddText("This is an ", t =>
            {
                t.TextSize = 30;
                t.Font     = @"Exo2.0-Light";
            });
            textFlow.AddText("early development build", t =>
            {
                t.TextSize = 30;
                t.Font     = @"Exo2.0-SemiBold";
            });

            textFlow.AddParagraph("Don't expect everything to work perfectly.");
            textFlow.AddParagraph("");
            textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.");
            textFlow.AddParagraph("");

            textFlow.AddText("Visit ");
            textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy");
            textFlow.AddText(" if you want to help out or follow progress!");

            iconColour = colours.Yellow;
        }
Beispiel #10
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.
        }
Beispiel #11
0
 private void addRepositoryReference(LinkFlowContainer title, Color4 entryColour)
 {
     title.AddText(" (", t =>
     {
         t.Font   = fontLarge;
         t.Colour = entryColour;
     });
     title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl,
                   t =>
     {
         t.Font   = fontLarge;
         t.Colour = entryColour;
     });
     title.AddText(")", t =>
     {
         t.Font   = fontLarge;
         t.Colour = entryColour;
     });
 }
Beispiel #12
0
        private void updateHost(User host)
        {
            avatar.User = host;

            if (host != null)
            {
                linkContainer.AddText("hosted by");
                linkContainer.NewLine();
                linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile", s => s.Font = "Exo2.0-BoldItalic");
            }
        }
Beispiel #13
0
        private void updateHost(User host)
        {
            avatar.User = host;

            if (host != null)
            {
                linkContainer.AddText("房主: ");
                linkContainer.NewLine();
                linkContainer.AddUserLink(host, s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true));
            }
        }
Beispiel #14
0
        private Drawable createTitle()
        {
            var entryColour = entry.Major ? colours.YellowLight : Color4.White;

            LinkFlowContainer title;

            var titleContainer = new Container
            {
                AutoSizeAxes     = Axes.Y,
                RelativeSizeAxes = Axes.X,
                Margin           = new MarginPadding {
                    Vertical = 5
                },
                Children = new Drawable[]
                {
                    new SpriteIcon
                    {
                        Anchor = Anchor.CentreLeft,
                        Origin = Anchor.CentreRight,
                        Size   = new Vector2(10),
                        Icon   = getIconForChangelogEntry(entry.Type),
                        Colour = entryColour.Opacity(0.5f),
                        Margin = new MarginPadding {
                            Right = 5
                        },
                    },
                    title = new LinkFlowContainer
                    {
                        Direction        = FillDirection.Full,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        TextAnchor       = Anchor.BottomLeft,
                    }
                }
            };

            title.AddText(entry.Title, t =>
            {
                t.Font   = fontLarge;
                t.Colour = entryColour;
            });

            if (!string.IsNullOrEmpty(entry.Repository))
            {
                addRepositoryReference(title, entryColour);
            }

            if (entry.GithubUser != null)
            {
                addGithubAuthorReference(title, entryColour);
            }

            return(titleContainer);
        }
Beispiel #15
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);
            }
        }
Beispiel #16
0
        private void updateHost(User host)
        {
            avatar.User = host;

            if (host != null)
            {
                linkContainer.AddText("hosted by");
                linkContainer.NewLine();
                linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile",
                                      s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true));
            }
        }
Beispiel #17
0
        private void addGithubAuthorReference(LinkFlowContainer title, Color4 entryColour)
        {
            title.AddText("by ", t =>
            {
                t.Font    = fontMedium;
                t.Colour  = entryColour;
                t.Padding = new MarginPadding {
                    Left = 10
                };
            });

            if (entry.GithubUser.UserId != null)
            {
                title.AddUserLink(new APIUser
                {
                    Username = entry.GithubUser.OsuUsername,
                    Id       = entry.GithubUser.UserId.Value
                }, t =>
                {
                    t.Font   = fontMedium;
                    t.Colour = entryColour;
                });
            }
            else if (entry.GithubUser.GithubUrl != null)
            {
                title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t =>
                {
                    t.Font   = fontMedium;
                    t.Colour = entryColour;
                });
            }
            else
            {
                title.AddText(entry.GithubUser.DisplayName, t =>
                {
                    t.Font   = fontMedium;
                    t.Colour = entryColour;
                });
            }
        }
Beispiel #18
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);
        }
Beispiel #19
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");
            }
Beispiel #20
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);
        }
Beispiel #21
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);
        }
Beispiel #22
0
        private void load(OsuColour colours)
        {
            LinkFlowContainer text;

            InternalChildren = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    CornerRadius     = 10,
                    Child            = new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = colours.GreyVioletDarker
                    },
                },
                text = new LinkFlowContainer(t =>
                {
                    t.Colour = colours.PinkLighter;
                    t.Font   = OsuFont.Default.With(size: 14);
                })
                {
                    Padding          = new MarginPadding(20),
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                }
            };

            text.AddParagraph("Got feedback?", t =>
            {
                t.Colour  = Color4.White;
                t.Font    = OsuFont.Default.With(italics: true, size: 20);
                t.Padding = new MarginPadding {
                    Bottom = 20
                };
            });

            text.AddParagraph("We would love to hear what you think of this update! ");
            text.AddIcon(FontAwesome.Regular.GrinHearts);

            text.AddParagraph("Please visit the ");
            text.AddLink("web version", $"{build.Url}#comments");
            text.AddText(" of this changelog to leave any comments.");
        }
Beispiel #23
0
        private void tryAddInfoRightLine(FontAwesome icon, string str, string url = null)
        {
            if (string.IsNullOrEmpty(str))
            {
                return;
            }

            infoTextRight.AddIcon(icon);
            if (url != null)
            {
                infoTextRight.AddLink(" " + str, url);
            }
            else
            {
                infoTextRight.AddText(" " + str);
            }

            infoTextRight.NewLine();
        }
        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;
        }
Beispiel #25
0
        private void loadUser()
        {
            LoadComponentAsync(new UserCoverBackground(user)
            {
                RelativeSizeAxes = Axes.Both,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                FillMode         = FillMode.Fill,
                OnLoadComplete   = d => d.FadeInFromZero(200),
                Depth            = float.MaxValue,
            }, coverContainer.Add);

            if (user.IsSupporter)
            {
                SupporterTag.Show();
            }

            if (!string.IsNullOrEmpty(user.Colour))
            {
                colourBar.Colour = OsuColour.FromHex(user.Colour);
                colourBar.Show();
            }

            void boldItalic(SpriteText t) => t.Font = @"Exo2.0-BoldItalic";
            void lightText(SpriteText t) => t.Alpha = 0.8f;

            OsuSpriteText createScoreText(string text) => new OsuSpriteText
            {
                TextSize = 14,
                Text     = text
            };

            OsuSpriteText createScoreNumberText(string text) => new OsuSpriteText
            {
                TextSize = 14,
                Font     = @"Exo2.0-Bold",
                Anchor   = Anchor.TopRight,
                Origin   = Anchor.TopRight,
                Text     = text
            };

            if (user.Country != null)
            {
                infoTextLeft.AddText("From ", lightText);
                infoTextLeft.AddText(user.Country.FullName, boldItalic);
                countryFlag.Country = user.Country;
            }

            infoTextLeft.NewParagraph();

            if (user.JoinDate.ToUniversalTime().Year < 2008)
            {
                infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), lightText);
            }
            else
            {
                infoTextLeft.AddText("Joined ", lightText);
                infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic);
            }

            infoTextLeft.NewLine();
            infoTextLeft.AddText("Last seen ", lightText);
            infoTextLeft.AddText(new DrawableDate(user.LastVisit), boldItalic);
            infoTextLeft.NewParagraph();

            if (user.PlayStyle?.Length > 0)
            {
                infoTextLeft.AddText("Plays with ", lightText);
                infoTextLeft.AddText(string.Join(", ", user.PlayStyle), boldItalic);
            }

            infoTextLeft.NewLine();
            infoTextLeft.AddText("Contributed ", lightText);
            infoTextLeft.AddLink($@"{user.PostCount} forum posts", url: $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: boldItalic);

            string websiteWithoutProtcol = user.Website;

            if (!string.IsNullOrEmpty(websiteWithoutProtcol))
            {
                int protocolIndex = websiteWithoutProtcol.IndexOf("//", StringComparison.Ordinal);
                if (protocolIndex >= 0)
                {
                    websiteWithoutProtcol = websiteWithoutProtcol.Substring(protocolIndex + 2);
                }
            }

            tryAddInfoRightLine(FontAwesome.fa_map_marker, user.Location);
            tryAddInfoRightLine(FontAwesome.fa_heart_o, user.Interests);
            tryAddInfoRightLine(FontAwesome.fa_suitcase, user.Occupation);
            infoTextRight.NewParagraph();
            if (!string.IsNullOrEmpty(user.Twitter))
            {
                tryAddInfoRightLine(FontAwesome.fa_twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}");
            }
            tryAddInfoRightLine(FontAwesome.fa_gamepad, user.Discord);
            tryAddInfoRightLine(FontAwesome.fa_skype, user.Skype, @"skype:" + user.Skype + @"?chat");
            tryAddInfoRightLine(FontAwesome.fa_lastfm, user.Lastfm, $@"https://last.fm/users/{user.Lastfm}");
            tryAddInfoRightLine(FontAwesome.fa_globe, websiteWithoutProtcol, user.Website);

            if (user.Statistics != null)
            {
                levelBadge.Show();
                levelText.Text = user.Statistics.Level.Current.ToString();

                scoreText.Add(createScoreText("Ranked Score"));
                scoreNumberText.Add(createScoreNumberText(user.Statistics.RankedScore.ToString(@"#,0")));
                scoreText.Add(createScoreText("Accuracy"));
                scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy:0.##}%"));
                scoreText.Add(createScoreText("Play Count"));
                scoreNumberText.Add(createScoreNumberText(user.Statistics.PlayCount.ToString(@"#,0")));
                scoreText.Add(createScoreText("Total Score"));
                scoreNumberText.Add(createScoreNumberText(user.Statistics.TotalScore.ToString(@"#,0")));
                scoreText.Add(createScoreText("Total Hits"));
                scoreNumberText.Add(createScoreNumberText(user.Statistics.TotalHits.ToString(@"#,0")));
                scoreText.Add(createScoreText("Max Combo"));
                scoreNumberText.Add(createScoreNumberText(user.Statistics.MaxCombo.ToString(@"#,0")));
                scoreText.Add(createScoreText("Replays Watched by Others"));
                scoreNumberText.Add(createScoreNumberText(user.Statistics.ReplaysWatched.ToString(@"#,0")));

                gradeSSPlus.DisplayCount = user.Statistics.GradesCount.SSPlus;
                gradeSSPlus.Show();
                gradeSS.DisplayCount = user.Statistics.GradesCount.SS;
                gradeSS.Show();
                gradeSPlus.DisplayCount = user.Statistics.GradesCount.SPlus;
                gradeSPlus.Show();
                gradeS.DisplayCount = user.Statistics.GradesCount.S;
                gradeS.Show();
                gradeA.DisplayCount = user.Statistics.GradesCount.A;
                gradeA.Show();

                rankGraph.User.Value = user;
            }

            badgeContainer.ShowBadges(user.Badges);
        }
        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);
        }
Beispiel #27
0
        private void load(OverlayColourProvider colourProvider)
        {
            LinkFlowContainer        username;
            FillFlowContainer        info;
            CommentMarkdownContainer message;
            GridContainer            content;
            VotePill votePill;

            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;
            InternalChildren = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = getPadding(Comment.IsTopLevel),
                    Child            = new FillFlowContainer
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Direction        = FillDirection.Vertical,
                        Children         = new Drawable[]
                        {
                            content = new GridContainer
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                ColumnDimensions = new[]
                                {
                                    new Dimension(GridSizeMode.Absolute, size: avatar_size + 10),
                                    new Dimension(),
                                },
                                RowDimensions = new[]
                                {
                                    new Dimension(GridSizeMode.AutoSize)
                                },
                                Content = new[]
                                {
                                    new Drawable[]
                                    {
                                        new Container
                                        {
                                            Size     = new Vector2(avatar_size),
                                            Children = new Drawable[]
                                            {
                                                new UpdateableAvatar(Comment.User)
                                                {
                                                    Size           = new Vector2(avatar_size),
                                                    Masking        = true,
                                                    CornerRadius   = avatar_size / 2f,
                                                    CornerExponent = 2,
                                                },
                                                votePill = new VotePill(Comment)
                                                {
                                                    Anchor = Anchor.CentreLeft,
                                                    Origin = Anchor.CentreRight,
                                                    Margin = new MarginPadding
                                                    {
                                                        Right = 5
                                                    }
                                                }
                                            }
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 4),
                                            Margin           = new MarginPadding
                                            {
                                                Vertical = 2
                                            },
                                            Children = new Drawable[]
                                            {
                                                new FillFlowContainer
                                                {
                                                    AutoSizeAxes = Axes.Both,
                                                    Direction    = FillDirection.Horizontal,
                                                    Spacing      = new Vector2(10, 0),
                                                    Children     = new[]
                                                    {
                                                        username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold))
                                                        {
                                                            AutoSizeAxes = Axes.Both
                                                        },
                                                        Comment.Pinned ? new PinnedCommentNotice() : Empty(),
                                                        new ParentUsername(Comment),
                                                        new OsuSpriteText
                                                        {
                                                            Alpha = Comment.IsDeleted ? 1 : 0,
                                                            Font  = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
                                                            Text  = CommentsStrings.Deleted
                                                        }
                                                    }
                                                },
                                                message = new CommentMarkdownContainer
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    DocumentMargin   = new MarginPadding(0),
                                                    DocumentPadding  = new MarginPadding(0),
                                                },
                                                info = new FillFlowContainer
                                                {
                                                    AutoSizeAxes = Axes.Both,
                                                    Direction    = FillDirection.Horizontal,
                                                    Spacing      = new Vector2(10, 0),
                                                    Children     = new Drawable[]
                                                    {
                                                        new DrawableDate(Comment.CreatedAt, 12, false)
                                                        {
                                                            Colour = colourProvider.Foreground1
                                                        }
                                                    }
                                                },
                                                new Container
                                                {
                                                    AutoSizeAxes = Axes.Both,
                                                    Children     = new Drawable[]
                                                    {
                                                        showRepliesButton = new ShowRepliesButton(Comment.RepliesCount)
                                                        {
                                                            Expanded = { BindTarget = childrenExpanded }
                                                        },
                                                        loadRepliesButton = new LoadRepliesButton
                                                        {
                                                            Action = () => RepliesRequested(this, ++currentPage)
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                            childCommentsVisibilityContainer = new FillFlowContainer
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Direction        = FillDirection.Vertical,
                                Padding          = new MarginPadding {
                                    Left = 20
                                },
                                Children = new Drawable[]
                                {
                                    childCommentsContainer = new FillFlowContainer
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical
                                    },
                                    deletedCommentsCounter = new DeletedCommentsCounter
                                    {
                                        ShowDeleted = { BindTarget = ShowDeleted },
                                        Margin      = new MarginPadding
                                        {
                                            Top = 10
                                        }
                                    },
                                    showMoreButton = new ShowMoreRepliesButton
                                    {
                                        Action = () => RepliesRequested(this, ++currentPage)
                                    }
                                }
                            },
                        }
                    }
                },
                new Container
                {
                    Size   = new Vector2(70, 40),
                    Anchor = Anchor.TopRight,
                    Origin = Anchor.TopRight,
                    Margin = new MarginPadding {
                        Horizontal = 5
                    },
                    Child = chevronButton = new ChevronButton
                    {
                        Anchor   = Anchor.CentreLeft,
                        Origin   = Anchor.CentreLeft,
                        Expanded = { BindTarget = childrenExpanded },
                        Alpha    = 0
                    }
                }
            };

            if (Comment.UserId.HasValue)
            {
                username.AddUserLink(Comment.User);
            }
            else
            {
                username.AddText(Comment.LegacyName);
            }

            if (Comment.EditedAt.HasValue)
            {
                var font   = OsuFont.GetFont(size: 12, weight: FontWeight.Regular);
                var colour = colourProvider.Foreground1;

                info.Add(new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Children     = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Font   = font,
                            Text   = "edited ",
                            Colour = colour
                        },
                        new DrawableDate(Comment.EditedAt.Value)
                        {
                            Font   = font,
                            Colour = colour
                        },
                        new OsuSpriteText
                        {
                            Font   = font,
                            Text   = $@" by {Comment.EditedUser.Username}",
                            Colour = colour
                        },
                    }
                });
            }

            if (Comment.HasMessage)
            {
                message.Text = Comment.Message;
            }

            if (Comment.IsDeleted)
            {
                content.FadeColour(OsuColour.Gray(0.5f));
                votePill.Hide();
            }

            if (Comment.IsTopLevel)
            {
                AddInternal(new Box
                {
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    RelativeSizeAxes = Axes.X,
                    Height           = 1.5f,
                    Colour           = OsuColour.Gray(0.1f)
                });
            }

            if (Replies.Any())
            {
                onRepliesAdded(Replies);
            }

            Replies.CollectionChanged += (_, args) =>
            {
                switch (args.Action)
                {
                case NotifyCollectionChangedAction.Add:
                    onRepliesAdded(args.NewItems.Cast <DrawableComment>());
                    break;

                default:
                    throw new NotSupportedException(@"You can only add replies to this list. Other actions are not supported.");
                }
            };
        }
Beispiel #28
0
        private void load(OsuColour colours, APIAccess api, OsuGame game, TextureStore textures)
        {
            this.api = api;

            if (string.IsNullOrEmpty(api.ProvidedUsername))
            {
                return;
            }

            InternalChildren = new Drawable[]
            {
                new Sprite
                {
                    Anchor  = Anchor.TopCentre,
                    Origin  = Anchor.TopCentre,
                    Texture = textures.Get(@"Menu/dev-build-footer"),
                },
                new Sprite
                {
                    Anchor  = Anchor.BottomCentre,
                    Origin  = Anchor.BottomCentre,
                    Texture = textures.Get(@"Menu/dev-build-footer"),
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Direction        = FillDirection.Vertical,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    Padding          = new MarginPadding(20),
                    Spacing          = new Vector2(0, 5),
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 150,
                            Child            = new OsuLogo
                            {
                                Scale     = new Vector2(0.1f),
                                Anchor    = Anchor.Centre,
                                Triangles = false,
                            },
                        },
                        new OsuSpriteText
                        {
                            TextSize = 28,
                            Font     = "Exo2.0-Light",
                            Anchor   = Anchor.TopCentre,
                            Origin   = Anchor.TopCentre,
                            Colour   = Color4.Red,
                            Text     = "Warning! 注意!",
                        },
                        multiAccountExplanationText = new OsuTextFlowContainer(cp => { cp.TextSize = 12; })
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        new SettingsButton
                        {
                            Text   = "Help, I can't access my account!",
                            Margin = new MarginPadding {
                                Top = 50
                            },
                            Action = () => game?.OpenUrlExternally(help_centre_url)
                        },
                        new DangerousSettingsButton
                        {
                            Text   = "I understand. This account isn't for me.",
                            Action = () => this.Push(new ScreenEntry())
                        },
                        furtherAssistance = new LinkFlowContainer(cp => { cp.TextSize = 12; })
                        {
                            Margin = new MarginPadding {
                                Top = 20
                            },
                            Anchor       = Anchor.TopCentre,
                            Origin       = Anchor.TopCentre,
                            AutoSizeAxes = Axes.Both
                        },
                    }
                }
            };

            multiAccountExplanationText.AddText("Are you ");
            multiAccountExplanationText.AddText(api.ProvidedUsername, cp => cp.Colour = colours.BlueLight);
            multiAccountExplanationText.AddText("? osu! has a policy of ");
            multiAccountExplanationText.AddText("one account per person!", cp => cp.Colour = colours.Yellow);
            multiAccountExplanationText.AddText(" Please be aware that creating more than one account per person may result in ");
            multiAccountExplanationText.AddText("permanent deactivation of accounts", cp => cp.Colour = colours.Yellow);
            multiAccountExplanationText.AddText(".");

            furtherAssistance.AddText("Need further assistance? Contact us via our ");
            furtherAssistance.AddLink("support system", help_centre_url);
            furtherAssistance.AddText(".");
        }
Beispiel #29
0
        private void load(OsuColour colours, OverlayColourProvider colourProvider)
        {
            foreach (var categoryEntries in Build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key))
            {
                ChangelogEntries.Add(new OsuSpriteText
                {
                    Text   = categoryEntries.Key,
                    Font   = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
                    Margin = new MarginPadding {
                        Top = 35, Bottom = 15
                    },
                });

                var fontLarge  = OsuFont.GetFont(size: 16);
                var fontMedium = OsuFont.GetFont(size: 12);

                foreach (var entry in categoryEntries)
                {
                    var entryColour = entry.Major ? colours.YellowLight : Color4.White;

                    LinkFlowContainer title;

                    var titleContainer = new Container
                    {
                        AutoSizeAxes     = Axes.Y,
                        RelativeSizeAxes = Axes.X,
                        Margin           = new MarginPadding {
                            Vertical = 5
                        },
                        Children = new Drawable[]
                        {
                            new SpriteIcon
                            {
                                Anchor = Anchor.CentreLeft,
                                Origin = Anchor.CentreRight,
                                Size   = new Vector2(10),
                                Icon   = entry.Type == ChangelogEntryType.Fix ? FontAwesome.Solid.Check : FontAwesome.Solid.Plus,
                                Colour = entryColour.Opacity(0.5f),
                                Margin = new MarginPadding {
                                    Right = 5
                                },
                            },
                            title = new LinkFlowContainer
                            {
                                Direction        = FillDirection.Full,
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                            }
                        }
                    };

                    title.AddText(entry.Title, t =>
                    {
                        t.Font   = fontLarge;
                        t.Colour = entryColour;
                    });

                    if (!string.IsNullOrEmpty(entry.Repository))
                    {
                        title.AddText(" (", t =>
                        {
                            t.Font   = fontLarge;
                            t.Colour = entryColour;
                        });
                        title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl,
                                      creationParameters: t =>
                        {
                            t.Font   = fontLarge;
                            t.Colour = entryColour;
                        });
                        title.AddText(")", t =>
                        {
                            t.Font   = fontLarge;
                            t.Colour = entryColour;
                        });
                    }

                    title.AddText("by ", t =>
                    {
                        t.Font    = fontMedium.With(italics: true);
                        t.Colour  = entryColour;
                        t.Padding = new MarginPadding {
                            Left = 10
                        };
                    });

                    if (entry.GithubUser.UserId != null)
                    {
                        title.AddUserLink(new User
                        {
                            Username = entry.GithubUser.OsuUsername,
                            Id       = entry.GithubUser.UserId.Value
                        }, t =>
                        {
                            t.Font   = fontMedium.With(italics: true);
                            t.Colour = entryColour;
                        });
                    }
                    else if (entry.GithubUser.GithubUrl != null)
                    {
                        title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t =>
                        {
                            t.Font   = fontMedium.With(italics: true);
                            t.Colour = entryColour;
                        });
                    }
                    else
                    {
                        title.AddText(entry.GithubUser.DisplayName, t =>
                        {
                            t.Font   = fontMedium.With(italics: true);
                            t.Colour = entryColour;
                        });
                    }

                    ChangelogEntries.Add(titleContainer);

                    if (!string.IsNullOrEmpty(entry.MessageHtml))
                    {
                        var message = new TextFlowContainer
                        {
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                        };

                        // todo: use markdown parsing once API returns markdown
                        message.AddText(WebUtility.HtmlDecode(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty)), t =>
                        {
                            t.Font   = fontMedium;
                            t.Colour = colourProvider.Foreground1;
                        });

                        ChangelogEntries.Add(message);
                    }
                }
            }
        }
Beispiel #30
0
        public ChangelogBuild(APIChangelogBuild build)
        {
            Build = build;

            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;
            Direction        = FillDirection.Vertical;
            Padding          = new MarginPadding {
                Horizontal = HORIZONTAL_PADDING
            };

            Children = new Drawable[]
            {
                CreateHeader(),
                ChangelogEntries = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                },
            };

            foreach (var categoryEntries in build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key))
            {
                ChangelogEntries.Add(new OsuSpriteText
                {
                    Text   = categoryEntries.Key,
                    Font   = OsuFont.GetFont(weight: FontWeight.Bold, size: 24),
                    Margin = new MarginPadding {
                        Top = 35, Bottom = 15
                    },
                });

                var fontLarge  = OsuFont.GetFont(size: 18);
                var fontMedium = OsuFont.GetFont(size: 14);
                var fontSmall  = OsuFont.GetFont(size: 12);

                foreach (APIChangelogEntry entry in categoryEntries)
                {
                    LinkFlowContainer title = new LinkFlowContainer
                    {
                        Direction        = FillDirection.Full,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Margin           = new MarginPadding {
                            Vertical = 5
                        },
                    };

                    title.AddIcon(FontAwesome.Solid.Check, t =>
                    {
                        t.Font    = fontSmall;
                        t.Padding = new MarginPadding {
                            Left = -17, Right = 5
                        };
                    });

                    title.AddText(entry.Title, t => { t.Font = fontLarge; });

                    if (!string.IsNullOrEmpty(entry.Repository))
                    {
                        title.AddText(" (", t => t.Font = fontLarge);
                        title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External,
                                      creationParameters: t => { t.Font = fontLarge; });
                        title.AddText(")", t => t.Font = fontLarge);
                    }

                    title.AddText(" by ", t => t.Font = fontMedium);

                    if (entry.GithubUser.UserId != null)
                    {
                        title.AddUserLink(new User
                        {
                            Username = entry.GithubUser.OsuUsername,
                            Id       = entry.GithubUser.UserId.Value
                        }, t => t.Font = fontMedium);
                    }
                    else if (entry.GithubUser.GithubUrl != null)
                    {
                        title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t => t.Font = fontMedium);
                    }
                    else
                    {
                        title.AddText(entry.GithubUser.DisplayName, t => t.Font = fontSmall);
                    }

                    ChangelogEntries.Add(title);

                    if (!string.IsNullOrEmpty(entry.MessageHtml))
                    {
                        TextFlowContainer message = new TextFlowContainer
                        {
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                        };

                        // todo: use markdown parsing once API returns markdown
                        message.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t =>
                        {
                            t.Font   = fontSmall;
                            t.Colour = new Color4(235, 184, 254, 255);
                        });

                        ChangelogEntries.Add(message);
                    }
                }
            }
        }