mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 00:53:19 +08:00
Add beatmap info and score date.
Also adjusts design metrics.
This commit is contained in:
parent
7d32cc85c8
commit
72fcc09a98
@ -37,7 +37,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
base.Reset();
|
||||
|
||||
Add(new Results(new Score()
|
||||
Add(new Results(new Score
|
||||
{
|
||||
TotalScore = 2845370,
|
||||
Accuracy = 0.98,
|
||||
|
@ -201,10 +201,10 @@ namespace osu.Game.Screens.Ranking
|
||||
switch (mode)
|
||||
{
|
||||
case ResultMode.Summary:
|
||||
currentPage = new ResultsScorePage(score);
|
||||
currentPage = new ResultsPageScore(score, Beatmap.BeatmapInfo);
|
||||
break;
|
||||
case ResultMode.Ranking:
|
||||
currentPage = new ResultsRankingPage(score, Beatmap.BeatmapInfo);
|
||||
currentPage = new ResultsPageRanking(score, Beatmap.BeatmapInfo);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Scoring;
|
||||
using OpenTK;
|
||||
@ -15,15 +16,17 @@ namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
internal class ResultsPage : Container
|
||||
{
|
||||
protected Score Score;
|
||||
protected readonly Score Score;
|
||||
protected readonly BeatmapInfo Beatmap;
|
||||
private CircularContainer content;
|
||||
private Box fill;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
public ResultsPage(Score score)
|
||||
public ResultsPage(Score score, BeatmapInfo beatmap)
|
||||
{
|
||||
Score = score;
|
||||
Beatmap = beatmap;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
|
@ -12,13 +12,10 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
internal class ResultsRankingPage : ResultsPage
|
||||
internal class ResultsPageRanking : ResultsPage
|
||||
{
|
||||
private readonly BeatmapInfo beatmap;
|
||||
|
||||
public ResultsRankingPage(Score score, BeatmapInfo beatmap = null) : base(score)
|
||||
public ResultsPageRanking(Score score, BeatmapInfo beatmap = null) : base(score, beatmap)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -36,7 +33,7 @@ namespace osu.Game.Screens.Ranking
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Beatmap = beatmap ?? Score.Beatmap,
|
||||
Beatmap = Beatmap ?? Score.Beatmap,
|
||||
Scale = new Vector2(0.7f)
|
||||
}
|
||||
};
|
286
osu.Game/Screens/Ranking/ResultsPageScore.cs
Normal file
286
osu.Game/Screens/Ranking/ResultsPageScore.cs
Normal file
@ -0,0 +1,286 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Modes.Scoring;
|
||||
using osu.Game.Screens.Select.Leaderboards;
|
||||
using osu.Game.Users;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
internal class ResultsPageScore : ResultsPage
|
||||
{
|
||||
private ScoreCounter scoreCounter;
|
||||
|
||||
public ResultsPageScore(Score score, BeatmapInfo beatmap) : base(score, beatmap) { }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
const float user_header_height = 120;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = user_header_height },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White,
|
||||
},
|
||||
}
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new UserHeader(Score.User)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = user_header_height,
|
||||
},
|
||||
new DrawableRank(Score.Rank)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Size = new Vector2(150, 60),
|
||||
Margin = new MarginPadding(20),
|
||||
},
|
||||
scoreCounter = new SlowScoreCounter(6)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Colour = colours.PinkDarker,
|
||||
TextSize = 50,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Colour = colours.PinkDarker,
|
||||
Shadow = false,
|
||||
Font = @"Exo2.0-Bold",
|
||||
TextSize = 16,
|
||||
Text = "total score",
|
||||
Margin = new MarginPadding { Bottom = 20 },
|
||||
},
|
||||
new BeatmapDetails(Beatmap)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Bottom = 10 },
|
||||
},
|
||||
new DateDisplay(Score.Date)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Top = 10, Bottom = 10 },
|
||||
Colour = colours.GrayC,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Size = new Vector2(0.75f, 1),
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Schedule(() => scoreCounter.Increment(Score.TotalScore));
|
||||
}
|
||||
|
||||
private class DateDisplay : Container
|
||||
{
|
||||
private DateTime date;
|
||||
|
||||
public DateDisplay(DateTime date)
|
||||
{
|
||||
this.date = date;
|
||||
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
Width = 140;
|
||||
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.Gray6,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Text = date.ToString("HH:mm"),
|
||||
Padding = new MarginPadding { Left = 10, Right = 10, Top = 5, Bottom = 5 },
|
||||
Colour = Color4.White,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.CentreRight,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Text = date.ToString("yyyy/MM/dd"),
|
||||
Padding = new MarginPadding { Left = 10, Right = 10, Top = 5, Bottom = 5 },
|
||||
Colour = Color4.White,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private class BeatmapDetails : Container
|
||||
{
|
||||
private readonly BeatmapInfo beatmap;
|
||||
|
||||
private Bindable<bool> preferUnicode;
|
||||
|
||||
private readonly OsuSpriteText title;
|
||||
private readonly OsuSpriteText artist;
|
||||
private readonly OsuSpriteText versionMapper;
|
||||
|
||||
public BeatmapDetails(BeatmapInfo beatmap)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
title = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Shadow = false,
|
||||
TextSize = 24,
|
||||
Font = @"Exo2.0-BoldItalic",
|
||||
},
|
||||
artist = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Shadow = false,
|
||||
TextSize = 20,
|
||||
Font = @"Exo2.0-BoldItalic",
|
||||
},
|
||||
versionMapper = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Shadow = false,
|
||||
TextSize = 16,
|
||||
Font = @"Exo2.0-Bold",
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, OsuConfigManager config)
|
||||
{
|
||||
title.Colour = artist.Colour = colours.BlueDarker;
|
||||
versionMapper.Colour = colours.Gray8;
|
||||
|
||||
versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author}";
|
||||
|
||||
preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
|
||||
preferUnicode.ValueChanged += unicode =>
|
||||
{
|
||||
title.Text = unicode ? beatmap.Metadata.TitleUnicode : beatmap.Metadata.Title;
|
||||
artist.Text = unicode ? beatmap.Metadata.ArtistUnicode : beatmap.Metadata.Artist;
|
||||
};
|
||||
preferUnicode.TriggerChange();
|
||||
}
|
||||
}
|
||||
|
||||
private class UserHeader : Container
|
||||
{
|
||||
private readonly User user;
|
||||
private readonly Sprite cover;
|
||||
|
||||
public UserHeader(User user)
|
||||
{
|
||||
this.user = user;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
cover = new Sprite
|
||||
{
|
||||
FillMode = FillMode.Fill,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-RegularItalic",
|
||||
Text = user.Username,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
TextSize = 30,
|
||||
Padding = new MarginPadding { Bottom = 10 },
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
cover.Texture = textures.Get(user.CoverUrl);
|
||||
}
|
||||
}
|
||||
|
||||
private class SlowScoreCounter : ScoreCounter
|
||||
{
|
||||
protected override double RollingDuration => 3000;
|
||||
|
||||
protected override EasingTypes RollingEasing => EasingTypes.OutPow10;
|
||||
|
||||
public SlowScoreCounter(uint leading = 0) : base(leading)
|
||||
{
|
||||
DisplayedCountSpriteText.Shadow = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Modes.Scoring;
|
||||
using osu.Game.Screens.Select.Leaderboards;
|
||||
using osu.Game.Users;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
internal class ResultsScorePage : ResultsPage
|
||||
{
|
||||
private ScoreCounter scoreCounter;
|
||||
|
||||
public ResultsScorePage(Score score) : base(score) { }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
const float user_header_height = 150;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = user_header_height },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White,
|
||||
},
|
||||
}
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new UserHeader(Score.User)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = user_header_height,
|
||||
},
|
||||
new DrawableRank(Score.Rank)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Size = new Vector2(150, 80),
|
||||
},
|
||||
scoreCounter = new SlowScoreCounter(6)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Colour = colours.PinkDarker,
|
||||
TextSize = 60,
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Schedule(() => scoreCounter.Increment(Score.TotalScore));
|
||||
}
|
||||
|
||||
private class UserHeader : Container
|
||||
{
|
||||
private readonly User user;
|
||||
private readonly Sprite cover;
|
||||
|
||||
public UserHeader(User user)
|
||||
{
|
||||
this.user = user;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
cover = new Sprite
|
||||
{
|
||||
FillMode = FillMode.Fill,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-RegularItalic",
|
||||
Text = user.Username,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
TextSize = 30,
|
||||
Padding = new MarginPadding { Bottom = 10 },
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
cover.Texture = textures.Get(user.CoverUrl);
|
||||
}
|
||||
}
|
||||
|
||||
private class SlowScoreCounter : ScoreCounter
|
||||
{
|
||||
protected override double RollingDuration => 3000;
|
||||
|
||||
protected override EasingTypes RollingEasing => EasingTypes.OutPow10;
|
||||
|
||||
public SlowScoreCounter(uint leading = 0) : base(leading)
|
||||
{
|
||||
DisplayedCountSpriteText.Shadow = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -203,8 +203,8 @@
|
||||
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
|
||||
<Compile Include="Screens\Play\SquareGraph.cs" />
|
||||
<Compile Include="Screens\Ranking\ResultsPage.cs" />
|
||||
<Compile Include="Screens\Ranking\ResultsRankingPage.cs" />
|
||||
<Compile Include="Screens\Ranking\ResultsScorePage.cs" />
|
||||
<Compile Include="Screens\Ranking\ResultsPageRanking.cs" />
|
||||
<Compile Include="Screens\Ranking\ResultsPageScore.cs" />
|
||||
<Compile Include="Screens\ScreenWhiteBox.cs" />
|
||||
<Compile Include="Screens\Loader.cs" />
|
||||
<Compile Include="Screens\Menu\Button.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user