-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Update style of extended details on profile page #38196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
diquoks
wants to merge
2
commits into
ppy:master
Choose a base branch
from
diquoks:feature/update-profile-details-style
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+71
−41
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,9 @@ | |
| using osu.Framework.Extensions.LocalisationExtensions; | ||
| using osu.Framework.Graphics; | ||
| using osu.Framework.Graphics.Containers; | ||
| using osu.Framework.Graphics.Shapes; | ||
| using osu.Framework.Graphics.Sprites; | ||
| using osu.Framework.Localisation; | ||
| using osu.Game.Graphics; | ||
| using osu.Game.Graphics.Sprites; | ||
| using osu.Game.Resources.Localisation.Web; | ||
|
|
@@ -29,57 +31,68 @@ public partial class ExtendedDetails : CompositeDrawable | |
| private SpriteText replaysWatched = null!; | ||
|
|
||
| [BackgroundDependencyLoader] | ||
| private void load() | ||
| private void load(OverlayColourProvider colourProvider) | ||
| { | ||
| var font = OsuFont.Default.With(size: 12); | ||
| const float vertical_spacing = 4; | ||
| const float horizontal_spacing = 20; | ||
|
|
||
| AutoSizeAxes = Axes.Both; | ||
| CornerRadius = 6; | ||
| Masking = true; | ||
|
|
||
| // this should really be a grid, but trying to avoid one to avoid the performance hit. | ||
| InternalChild = new FillFlowContainer | ||
| InternalChildren = new Drawable[] | ||
| { | ||
| AutoSizeAxes = Axes.Both, | ||
| Direction = FillDirection.Horizontal, | ||
| Spacing = new Vector2(20, 0), | ||
| Children = new[] | ||
| new Box | ||
| { | ||
| new FillFlowContainer | ||
| RelativeSizeAxes = Axes.Both, | ||
| Colour = colourProvider.Background4, | ||
| }, | ||
| // this should really be a grid, but trying to avoid one to avoid the performance hit. | ||
| new FillFlowContainer | ||
| { | ||
| AutoSizeAxes = Axes.Both, | ||
| Direction = FillDirection.Horizontal, | ||
| Spacing = new Vector2(horizontal_spacing, 0), | ||
| Padding = new MarginPadding { Vertical = 18, Horizontal = 12 }, | ||
| Children = new[] | ||
| { | ||
| Name = @"Labels", | ||
| AutoSizeAxes = Axes.Both, | ||
| Direction = FillDirection.Vertical, | ||
| Spacing = new Vector2(0, vertical_spacing), | ||
| Children = new Drawable[] | ||
| new FillFlowContainer | ||
| { | ||
| new OsuSpriteText { Font = font, Text = UsersStrings.ShowStatsRankedScore }, | ||
| new OsuSpriteText { Font = font, Text = UsersStrings.ShowStatsHitAccuracy }, | ||
| new OsuSpriteText { Font = font, Text = UsersStrings.ShowStatsPlayCount }, | ||
| new OsuSpriteText { Font = font, Text = UsersStrings.ShowStatsTotalScore }, | ||
| new OsuSpriteText { Font = font, Text = UsersStrings.ShowStatsTotalHits }, | ||
| new OsuSpriteText { Font = font, Text = UsersStrings.ShowStatsHitsPerPlay }, | ||
| new OsuSpriteText { Font = font, Text = UsersStrings.ShowStatsMaximumCombo }, | ||
| new OsuSpriteText { Font = font, Text = UsersStrings.ShowStatsReplaysWatchedByOthers }, | ||
| } | ||
| }, | ||
| new FillFlowContainer | ||
| { | ||
| Name = @"Values", | ||
| AutoSizeAxes = Axes.Both, | ||
| Direction = FillDirection.Vertical, | ||
| Spacing = new Vector2(0, vertical_spacing), | ||
| Children = new Drawable[] | ||
| Name = @"Labels", | ||
| AutoSizeAxes = Axes.Both, | ||
| Direction = FillDirection.Vertical, | ||
| Spacing = new Vector2(0, vertical_spacing), | ||
| Children = new Drawable[] | ||
| { | ||
| new ExtendedDetailsEntryLabel(UsersStrings.ShowStatsRankedScore), | ||
| new ExtendedDetailsEntryLabel(UsersStrings.ShowStatsHitAccuracy), | ||
| new ExtendedDetailsEntryLabel(UsersStrings.ShowStatsPlayCount), | ||
| new ExtendedDetailsEntryLabel(UsersStrings.ShowStatsTotalScore), | ||
| new ExtendedDetailsEntryLabel(UsersStrings.ShowStatsTotalHits), | ||
| new ExtendedDetailsEntryLabel(UsersStrings.ShowStatsHitsPerPlay), | ||
| new ExtendedDetailsEntryLabel(UsersStrings.ShowStatsMaximumCombo), | ||
| new ExtendedDetailsEntryLabel(UsersStrings.ShowStatsReplaysWatchedByOthers), | ||
| } | ||
| }, | ||
| new FillFlowContainer | ||
| { | ||
| rankedScore = new OsuSpriteText { Font = font }, | ||
| hitAccuracy = new OsuSpriteText { Font = font }, | ||
| playCount = new OsuSpriteText { Font = font }, | ||
| totalScore = new OsuSpriteText { Font = font }, | ||
| totalHits = new OsuSpriteText { Font = font }, | ||
| hitsPerPlay = new OsuSpriteText { Font = font }, | ||
| maximumCombo = new OsuSpriteText { Font = font }, | ||
| replaysWatched = new OsuSpriteText { Font = font }, | ||
| } | ||
| }, | ||
| Name = @"Values", | ||
| AutoSizeAxes = Axes.Both, | ||
| Direction = FillDirection.Vertical, | ||
| Spacing = new Vector2(0, vertical_spacing), | ||
| Children = new Drawable[] | ||
| { | ||
| rankedScore = new ExtendedDetailsEntryValue(), | ||
| hitAccuracy = new ExtendedDetailsEntryValue(), | ||
| playCount = new ExtendedDetailsEntryValue(), | ||
| totalScore = new ExtendedDetailsEntryValue(), | ||
| totalHits = new ExtendedDetailsEntryValue(), | ||
| hitsPerPlay = new ExtendedDetailsEntryValue(), | ||
| maximumCombo = new ExtendedDetailsEntryValue(), | ||
| replaysWatched = new ExtendedDetailsEntryValue(), | ||
| } | ||
| }, | ||
| } | ||
| } | ||
| }; | ||
| } | ||
|
|
@@ -115,5 +128,34 @@ private void updateStatistics(UserStatistics? statistics) | |
| maximumCombo.Text = statistics.MaxCombo.ToLocalisableString(@"N0"); | ||
| replaysWatched.Text = statistics.ReplaysWatched.ToLocalisableString(@"N0"); | ||
| } | ||
|
|
||
| public partial class ExtendedDetailsEntryLabel : OsuSpriteText | ||
| { | ||
| public ExtendedDetailsEntryLabel(LocalisableString text) | ||
| { | ||
| Font = OsuFont.Default.With(size: 12); | ||
| Text = text; | ||
| } | ||
|
|
||
| [BackgroundDependencyLoader] | ||
| private void load(OverlayColourProvider colourProvider) | ||
| { | ||
| Colour = colourProvider.Content1; | ||
| } | ||
| } | ||
|
|
||
| public partial class ExtendedDetailsEntryValue : OsuSpriteText | ||
| { | ||
| public ExtendedDetailsEntryValue() | ||
| { | ||
| Font = OsuFont.Default.With(size: 12, weight: FontWeight.Bold); | ||
| } | ||
|
|
||
| [BackgroundDependencyLoader] | ||
| private void load(OverlayColourProvider colourProvider) | ||
| { | ||
| Colour = colourProvider.Content2; | ||
| } | ||
| } | ||
|
Comment on lines
+131
to
+147
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved these elements into separate classes so as not to duplicate styles each time |
||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed actually, but i added it for consistency