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!"); }
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); }
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, 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(" 來確定都會得到哪些附加功能!"); }
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 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"); } }
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)); } }
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"); }
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); }
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; }
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."); }
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 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; }); }
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; }); } }
public void APIStateChanged(APIAccess api, APIState state) { form = null; switch (state) { case APIState.Offline: Children = new Drawable[] { new OsuSpriteText { Text = "ACCOUNT", Margin = new MarginPadding { Bottom = 5 }, Font = @"Exo2.0-Black", }, form = new LoginForm { RequestHide = RequestHide } }; break; case APIState.Failing: case APIState.Connecting: LinkFlowContainer linkFlow; Children = new Drawable[] { new LoadingAnimation { State = Visibility.Visible, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, linkFlow = new LinkFlowContainer { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, TextAnchor = Anchor.TopCentre, AutoSizeAxes = Axes.Both, Text = state == APIState.Failing ? "Connection is failing, will attempt to reconnect... " : "Attempting to connect... ", Margin = new MarginPadding { Top = 10, Bottom = 10 }, }, }; linkFlow.AddLink("cancel", api.Logout, string.Empty); break; case APIState.Online: Children = new Drawable[] { new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Left = 20, Right = 20 }, Direction = FillDirection.Vertical, Spacing = new Vector2(0f, 10f), Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new[] { new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "Signed in", TextSize = 18, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 5, Bottom = 5 }, }, }, }, panel = new UserPanel(api.LocalUser.Value) { RelativeSizeAxes = Axes.X, Action = RequestHide }, dropdown = new UserDropdown { RelativeSizeAxes = Axes.X }, }, }, }; panel.Status.BindTo(api.LocalUser.Value.Status); dropdown.Current.ValueChanged += newValue => { switch (newValue) { case UserAction.Online: api.LocalUser.Value.Status.Value = new UserStatusOnline(); dropdown.StatusColour = colours.Green; break; case UserAction.DoNotDisturb: api.LocalUser.Value.Status.Value = new UserStatusDoNotDisturb(); dropdown.StatusColour = colours.Red; break; case UserAction.AppearOffline: api.LocalUser.Value.Status.Value = new UserStatusOffline(); dropdown.StatusColour = colours.Gray7; break; case UserAction.SignOut: api.Logout(); break; } }; dropdown.Current.TriggerChange(); break; } if (form != null) { GetContainingInputManager()?.ChangeFocus(form); } }
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), Y = icon_y, }, textFlow = new LinkFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding(50), TextAnchor = Anchor.TopCentre, Y = -110, Anchor = Anchor.Centre, Origin = Anchor.TopCentre, 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("Things may not work as expected", t => t.TextSize = 20); textFlow.NewParagraph(); Action <SpriteText> format = t => { t.TextSize = 15; t.Font = @"Exo2.0-SemiBold"; }; textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.", format); textFlow.NewParagraph(); textFlow.AddText("Visit ", format); textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters: format); textFlow.AddText(" to help out or follow progress!", format); textFlow.NewParagraph(); textFlow.NewParagraph(); textFlow.NewParagraph(); supporterDrawables.AddRange(textFlow.AddText("Consider becoming an ", format)); supporterDrawables.AddRange(textFlow.AddLink("osu!supporter", "https://osu.ppy.sh/home/support", creationParameters: format)); supporterDrawables.AddRange(textFlow.AddText(" to help support the game", format)); supporterDrawables.Add(heart = textFlow.AddIcon(FontAwesome.fa_heart, t => { t.Padding = new MarginPadding { Left = 5 }; t.TextSize = 12; t.Colour = colours.Pink; t.Origin = Anchor.Centre; }).First()); iconColour = colours.Yellow; }
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 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("."); }
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; }
private void load(TextureStore textures, Storage storage) { RelativeSizeAxes = Axes.Both; this.storage = storage; TeamList ??= new StorageBackedTeamList(storage); if (!TeamList.Teams.Any()) { LinkFlowContainer links; InternalChildren = new Drawable[] { new Box { Colour = Color4.Black, RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Height = 0.3f, }, new WarningBox("No drawings.txt file found. Please create one and restart the client."), links = new LinkFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, Y = 60, AutoSizeAxes = Axes.Both } }; links.AddLink("Click for details on the file format", "https://osu.ppy.sh/wiki/en/Tournament_Drawings", t => t.Colour = Color4.White); return; } drawingsConfig = new DrawingsConfigManager(storage); InternalChildren = new Drawable[] { // Main container new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Sprite { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Texture = textures.Get(@"Backgrounds/Drawings/background.png") }, // Visualiser new VisualiserContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, Size = new Vector2(1, 10), Colour = new Color4(255, 204, 34, 255), Lines = 6 }, // Groups groupsContainer = new GroupContainer(drawingsConfig.Get <int>(DrawingsConfig.Groups), drawingsConfig.Get <int>(DrawingsConfig.TeamsPerGroup)) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Padding = new MarginPadding { Top = 35f, Bottom = 35f } }, // Scrolling teams teamsContainer = new ScrollingTeamContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, }, // Scrolling team name fullTeamNameText = new TournamentSpriteText { Anchor = Anchor.Centre, Origin = Anchor.TopCentre, Position = new Vector2(0, 45f), Colour = OsuColour.Gray(0.95f), Alpha = 0, Font = OsuFont.Torus.With(weight: FontWeight.Light, size: 42), } } }, // Control panel container new ControlPanel { new TourneyButton { RelativeSizeAxes = Axes.X, Text = "Begin random", Action = teamsContainer.StartScrolling, }, new TourneyButton { RelativeSizeAxes = Axes.X, Text = "Stop random", Action = teamsContainer.StopScrolling, }, new TourneyButton { RelativeSizeAxes = Axes.X, Text = "Reload", Action = reloadTeams }, new ControlPanel.Spacer(), new TourneyButton { RelativeSizeAxes = Axes.X, Text = "Reset", Action = () => reset() } } }; teamsContainer.OnSelected += onTeamSelected; teamsContainer.OnScrollStarted += () => fullTeamNameText.FadeOut(200); reset(true); }
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("反馈问题?", t => { t.Colour = Color4.White; t.Font = OsuFont.Default.With(italics: true, size: 24); t.Padding = new MarginPadding { Bottom = 20 }; }); text.AddParagraph("我们想知道你如何看待这次更新! ", t => { t.Font = OsuFont.Default.With(size: 20); }); text.AddIcon(FontAwesome.Regular.GrinHearts); text.AddParagraph("请访问", t => { t.Font = OsuFont.Default.With(size: 20); }); text.AddLink("网页版", $"{build.Url}#comments", t => { t.Font = OsuFont.Default.With(size: 20); }); text.AddText("的更改日志来留言.", t => { t.Font = OsuFont.Default.With(size: 20); }); text.AddParagraph("另外,你还可以通过访问", t => { t.Font = OsuFont.Default.With(size: 17); }); text.AddLink("这个链接", "https://github.com/ppy/osu/graphs/contributors", t => { t.Font = OsuFont.Default.With(size: 17); }); text.AddParagraph("和", t => { t.Font = OsuFont.Default.With(size: 17); }); text.AddLink("这个链接", "https://github.com/matrix-feather/osu/graphs/contributors", t => { t.Font = OsuFont.Default.With(size: 17); }); text.AddText("来查看迄今为止所有参与过osu!lazer以及中文版osu!lazer开发的人员!感谢他们的辛勤付出!", t => { t.Font = OsuFont.Default.With(size: 17); }); }
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("这是一个 ", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.Light)); textFlow.AddText("非常早期的构建版本", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.SemiBold)); textFlow.AddParagraph("一些事情可能不会按预期工作", t => t.Font = t.Font.With(size: 20)); textFlow.NewParagraph(); Action <SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold); textFlow.AddParagraph("欢迎来到github的issues页进行反馈", format); textFlow.NewParagraph(); textFlow.AddText("访问 ", format); textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters: format); textFlow.AddText("来一起帮助开发或获取最新进度!", format); textFlow.NewParagraph(); textFlow.NewParagraph(); textFlow.NewParagraph(); iconColour = colours.Yellow; currentUser.BindTo(api.LocalUser); currentUser.BindValueChanged(e => { supportFlow.Children.ForEach(d => d.FadeOut().Expire()); if (e.NewValue.IsSupporter) { supportFlow.AddText("感谢支持osu!", format); } else { supportFlow.AddText("考虑成为一名 ", format); supportFlow.AddLink("osu!supporter", "https://osu.ppy.sh/home/support", creationParameters: format); supportFlow.AddText("来帮助我们维护这个游戏", format); } heart = supportFlow.AddIcon(FontAwesome.Solid.Heart, t => { t.Padding = new MarginPadding { Left = 5 }; t.Font = t.Font.With(size: 12); t.Origin = Anchor.Centre; t.Colour = colours.Pink; }).First(); if (IsLoaded) { animateHeart(); } if (supportFlow.IsPresent) { supportFlow.FadeInFromZero(500); } }, true); }
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) { 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 }, }; var entryColour = entry.Major ? colours.YellowLight : Color4.White; title.AddIcon(entry.Type == ChangelogEntryType.Fix ? FontAwesome.Solid.Check : FontAwesome.Solid.Plus, t => { t.Font = fontSmall; t.Colour = entryColour; t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); 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, Online.Chat.LinkAction.External, creationParameters: t => { t.Font = fontLarge; t.Colour = entryColour; }); title.AddText(")", t => { t.Font = fontLarge; t.Colour = entryColour; }); } title.AddText(" by ", t => { t.Font = fontMedium; t.Colour = entryColour; }); if (entry.GithubUser.UserId != null) { title.AddUserLink(new User { 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, Online.Chat.LinkAction.External, null, null, t => { t.Font = fontMedium; t.Colour = entryColour; }); } else { title.AddText(entry.GithubUser.DisplayName, t => { t.Font = fontSmall; t.Colour = entryColour; }); } 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(WebUtility.HtmlDecode(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty)), t => { t.Font = fontSmall; t.Colour = new Color4(235, 184, 254, 255); }); ChangelogEntries.Add(message); } } } }
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(); Action <SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold); textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.", format); textFlow.NewParagraph(); textFlow.AddText("Visit ", format); textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters: format); textFlow.AddText(" to help out or follow progress!", format); textFlow.NewParagraph(); textFlow.NewParagraph(); textFlow.NewParagraph(); iconColour = colours.Yellow; currentUser.BindTo(api.LocalUser); currentUser.BindValueChanged(e => { supportFlow.Children.ForEach(d => d.FadeOut().Expire()); if (e.NewValue.IsSupporter) { supportFlow.AddText("Thank you for supporting osu!", format); } else { supportFlow.AddText("Consider becoming an ", format); supportFlow.AddLink("osu!supporter", "https://osu.ppy.sh/home/support", creationParameters: format); supportFlow.AddText(" to help support the game", format); } heart = supportFlow.AddIcon(FontAwesome.Solid.Heart, t => { t.Padding = new MarginPadding { Left = 5 }; t.Font = t.Font.With(size: 12); t.Origin = Anchor.Centre; t.Colour = colours.Pink; }).First(); if (IsLoaded) { animateHeart(); } if (supportFlow.IsPresent) { supportFlow.FadeInFromZero(500); } }, true); }
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); }
private void addUserLink() => content.AddLink(activity.User?.Username, LinkAction.OpenUserProfile, getLinkArgument(activity.User?.Url), creationParameters: t => t.Font = getLinkFont(FontWeight.Bold));
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); } } } }
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); } } } }
private void load(OsuColour colours, APIAccess api) { InternalChildren = new Drawable[] { icon = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, Icon = FontAwesome.fa_warning, Size = new Vector2(30), Y = icon_y, }, textFlow = new LinkFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding(50), TextAnchor = Anchor.TopCentre, Y = -110, Anchor = Anchor.Centre, Origin = Anchor.TopCentre, 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(); Action <SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold); textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.", format); textFlow.NewParagraph(); textFlow.AddText("Visit ", format); textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters: format); textFlow.AddText(" to help out or follow progress!", format); textFlow.NewParagraph(); textFlow.NewParagraph(); textFlow.NewParagraph(); supporterDrawables.AddRange(textFlow.AddText("Consider becoming an ", format)); supporterDrawables.AddRange(textFlow.AddLink("osu!supporter", "https://osu.ppy.sh/home/support", creationParameters: format)); supporterDrawables.AddRange(textFlow.AddText(" to help support the game", format)); supporterDrawables.Add(heart = textFlow.AddIcon(FontAwesome.fa_heart, t => { t.Padding = new MarginPadding { Left = 5 }; t.Font = t.Font.With(size: 12); t.Colour = colours.Pink; t.Origin = Anchor.Centre; }).First()); iconColour = colours.Yellow; currentUser.BindTo(api.LocalUser); currentUser.BindValueChanged(e => { if (e.NewValue.IsSupporter) { supporterDrawables.ForEach(d => d.FadeOut(500, Easing.OutQuint).Expire()); } }, true); }