mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 20:02:57 +08:00
Merge pull request #7554 from EVAST9919/profile-scores-update-new
Update profile scores in line with the web design
This commit is contained in:
commit
9f1adfdcd5
101
osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs
Normal file
101
osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
|
using osu.Game.Overlays.Profile.Sections.Ranks;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osuTK;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Online
|
||||||
|
{
|
||||||
|
public class TestSceneUserProfileScores : OsuTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(DrawableProfileScore),
|
||||||
|
typeof(DrawableProfileWeightedScore),
|
||||||
|
typeof(ProfileItemContainer),
|
||||||
|
};
|
||||||
|
|
||||||
|
public TestSceneUserProfileScores()
|
||||||
|
{
|
||||||
|
var score = new ScoreInfo
|
||||||
|
{
|
||||||
|
PP = 134.32,
|
||||||
|
Rank = ScoreRank.A,
|
||||||
|
Beatmap = new BeatmapInfo
|
||||||
|
{
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Title = "Triumph & Regret",
|
||||||
|
Artist = "typeMARS"
|
||||||
|
},
|
||||||
|
Version = "[4K] Regret"
|
||||||
|
},
|
||||||
|
Date = DateTimeOffset.Now,
|
||||||
|
Mods = new Mod[]
|
||||||
|
{
|
||||||
|
new OsuModHardRock(),
|
||||||
|
new OsuModDoubleTime(),
|
||||||
|
},
|
||||||
|
Accuracy = 0.998546
|
||||||
|
};
|
||||||
|
|
||||||
|
var noPPScore = new ScoreInfo
|
||||||
|
{
|
||||||
|
Rank = ScoreRank.B,
|
||||||
|
Beatmap = new BeatmapInfo
|
||||||
|
{
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Title = "C18H27NO3(extend)",
|
||||||
|
Artist = "Team Grimoire"
|
||||||
|
},
|
||||||
|
Version = "[4K] Cataclysmic Hypernova"
|
||||||
|
},
|
||||||
|
Date = DateTimeOffset.Now,
|
||||||
|
Accuracy = 0.55879
|
||||||
|
};
|
||||||
|
|
||||||
|
Add(new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(0, 10),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(score)),
|
||||||
|
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileScore(noPPScore)),
|
||||||
|
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(score, 0.85))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ColourProvidedContainer : Container
|
||||||
|
{
|
||||||
|
[Cached]
|
||||||
|
private readonly OverlayColourProvider colourProvider;
|
||||||
|
|
||||||
|
public ColourProvidedContainer(OverlayColourScheme colourScheme, DrawableProfileScore score)
|
||||||
|
{
|
||||||
|
colourProvider = new OverlayColourProvider(colourScheme);
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Add(score);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,11 +4,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Profile.Sections;
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
using osu.Game.Overlays.Profile.Sections.Ranks;
|
using osu.Game.Overlays.Profile.Sections.Ranks;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -20,7 +22,15 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
protected override bool UseOnlineAPI => true;
|
protected override bool UseOnlineAPI => true;
|
||||||
|
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(DrawableProfileScore), typeof(RanksSection) };
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(DrawableProfileScore),
|
||||||
|
typeof(DrawableProfileWeightedScore),
|
||||||
|
typeof(RanksSection)
|
||||||
|
};
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||||
|
|
||||||
public TestSceneUserRanks()
|
public TestSceneUserRanks()
|
||||||
{
|
{
|
||||||
|
@ -29,9 +29,9 @@ namespace osu.Game.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DrawableDate(DateTimeOffset date)
|
public DrawableDate(DateTimeOffset date, float textSize = OsuFont.DEFAULT_FONT_SIZE)
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Regular, italics: true);
|
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: textSize, italics: true);
|
||||||
Date = date;
|
Date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -13,32 +12,25 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Historical
|
namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||||
{
|
{
|
||||||
public class DrawableMostPlayedBeatmap : OsuHoverContainer
|
public class DrawableMostPlayedBeatmap : CompositeDrawable
|
||||||
{
|
{
|
||||||
private const int cover_width = 100;
|
private const int cover_width = 100;
|
||||||
private const int corner_radius = 6;
|
private const int corner_radius = 6;
|
||||||
private const int height = 50;
|
|
||||||
|
|
||||||
private readonly BeatmapInfo beatmap;
|
private readonly BeatmapInfo beatmap;
|
||||||
private readonly int playCount;
|
private readonly int playCount;
|
||||||
|
|
||||||
private Box background;
|
|
||||||
|
|
||||||
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
|
||||||
|
|
||||||
public DrawableMostPlayedBeatmap(BeatmapInfo beatmap, int playCount)
|
public DrawableMostPlayedBeatmap(BeatmapInfo beatmap, int playCount)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
this.playCount = playCount;
|
this.playCount = playCount;
|
||||||
Enabled.Value = true; //manually enabled, because we have no action
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = height;
|
Height = 50;
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
CornerRadius = corner_radius;
|
CornerRadius = corner_radius;
|
||||||
@ -47,10 +39,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
IdleColour = colours.GreySeafoam;
|
AddRangeInternal(new Drawable[]
|
||||||
HoverColour = colours.GreySeafoamLight;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new UpdateableBeatmapSetCover
|
new UpdateableBeatmapSetCover
|
||||||
{
|
{
|
||||||
@ -72,46 +61,48 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
CornerRadius = corner_radius,
|
CornerRadius = corner_radius,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
background = new Box { RelativeSizeAxes = Axes.Both },
|
new ProfileItemContainer
|
||||||
new Container
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
Child = new Container
|
||||||
Padding = new MarginPadding(10),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding(10),
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
new FillFlowContainer
|
||||||
Origin = Anchor.CentreLeft,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new MostPlayedBeatmapMetadataContainer(beatmap),
|
Anchor = Anchor.CentreLeft,
|
||||||
new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular))
|
Origin = Anchor.CentreLeft,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
new MostPlayedBeatmapMetadataContainer(beatmap),
|
||||||
Direction = FillDirection.Horizontal,
|
new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular))
|
||||||
Colour = colours.GreySeafoamLighter
|
{
|
||||||
}.With(d =>
|
AutoSizeAxes = Axes.Both,
|
||||||
{
|
Direction = FillDirection.Horizontal,
|
||||||
d.AddText("mapped by ");
|
Colour = colours.GreySeafoamLighter
|
||||||
d.AddUserLink(beatmap.Metadata.Author);
|
}.With(d =>
|
||||||
}),
|
{
|
||||||
}
|
d.AddText("mapped by ");
|
||||||
},
|
d.AddUserLink(beatmap.Metadata.Author);
|
||||||
new PlayCountText(playCount)
|
}),
|
||||||
{
|
}
|
||||||
Anchor = Anchor.CentreRight,
|
},
|
||||||
Origin = Anchor.CentreRight
|
new PlayCountText(playCount)
|
||||||
},
|
{
|
||||||
}
|
Anchor = Anchor.CentreRight,
|
||||||
},
|
Origin = Anchor.CentreRight
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
|
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
|
||||||
|
63
osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs
Normal file
63
osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Profile.Sections
|
||||||
|
{
|
||||||
|
public class ProfileItemContainer : Container
|
||||||
|
{
|
||||||
|
private const int hover_duration = 200;
|
||||||
|
|
||||||
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
|
private Color4 idleColour;
|
||||||
|
private Color4 hoverColour;
|
||||||
|
|
||||||
|
private readonly Box background;
|
||||||
|
private readonly Container content;
|
||||||
|
|
||||||
|
public ProfileItemContainer()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = 6;
|
||||||
|
|
||||||
|
AddRangeInternal(new Drawable[]
|
||||||
|
{
|
||||||
|
background = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
content = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
background.Colour = idleColour = colourProvider.Background4;
|
||||||
|
hoverColour = colourProvider.Background3;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
background.FadeColour(hoverColour, hover_duration, Easing.OutQuint);
|
||||||
|
return base.OnHover(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
base.OnHoverLost(e);
|
||||||
|
background.FadeColour(idleColour, hover_duration, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,47 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|
||||||
{
|
|
||||||
public class DrawablePerformanceScore : DrawableProfileScore
|
|
||||||
{
|
|
||||||
private readonly double? weight;
|
|
||||||
|
|
||||||
public DrawablePerformanceScore(ScoreInfo score, double? weight = null)
|
|
||||||
: base(score)
|
|
||||||
{
|
|
||||||
this.weight = weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colour)
|
|
||||||
{
|
|
||||||
double pp = Score.PP ?? 0;
|
|
||||||
RightFlowContainer.Add(new OsuSpriteText
|
|
||||||
{
|
|
||||||
Text = $"{pp:0}pp",
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
|
|
||||||
});
|
|
||||||
|
|
||||||
if (weight.HasValue)
|
|
||||||
{
|
|
||||||
RightFlowContainer.Add(new OsuSpriteText
|
|
||||||
{
|
|
||||||
Text = $"weighted: {pp * weight:0}pp ({weight:P0})",
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
Colour = colour.GrayA,
|
|
||||||
Font = OsuFont.GetFont(size: 11, weight: FontWeight.Regular, italics: true)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +1,225 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osuTK;
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.Leaderboards;
|
using osu.Game.Online.Leaderboards;
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Beatmaps;
|
using osuTK;
|
||||||
using osu.Framework.Localisation;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||||
{
|
{
|
||||||
public abstract class DrawableProfileScore : DrawableProfileRow
|
public class DrawableProfileScore : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly FillFlowContainer modsContainer;
|
private const int performance_width = 80;
|
||||||
|
private const int content_padding = 10;
|
||||||
|
|
||||||
protected readonly ScoreInfo Score;
|
protected readonly ScoreInfo Score;
|
||||||
|
|
||||||
protected DrawableProfileScore(ScoreInfo score)
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
|
|
||||||
|
public DrawableProfileScore(ScoreInfo score)
|
||||||
{
|
{
|
||||||
Score = score;
|
Score = score;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = 60;
|
Height = 40;
|
||||||
Children = new Drawable[]
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
AddInternal(new ProfileItemContainer
|
||||||
{
|
{
|
||||||
modsContainer = new FillFlowContainer
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
new Container
|
||||||
Anchor = Anchor.CentreRight,
|
{
|
||||||
Origin = Anchor.CentreRight,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Spacing = new Vector2(1),
|
Padding = new MarginPadding { Left = content_padding, Right = performance_width + content_padding },
|
||||||
Margin = new MarginPadding { Right = 160 }
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(8, 0),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new UpdateableRank(Score.Rank)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Size = new Vector2(50, 20),
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(0, 2),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new ScoreBeatmapMetadataContainer(Score.Beatmap),
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(5, 0),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = $"{Score.Beatmap.Version}",
|
||||||
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
|
||||||
|
Colour = colours.Yellow
|
||||||
|
},
|
||||||
|
new DrawableDate(Score.Date, 12)
|
||||||
|
{
|
||||||
|
Colour = colourProvider.Foreground1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(15),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
CreateRightContent().With(c =>
|
||||||
|
{
|
||||||
|
c.Anchor = Anchor.CentreRight;
|
||||||
|
c.Origin = Anchor.CentreRight;
|
||||||
|
}),
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(2),
|
||||||
|
Children = Score.Mods.Select(mod => new ModIcon(mod)
|
||||||
|
{
|
||||||
|
Scale = new Vector2(0.35f)
|
||||||
|
}).ToList(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = performance_width,
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Size = new Vector2(1, 0.5f),
|
||||||
|
Colour = Color4.Black.Opacity(0.5f),
|
||||||
|
Shear = new Vector2(-0.45f, 0),
|
||||||
|
EdgeSmoothness = new Vector2(2, 0),
|
||||||
|
},
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
RelativePositionAxes = Axes.Y,
|
||||||
|
Size = new Vector2(1, -0.5f),
|
||||||
|
Position = new Vector2(0, 1),
|
||||||
|
Colour = Color4.Black.Opacity(0.5f),
|
||||||
|
Shear = new Vector2(0.45f, 0),
|
||||||
|
EdgeSmoothness = new Vector2(2, 0),
|
||||||
|
},
|
||||||
|
createDrawablePerformance().With(d =>
|
||||||
|
{
|
||||||
|
d.Anchor = Anchor.Centre;
|
||||||
|
d.Origin = Anchor.Centre;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[NotNull]
|
||||||
private void load(OsuColour colour)
|
protected virtual Drawable CreateRightContent() => CreateDrawableAccuracy();
|
||||||
|
|
||||||
|
protected OsuSpriteText CreateDrawableAccuracy() => new OsuSpriteText
|
||||||
{
|
{
|
||||||
var text = new OsuSpriteText
|
Text = $"{Score.Accuracy:0.00%}",
|
||||||
{
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
|
||||||
Text = $"accuracy: {Score.Accuracy:P2}",
|
Colour = colours.Yellow,
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
Colour = colour.GrayA,
|
|
||||||
Font = OsuFont.GetFont(size: 11, weight: FontWeight.Regular, italics: true)
|
|
||||||
};
|
|
||||||
|
|
||||||
RightFlowContainer.Insert(1, text);
|
|
||||||
|
|
||||||
LeftFlowContainer.Add(new ProfileScoreBeatmapMetadataContainer(Score.Beatmap));
|
|
||||||
LeftFlowContainer.Add(new DrawableDate(Score.Date));
|
|
||||||
|
|
||||||
foreach (Mod mod in Score.Mods)
|
|
||||||
modsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.5f) });
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Drawable CreateLeftVisual() => new UpdateableRank(Score.Rank)
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Width = 60,
|
|
||||||
FillMode = FillMode.Fit,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private class ProfileScoreBeatmapMetadataContainer : BeatmapMetadataContainer
|
private Drawable createDrawablePerformance()
|
||||||
{
|
{
|
||||||
public ProfileScoreBeatmapMetadataContainer(BeatmapInfo beatmap)
|
if (Score.PP.HasValue)
|
||||||
|
{
|
||||||
|
return new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||||
|
Text = $"{Score.PP:0}",
|
||||||
|
Colour = colourProvider.Highlight1
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||||
|
Text = "pp",
|
||||||
|
Colour = colourProvider.Light3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||||
|
Text = "-",
|
||||||
|
Colour = colourProvider.Highlight1
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ScoreBeatmapMetadataContainer : BeatmapMetadataContainer
|
||||||
|
{
|
||||||
|
public ScoreBeatmapMetadataContainer(BeatmapInfo beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -79,16 +228,19 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
Text = new LocalisedString((
|
Text = new LocalisedString((
|
||||||
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
|
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} ",
|
||||||
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
|
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} ")),
|
||||||
Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold, italics: true)
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold, italics: true)
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
|
Anchor = Anchor.BottomLeft,
|
||||||
Padding = new MarginPadding { Top = 3 },
|
Origin = Anchor.BottomLeft,
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true)
|
Text = "by " + new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
|
||||||
|
Font = OsuFont.GetFont(size: 12, italics: true)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||||
|
{
|
||||||
|
public class DrawableProfileWeightedScore : DrawableProfileScore
|
||||||
|
{
|
||||||
|
private readonly double weight;
|
||||||
|
|
||||||
|
public DrawableProfileWeightedScore(ScoreInfo score, double weight)
|
||||||
|
: base(score)
|
||||||
|
{
|
||||||
|
this.weight = weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateRightContent() => new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Width = 60,
|
||||||
|
Child = CreateDrawableAccuracy()
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
|
||||||
|
Text = $"{Score.PP * weight:0}pp",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.GetFont(size: 12),
|
||||||
|
Text = $@"weighted {weight:0%}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -1,31 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|
||||||
{
|
|
||||||
public class DrawableTotalScore : DrawableProfileScore
|
|
||||||
{
|
|
||||||
public DrawableTotalScore(ScoreInfo score)
|
|
||||||
: base(score)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
RightFlowContainer.Add(new OsuSpriteText
|
|
||||||
{
|
|
||||||
Text = Score.TotalScore.ToString("#,###"),
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,14 +15,12 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
{
|
{
|
||||||
public class PaginatedScoreContainer : PaginatedContainer<APILegacyScoreInfo>
|
public class PaginatedScoreContainer : PaginatedContainer<APILegacyScoreInfo>
|
||||||
{
|
{
|
||||||
private readonly bool includeWeight;
|
|
||||||
private readonly ScoreType type;
|
private readonly ScoreType type;
|
||||||
|
|
||||||
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string header, string missing, bool includeWeight = false)
|
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string header, string missing)
|
||||||
: base(user, header, missing)
|
: base(user, header, missing)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.includeWeight = includeWeight;
|
|
||||||
|
|
||||||
ItemsPerPage = 5;
|
ItemsPerPage = 5;
|
||||||
|
|
||||||
@ -43,10 +41,10 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return new DrawablePerformanceScore(model.CreateScoreInfo(Rulesets), includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null);
|
return new DrawableProfileScore(model.CreateScoreInfo(Rulesets));
|
||||||
|
|
||||||
case ScoreType.Recent:
|
case ScoreType.Best:
|
||||||
return new DrawableTotalScore(model.CreateScoreInfo(Rulesets));
|
return new DrawableProfileWeightedScore(model.CreateScoreInfo(Rulesets), Math.Pow(0.95, ItemsContainer.Count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance", "No performance records. :(", true),
|
new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance", "No performance records. :("),
|
||||||
new PaginatedScoreContainer(ScoreType.Firsts, User, "First Place Ranks", "No awesome performance records yet. :("),
|
new PaginatedScoreContainer(ScoreType.Firsts, User, "First Place Ranks", "No awesome performance records yet. :("),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user