mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:03:22 +08:00
Merge pull request #3899 from peppy/modular-results-screen
Modular results screen
This commit is contained in:
commit
b1eb543a50
@ -8,7 +8,9 @@ using osu.Framework.Allocation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Screens.Ranking.Pages;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
@ -23,8 +25,8 @@ namespace osu.Game.Tests.Visual
|
||||
typeof(ScoreInfo),
|
||||
typeof(Results),
|
||||
typeof(ResultsPage),
|
||||
typeof(ResultsPageScore),
|
||||
typeof(ResultsPageRanking)
|
||||
typeof(ScoreResultsPage),
|
||||
typeof(RankingResultsPage)
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -41,7 +43,7 @@ namespace osu.Game.Tests.Visual
|
||||
if (beatmapInfo != null)
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo);
|
||||
|
||||
Add(new Results(new ScoreInfo
|
||||
Add(new SoloResults(new ScoreInfo
|
||||
{
|
||||
TotalScore = 2845370,
|
||||
Accuracy = 0.98,
|
||||
|
@ -28,7 +28,6 @@ using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Storyboards.Drawables;
|
||||
|
||||
@ -288,7 +287,7 @@ namespace osu.Game.Screens.Play
|
||||
if (RulesetContainer.Replay == null)
|
||||
scoreManager.Import(score, true);
|
||||
|
||||
Push(new Results(score));
|
||||
Push(new SoloResults(score));
|
||||
|
||||
onCompletionEvent = null;
|
||||
});
|
||||
|
24
osu.Game/Screens/Play/SoloResults.cs
Normal file
24
osu.Game/Screens/Play/SoloResults.cs
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Screens.Ranking.Types;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class SoloResults : Results
|
||||
{
|
||||
public SoloResults(ScoreInfo score)
|
||||
: base(score)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IEnumerable<IResultPageInfo> CreateResultPages() => new IResultPageInfo[]
|
||||
{
|
||||
new ScoreOverviewPageInfo(Score, Beatmap),
|
||||
new BeatmapLeaderboardPageInfo(Score, Beatmap)
|
||||
};
|
||||
}
|
||||
}
|
@ -1,12 +1,16 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public enum ResultMode
|
||||
public interface IResultPageInfo
|
||||
{
|
||||
Summary,
|
||||
Ranking,
|
||||
Share
|
||||
FontAwesome Icon { get; }
|
||||
|
||||
string Name { get; }
|
||||
|
||||
ResultsPage CreatePage();
|
||||
}
|
||||
}
|
@ -3,18 +3,19 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Select.Leaderboards;
|
||||
using osuTK;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
namespace osu.Game.Screens.Ranking.Pages
|
||||
{
|
||||
public class ResultsPageRanking : ResultsPage
|
||||
public class RankingResultsPage : ResultsPage
|
||||
{
|
||||
public ResultsPageRanking(ScoreInfo score, WorkingBeatmap beatmap = null) : base(score, beatmap)
|
||||
public RankingResultsPage(ScoreInfo score, WorkingBeatmap beatmap = null)
|
||||
: base(score, beatmap)
|
||||
{
|
||||
}
|
||||
|
@ -4,36 +4,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Leaderboards;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Online.Leaderboards;
|
||||
using osu.Game.Scoring;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
namespace osu.Game.Screens.Ranking.Pages
|
||||
{
|
||||
public class ResultsPageScore : ResultsPage
|
||||
public class ScoreResultsPage : ResultsPage
|
||||
{
|
||||
private Container scoreContainer;
|
||||
private ScoreCounter scoreCounter;
|
||||
|
||||
public ResultsPageScore(ScoreInfo score, WorkingBeatmap beatmap) : base(score, beatmap) { }
|
||||
public ScoreResultsPage(ScoreInfo score, WorkingBeatmap beatmap)
|
||||
: base(score, beatmap)
|
||||
{
|
||||
}
|
||||
|
||||
private FillFlowContainer<DrawableScoreStatistic> statisticsContainer;
|
||||
|
@ -13,27 +13,17 @@ using osu.Framework.Graphics.Shapes;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public class ResultModeButton : TabItem<ResultMode>
|
||||
public class ResultModeButton : TabItem<IResultPageInfo>
|
||||
{
|
||||
private readonly FontAwesome icon;
|
||||
private Color4 activeColour;
|
||||
private Color4 inactiveColour;
|
||||
private CircularContainer colouredPart;
|
||||
|
||||
public ResultModeButton(ResultMode mode) : base(mode)
|
||||
public ResultModeButton(IResultPageInfo mode)
|
||||
: base(mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case ResultMode.Summary:
|
||||
icon = FontAwesome.fa_asterisk;
|
||||
break;
|
||||
case ResultMode.Ranking:
|
||||
icon = FontAwesome.fa_list;
|
||||
break;
|
||||
case ResultMode.Share:
|
||||
icon = FontAwesome.fa_camera;
|
||||
break;
|
||||
}
|
||||
icon = mode.Icon;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -7,7 +7,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public class ResultModeTabControl : TabControl<ResultMode>
|
||||
public class ResultModeTabControl : TabControl<IResultPageInfo>
|
||||
{
|
||||
public ResultModeTabControl()
|
||||
{
|
||||
@ -19,9 +19,9 @@ namespace osu.Game.Screens.Ranking
|
||||
TabContainer.Padding = new MarginPadding(5);
|
||||
}
|
||||
|
||||
protected override Dropdown<ResultMode> CreateDropdown() => null;
|
||||
protected override Dropdown<IResultPageInfo> CreateDropdown() => null;
|
||||
|
||||
protected override TabItem<ResultMode> CreateTabItem(ResultMode value) => new ResultModeButton(value)
|
||||
protected override TabItem<IResultPageInfo> CreateTabItem(IResultPageInfo value) => new ResultModeButton(value)
|
||||
{
|
||||
Anchor = TabContainer.Anchor,
|
||||
Origin = TabContainer.Origin
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
@ -21,9 +22,8 @@ using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public class Results : OsuScreen
|
||||
public abstract class Results : OsuScreen
|
||||
{
|
||||
private readonly ScoreInfo score;
|
||||
private Container circleOuterBackground;
|
||||
private Container circleOuter;
|
||||
private Container circleInner;
|
||||
@ -34,6 +34,8 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
public override bool AllowBeatmapRulesetChange => false;
|
||||
|
||||
protected readonly ScoreInfo Score;
|
||||
|
||||
private Container currentPage;
|
||||
|
||||
private static readonly Vector2 background_blur = new Vector2(20);
|
||||
@ -44,9 +46,9 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
private const float circle_outer_scale = 0.96f;
|
||||
|
||||
public Results(ScoreInfo score)
|
||||
protected Results(ScoreInfo score)
|
||||
{
|
||||
this.score = score;
|
||||
Score = score;
|
||||
}
|
||||
|
||||
private const float transition_time = 800;
|
||||
@ -67,7 +69,7 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
backgroundParallax.FadeOut();
|
||||
modeChangeButtons.FadeOut();
|
||||
currentPage.FadeOut();
|
||||
currentPage?.FadeOut();
|
||||
|
||||
circleOuterBackground
|
||||
.FadeIn(transition_time, Easing.OutQuint)
|
||||
@ -90,7 +92,7 @@ namespace osu.Game.Screens.Ranking
|
||||
using (BeginDelayedSequence(transition_time * 0.4f, true))
|
||||
{
|
||||
modeChangeButtons.FadeIn(transition_time, Easing.OutQuint);
|
||||
currentPage.FadeIn(transition_time, Easing.OutQuint);
|
||||
currentPage?.FadeIn(transition_time, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,7 +190,7 @@ namespace osu.Game.Screens.Ranking
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = $"{score.MaxCombo}x",
|
||||
Text = $"{Score.MaxCombo}x",
|
||||
TextSize = 40,
|
||||
RelativePositionAxes = Axes.X,
|
||||
Font = @"Exo2.0-Bold",
|
||||
@ -209,7 +211,7 @@ namespace osu.Game.Screens.Ranking
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = $"{score.Accuracy:P2}",
|
||||
Text = $"{Score.Accuracy:P2}",
|
||||
TextSize = 40,
|
||||
RelativePositionAxes = Axes.X,
|
||||
Font = @"Exo2.0-Bold",
|
||||
@ -262,30 +264,22 @@ namespace osu.Game.Screens.Ranking
|
||||
},
|
||||
};
|
||||
|
||||
modeChangeButtons.AddItem(ResultMode.Summary);
|
||||
modeChangeButtons.AddItem(ResultMode.Ranking);
|
||||
//modeChangeButtons.AddItem(ResultMode.Share);
|
||||
foreach (var t in CreateResultPages())
|
||||
modeChangeButtons.AddItem(t);
|
||||
modeChangeButtons.Current.Value = modeChangeButtons.Items.FirstOrDefault();
|
||||
|
||||
modeChangeButtons.Current.ValueChanged += mode =>
|
||||
modeChangeButtons.Current.BindValueChanged(m =>
|
||||
{
|
||||
currentPage?.FadeOut();
|
||||
currentPage?.Expire();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case ResultMode.Summary:
|
||||
currentPage = new ResultsPageScore(score, Beatmap.Value);
|
||||
break;
|
||||
case ResultMode.Ranking:
|
||||
currentPage = new ResultsPageRanking(score, Beatmap.Value);
|
||||
break;
|
||||
}
|
||||
currentPage = m?.CreatePage();
|
||||
|
||||
if (currentPage != null)
|
||||
circleInner.Add(currentPage);
|
||||
};
|
||||
|
||||
modeChangeButtons.Current.TriggerChange();
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected abstract IEnumerable<IResultPageInfo> CreateResultPages();
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public class ResultsPage : Container
|
||||
public abstract class ResultsPage : Container
|
||||
{
|
||||
protected readonly ScoreInfo Score;
|
||||
protected readonly WorkingBeatmap Beatmap;
|
||||
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
public ResultsPage(ScoreInfo score, WorkingBeatmap beatmap)
|
||||
protected ResultsPage(ScoreInfo score, WorkingBeatmap beatmap)
|
||||
{
|
||||
Score = score;
|
||||
Beatmap = beatmap;
|
||||
|
28
osu.Game/Screens/Ranking/Types/BeatmapLeaderboardPageInfo.cs
Normal file
28
osu.Game/Screens/Ranking/Types/BeatmapLeaderboardPageInfo.cs
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Ranking.Pages;
|
||||
|
||||
namespace osu.Game.Screens.Ranking.Types
|
||||
{
|
||||
public class BeatmapLeaderboardPageInfo : IResultPageInfo
|
||||
{
|
||||
private readonly ScoreInfo score;
|
||||
private readonly WorkingBeatmap beatmap;
|
||||
|
||||
public BeatmapLeaderboardPageInfo(ScoreInfo score, WorkingBeatmap beatmap)
|
||||
{
|
||||
this.score = score;
|
||||
this.beatmap = beatmap;
|
||||
}
|
||||
|
||||
public FontAwesome Icon => FontAwesome.fa_list;
|
||||
|
||||
public string Name => @"Beatmap Leaderboard";
|
||||
|
||||
public ResultsPage CreatePage() => new RankingResultsPage(score, beatmap);
|
||||
}
|
||||
}
|
30
osu.Game/Screens/Ranking/Types/ScoreOverviewPageInfo.cs
Normal file
30
osu.Game/Screens/Ranking/Types/ScoreOverviewPageInfo.cs
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Ranking.Pages;
|
||||
|
||||
namespace osu.Game.Screens.Ranking.Types
|
||||
{
|
||||
public class ScoreOverviewPageInfo : IResultPageInfo
|
||||
{
|
||||
public FontAwesome Icon => FontAwesome.fa_asterisk;
|
||||
|
||||
public string Name => "Overview";
|
||||
private readonly ScoreInfo score;
|
||||
private readonly WorkingBeatmap beatmap;
|
||||
|
||||
public ScoreOverviewPageInfo(ScoreInfo score, WorkingBeatmap beatmap)
|
||||
{
|
||||
this.score = score;
|
||||
this.beatmap = beatmap;
|
||||
}
|
||||
|
||||
public ResultsPage CreatePage()
|
||||
{
|
||||
return new ScoreResultsPage(score, beatmap);
|
||||
}
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Select.Options;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
@ -210,7 +210,7 @@ namespace osu.Game.Screens.Select
|
||||
});
|
||||
}
|
||||
|
||||
BeatmapDetails.Leaderboard.ScoreSelected += s => Push(new Results(s));
|
||||
BeatmapDetails.Leaderboard.ScoreSelected += s => Push(new SoloResults(s));
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
|
Loading…
Reference in New Issue
Block a user