mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:32:55 +08:00
Merge branch 'master' into tooltips
This commit is contained in:
commit
4ca27a5395
@ -1 +1 @@
|
||||
Subproject commit dc4ea5be425d37f3a0dd09f6acdf6799d42e3d74
|
||||
Subproject commit ccf0ff40d1261ad328d0182467a1f0c1a858b099
|
@ -1 +1 @@
|
||||
Subproject commit ce76f812d3e059233e1dea395b125352f638b2da
|
||||
Subproject commit b90c4ed490f76f2995662b3a8af3a32b8756a012
|
68
osu.Desktop.VisualTests/Tests/TestCaseResults.cs
Normal file
68
osu.Desktop.VisualTests/Tests/TestCaseResults.cs
Normal file
@ -0,0 +1,68 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
internal class TestCaseResults : TestCase
|
||||
{
|
||||
private BeatmapDatabase db;
|
||||
|
||||
public override string Description => @"Results after playing.";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapDatabase db)
|
||||
{
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
private WorkingBeatmap beatmap;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
if (beatmap == null)
|
||||
{
|
||||
var beatmapInfo = db.Query<BeatmapInfo>().FirstOrDefault(b => b.RulesetID == 0);
|
||||
if (beatmapInfo != null)
|
||||
beatmap = db.GetWorkingBeatmap(beatmapInfo);
|
||||
}
|
||||
|
||||
base.Reset();
|
||||
|
||||
Add(new Results(new Score
|
||||
{
|
||||
TotalScore = 2845370,
|
||||
Accuracy = 0.98,
|
||||
MaxCombo = 123,
|
||||
Rank = ScoreRank.A,
|
||||
Date = DateTime.Now,
|
||||
Statistics = new Dictionary<string, dynamic>()
|
||||
{
|
||||
{ "300", 50 },
|
||||
{ "100", 20 },
|
||||
{ "50", 50 },
|
||||
{ "x", 1 }
|
||||
},
|
||||
User = new User
|
||||
{
|
||||
Username = "peppy",
|
||||
}
|
||||
})
|
||||
{
|
||||
Beatmap = beatmap
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -198,6 +198,7 @@
|
||||
<Compile Include="Tests\TestCaseKeyCounter.cs" />
|
||||
<Compile Include="Tests\TestCaseMenuButtonSystem.cs" />
|
||||
<Compile Include="Tests\TestCaseReplay.cs" />
|
||||
<Compile Include="Tests\TestCaseResults.cs" />
|
||||
<Compile Include="Tests\TestCaseScoreCounter.cs" />
|
||||
<Compile Include="Tests\TestCaseTabControl.cs" />
|
||||
<Compile Include="Tests\TestCaseTaikoHitObjects.cs" />
|
||||
|
@ -12,6 +12,7 @@ using System.Diagnostics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu
|
||||
{
|
||||
@ -27,6 +28,11 @@ namespace osu.Game.Rulesets.Osu
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
|
||||
User = new User
|
||||
{
|
||||
Username = @"Autoplay",
|
||||
};
|
||||
|
||||
createAutoReplay();
|
||||
}
|
||||
|
||||
|
@ -1,11 +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.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Scoring
|
||||
{
|
||||
internal class OsuScore : Score
|
||||
{
|
||||
}
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
// Copyright (c) 2007-2017 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.Framework.Extensions;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
@ -26,12 +29,34 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
||||
|
||||
Health.Value = 1;
|
||||
Accuracy.Value = 1;
|
||||
|
||||
scoreResultCounts.Clear();
|
||||
comboResultCounts.Clear();
|
||||
}
|
||||
|
||||
private readonly Dictionary<OsuScoreResult, int> scoreResultCounts = new Dictionary<OsuScoreResult, int>();
|
||||
private readonly Dictionary<ComboResult, int> comboResultCounts = new Dictionary<ComboResult, int>();
|
||||
|
||||
public override void PopulateScore(Score score)
|
||||
{
|
||||
base.PopulateScore(score);
|
||||
|
||||
score.Statistics[@"300"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit300);
|
||||
score.Statistics[@"100"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit100);
|
||||
score.Statistics[@"50"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit50);
|
||||
score.Statistics[@"x"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Miss);
|
||||
}
|
||||
|
||||
protected override void OnNewJudgement(OsuJudgement judgement)
|
||||
{
|
||||
if (judgement != null)
|
||||
{
|
||||
if (judgement.Result != HitResult.None)
|
||||
{
|
||||
scoreResultCounts[judgement.Score] = scoreResultCounts.GetOrDefault(judgement.Score) + 1;
|
||||
comboResultCounts[judgement.Combo] = comboResultCounts.GetOrDefault(judgement.Combo) + 1;
|
||||
}
|
||||
|
||||
switch (judgement.Result)
|
||||
{
|
||||
case HitResult.Hit:
|
||||
|
@ -72,7 +72,6 @@
|
||||
<Compile Include="OsuAutoReplay.cs" />
|
||||
<Compile Include="OsuDifficultyCalculator.cs" />
|
||||
<Compile Include="OsuKeyConversionInputManager.cs" />
|
||||
<Compile Include="Scoring\OsuScore.cs" />
|
||||
<Compile Include="Scoring\OsuScoreProcessor.cs" />
|
||||
<Compile Include="UI\OsuHitRenderer.cs" />
|
||||
<Compile Include="UI\OsuPlayfield.cs" />
|
||||
|
@ -2,11 +2,13 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.IO.Legacy;
|
||||
using osu.Game.IPC;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using SharpCompress.Compressors.LZMA;
|
||||
using SQLite.Net;
|
||||
@ -42,8 +44,10 @@ namespace osu.Game.Database
|
||||
using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename)))
|
||||
using (SerializationReader sr = new SerializationReader(s))
|
||||
{
|
||||
var ruleset = rulesets.GetRuleset(sr.ReadByte()).CreateInstance();
|
||||
score = ruleset.CreateScoreProcessor().CreateScore();
|
||||
score = new Score
|
||||
{
|
||||
Ruleset = rulesets.GetRuleset(sr.ReadByte())
|
||||
};
|
||||
|
||||
/* score.Pass = true;*/
|
||||
var version = sr.ReadInt32();
|
||||
@ -104,13 +108,43 @@ namespace osu.Game.Database
|
||||
|
||||
using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize))
|
||||
using (var reader = new StreamReader(lzma))
|
||||
score.Replay = score.CreateReplay(reader);
|
||||
score.Replay = createReplay(reader);
|
||||
}
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a replay which is read from a stream.
|
||||
/// </summary>
|
||||
/// <param name="reader">The stream reader.</param>
|
||||
/// <returns>The replay.</returns>
|
||||
private Replay createReplay(StreamReader reader)
|
||||
{
|
||||
var frames = new List<ReplayFrame>();
|
||||
|
||||
float lastTime = 0;
|
||||
|
||||
foreach (var l in reader.ReadToEnd().Split(','))
|
||||
{
|
||||
var split = l.Split('|');
|
||||
|
||||
if (split.Length < 4 || float.Parse(split[0]) < 0) continue;
|
||||
|
||||
lastTime += float.Parse(split[0]);
|
||||
|
||||
frames.Add(new ReplayFrame(
|
||||
lastTime,
|
||||
float.Parse(split[1]),
|
||||
384 - float.Parse(split[2]),
|
||||
(ReplayButtonState)int.Parse(split[3])
|
||||
));
|
||||
}
|
||||
|
||||
return new Replay { Frames = frames };
|
||||
}
|
||||
|
||||
protected override void Prepare(bool reset = false)
|
||||
{
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ namespace osu.Game
|
||||
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic"));
|
||||
|
||||
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera"));
|
||||
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light"));
|
||||
|
||||
OszArchiveReader.Register();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Rulesets.Replays
|
||||
{
|
||||
@ -9,6 +10,8 @@ namespace osu.Game.Rulesets.Replays
|
||||
{
|
||||
protected const double KEY_UP_DELAY = 50;
|
||||
|
||||
public User User;
|
||||
|
||||
public List<ReplayFrame> Frames = new List<ReplayFrame>();
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,12 @@ namespace osu.Game.Rulesets
|
||||
|
||||
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to create a HitRenderer for the provided beatmap.
|
||||
/// </summary>
|
||||
/// <param name="beatmap"></param>
|
||||
/// <exception cref="BeatmapInvalidForRulesetException">Unable to successfully load the beatmap to be usable with this ruleset.</exception>
|
||||
/// <returns></returns>
|
||||
public abstract HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap);
|
||||
|
||||
public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap);
|
||||
|
@ -7,7 +7,6 @@ using Newtonsoft.Json;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Users;
|
||||
using System.IO;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.Scoring
|
||||
@ -33,6 +32,8 @@ namespace osu.Game.Rulesets.Scoring
|
||||
[JsonProperty(@"mods")]
|
||||
protected string[] ModStrings { get; set; } //todo: parse to Mod objects
|
||||
|
||||
public RulesetInfo Ruleset { get; set; }
|
||||
|
||||
public Mod[] Mods { get; set; }
|
||||
|
||||
[JsonProperty(@"user")]
|
||||
@ -49,51 +50,6 @@ namespace osu.Game.Rulesets.Scoring
|
||||
[JsonProperty(@"created_at")]
|
||||
public DateTime Date;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a replay which is read from a stream.
|
||||
/// </summary>
|
||||
/// <param name="reader">The stream reader.</param>
|
||||
/// <returns>The replay.</returns>
|
||||
public virtual Replay CreateReplay(StreamReader reader)
|
||||
{
|
||||
var frames = new List<ReplayFrame>();
|
||||
|
||||
float lastTime = 0;
|
||||
|
||||
foreach (var l in reader.ReadToEnd().Split(','))
|
||||
{
|
||||
var split = l.Split('|');
|
||||
|
||||
if (split.Length < 4 || float.Parse(split[0]) < 0) continue;
|
||||
|
||||
lastTime += float.Parse(split[0]);
|
||||
|
||||
frames.Add(new ReplayFrame(
|
||||
lastTime,
|
||||
float.Parse(split[1]),
|
||||
384 - float.Parse(split[2]),
|
||||
(ReplayButtonState)int.Parse(split[3])
|
||||
));
|
||||
}
|
||||
|
||||
return new Replay { Frames = frames };
|
||||
}
|
||||
|
||||
// [JsonProperty(@"count50")] 0,
|
||||
//[JsonProperty(@"count100")] 0,
|
||||
//[JsonProperty(@"count300")] 100,
|
||||
//[JsonProperty(@"countmiss")] 0,
|
||||
//[JsonProperty(@"countkatu")] 0,
|
||||
//[JsonProperty(@"countgeki")] 31,
|
||||
//[JsonProperty(@"perfect")] true,
|
||||
//[JsonProperty(@"enabled_mods")] [
|
||||
// "DT",
|
||||
// "FL",
|
||||
// "HD",
|
||||
// "HR"
|
||||
//],
|
||||
//[JsonProperty(@"rank")] "XH",
|
||||
//[JsonProperty(@"pp")] 26.1816,
|
||||
//[JsonProperty(@"replay")] true
|
||||
public Dictionary<string, dynamic> Statistics = new Dictionary<string, dynamic>();
|
||||
}
|
||||
}
|
||||
|
@ -61,18 +61,20 @@ namespace osu.Game.Rulesets.Scoring
|
||||
Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Score applicable to the ruleset in which this ScoreProcessor resides.
|
||||
/// </summary>
|
||||
/// <returns>The Score.</returns>
|
||||
public virtual Score CreateScore() => new Score
|
||||
private ScoreRank rankFrom(double acc)
|
||||
{
|
||||
TotalScore = TotalScore,
|
||||
Combo = Combo,
|
||||
MaxCombo = HighestCombo,
|
||||
Accuracy = Accuracy,
|
||||
Health = Health,
|
||||
};
|
||||
if (acc == 1)
|
||||
return ScoreRank.X;
|
||||
if (acc > 0.95)
|
||||
return ScoreRank.S;
|
||||
if (acc > 0.9)
|
||||
return ScoreRank.A;
|
||||
if (acc > 0.8)
|
||||
return ScoreRank.B;
|
||||
if (acc > 0.7)
|
||||
return ScoreRank.C;
|
||||
return ScoreRank.D;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets this ScoreProcessor to a default state.
|
||||
@ -102,6 +104,20 @@ namespace osu.Game.Rulesets.Scoring
|
||||
alreadyFailed = true;
|
||||
Failed?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve a score populated with data for the current play this processor is responsible for.
|
||||
/// </summary>
|
||||
public virtual void PopulateScore(Score score)
|
||||
{
|
||||
score.TotalScore = TotalScore;
|
||||
score.Combo = Combo;
|
||||
score.MaxCombo = HighestCombo;
|
||||
score.Accuracy = Accuracy;
|
||||
score.Rank = rankFrom(Accuracy);
|
||||
score.Date = DateTime.Now;
|
||||
score.Health = Health;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class ScoreProcessor<TObject, TJudgement> : ScoreProcessor
|
||||
|
@ -91,11 +91,17 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay);
|
||||
|
||||
public Replay Replay { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets a replay to be used, overriding local input.
|
||||
/// </summary>
|
||||
/// <param name="replay">The replay, null for local input.</param>
|
||||
public void SetReplay(Replay replay) => InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
|
||||
public void SetReplay(Replay replay)
|
||||
{
|
||||
Replay = replay;
|
||||
InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -125,7 +131,7 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
// Check if the beatmap can be converted
|
||||
if (!converter.CanConvert(beatmap.Beatmap))
|
||||
throw new BeatmapInvalidForModeException($"{nameof(Beatmap)} can't be converted for the current ruleset.");
|
||||
throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can't be converted for the current ruleset.");
|
||||
|
||||
// Convert the beatmap
|
||||
Beatmap = converter.Convert(beatmap.Beatmap);
|
||||
@ -273,9 +279,9 @@ namespace osu.Game.Rulesets.UI
|
||||
protected abstract Playfield<TObject, TJudgement> CreatePlayfield();
|
||||
}
|
||||
|
||||
public class BeatmapInvalidForModeException : Exception
|
||||
public class BeatmapInvalidForRulesetException : Exception
|
||||
{
|
||||
public BeatmapInvalidForModeException(string text)
|
||||
public BeatmapInvalidForRulesetException(string text)
|
||||
: base(text)
|
||||
{
|
||||
}
|
||||
|
@ -17,11 +17,11 @@ using osu.Game.Database;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play
|
||||
private IAdjustableClock sourceClock;
|
||||
private IFrameBasedClock interpolatedSourceClock;
|
||||
|
||||
private Ruleset ruleset;
|
||||
private RulesetInfo ruleset;
|
||||
|
||||
private ScoreProcessor scoreProcessor;
|
||||
protected HitRenderer HitRenderer;
|
||||
@ -68,6 +68,8 @@ namespace osu.Game.Screens.Play
|
||||
dimLevel = config.GetBindable<int>(OsuConfig.DimLevel);
|
||||
mouseWheelDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableWheel);
|
||||
|
||||
Ruleset rulesetInstance;
|
||||
|
||||
try
|
||||
{
|
||||
if (Beatmap == null)
|
||||
@ -79,17 +81,20 @@ namespace osu.Game.Screens.Play
|
||||
if (Beatmap == null)
|
||||
throw new Exception("Beatmap was not loaded");
|
||||
|
||||
ruleset = osu?.Ruleset.Value ?? Beatmap.BeatmapInfo.Ruleset;
|
||||
rulesetInstance = ruleset.CreateInstance();
|
||||
|
||||
try
|
||||
{
|
||||
// Try using the preferred user ruleset
|
||||
ruleset = osu == null ? Beatmap.BeatmapInfo.Ruleset.CreateInstance() : osu.Ruleset.Value.CreateInstance();
|
||||
HitRenderer = ruleset.CreateHitRendererWith(Beatmap);
|
||||
HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap);
|
||||
}
|
||||
catch (BeatmapInvalidForModeException)
|
||||
catch (BeatmapInvalidForRulesetException)
|
||||
{
|
||||
// Default to the beatmap ruleset
|
||||
ruleset = Beatmap.BeatmapInfo.Ruleset.CreateInstance();
|
||||
HitRenderer = ruleset.CreateHitRendererWith(Beatmap);
|
||||
// we may fail to create a HitRenderer if the beatmap cannot be loaded with the user's preferred ruleset
|
||||
// let's try again forcing the beatmap's ruleset.
|
||||
ruleset = Beatmap.BeatmapInfo.Ruleset;
|
||||
rulesetInstance = ruleset.CreateInstance();
|
||||
HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -125,7 +130,7 @@ namespace osu.Game.Screens.Play
|
||||
Origin = Anchor.Centre
|
||||
};
|
||||
|
||||
hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys());
|
||||
hudOverlay.KeyCounter.Add(rulesetInstance.CreateGameplayKeys());
|
||||
hudOverlay.BindProcessor(scoreProcessor);
|
||||
hudOverlay.BindHitRenderer(HitRenderer);
|
||||
|
||||
@ -266,10 +271,14 @@ namespace osu.Game.Screens.Play
|
||||
Delay(1000);
|
||||
onCompletionEvent = Schedule(delegate
|
||||
{
|
||||
Push(new Results
|
||||
var score = new Score
|
||||
{
|
||||
Score = scoreProcessor.CreateScore()
|
||||
});
|
||||
Beatmap = Beatmap.BeatmapInfo,
|
||||
Ruleset = ruleset
|
||||
};
|
||||
scoreProcessor.PopulateScore(score);
|
||||
score.User = HitRenderer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value;
|
||||
Push(new Results(score));
|
||||
});
|
||||
}
|
||||
|
||||
|
20
osu.Game/Screens/Ranking/AspectContainer.cs
Normal file
20
osu.Game/Screens/Ranking/AspectContainer.cs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public class AspectContainer : Container
|
||||
{
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if (RelativeSizeAxes == Axes.X)
|
||||
Height = DrawWidth;
|
||||
else
|
||||
Width = DrawHeight;
|
||||
}
|
||||
}
|
||||
}
|
12
osu.Game/Screens/Ranking/ResultMode.cs
Normal file
12
osu.Game/Screens/Ranking/ResultMode.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public enum ResultMode
|
||||
{
|
||||
Summary,
|
||||
Ranking,
|
||||
Share
|
||||
}
|
||||
}
|
108
osu.Game/Screens/Ranking/ResultModeButton.cs
Normal file
108
osu.Game/Screens/Ranking/ResultModeButton.cs
Normal file
@ -0,0 +1,108 @@
|
||||
// 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.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public class ResultModeButton : TabItem<ResultMode>
|
||||
{
|
||||
private readonly FontAwesome icon;
|
||||
private Color4 activeColour;
|
||||
private Color4 inactiveColour;
|
||||
private CircularContainer colouredPart;
|
||||
|
||||
public ResultModeButton(ResultMode 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;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Active
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Active;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Active = value;
|
||||
colouredPart.FadeColour(Active ? activeColour : inactiveColour, 200, EasingTypes.OutQuint);
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Size = new Vector2(50);
|
||||
|
||||
Masking = true;
|
||||
CornerRadius = 25;
|
||||
|
||||
activeColour = colours.PinkDarker;
|
||||
inactiveColour = OsuColour.Gray(0.8f);
|
||||
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0.4f),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Radius = 5,
|
||||
};
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White,
|
||||
},
|
||||
colouredPart = new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(0.8f),
|
||||
BorderThickness = 4,
|
||||
BorderColour = Color4.White,
|
||||
Colour = inactiveColour,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
AlwaysPresent = true, //for border rendering
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Transparent,
|
||||
},
|
||||
new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Shadow = false,
|
||||
Colour = OsuColour.Gray(0.95f),
|
||||
Icon = icon,
|
||||
TextSize = 20,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
31
osu.Game/Screens/Ranking/ResultModeTabControl.cs
Normal file
31
osu.Game/Screens/Ranking/ResultModeTabControl.cs
Normal file
@ -0,0 +1,31 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public class ResultModeTabControl : TabControl<ResultMode>
|
||||
{
|
||||
public ResultModeTabControl()
|
||||
{
|
||||
TabContainer.Anchor = Anchor.BottomCentre;
|
||||
TabContainer.Origin = Anchor.BottomCentre;
|
||||
TabContainer.Spacing = new Vector2(15);
|
||||
|
||||
TabContainer.Masking = false;
|
||||
TabContainer.Padding = new MarginPadding(5);
|
||||
}
|
||||
|
||||
protected override Dropdown<ResultMode> CreateDropdown() => null;
|
||||
|
||||
protected override TabItem<ResultMode> CreateTabItem(ResultMode value) => new ResultModeButton(value)
|
||||
{
|
||||
Anchor = TabContainer.Anchor,
|
||||
Origin = TabContainer.Origin
|
||||
};
|
||||
}
|
||||
}
|
@ -1,93 +1,281 @@
|
||||
// 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.Screens;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
internal class Results : OsuScreen
|
||||
public class Results : OsuScreen
|
||||
{
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
private readonly Score score;
|
||||
private Container circleOuterBackground;
|
||||
private Container circleOuter;
|
||||
private Container circleInner;
|
||||
|
||||
private ParallaxContainer backgroundParallax;
|
||||
|
||||
private ResultModeTabControl modeChangeButtons;
|
||||
|
||||
private Container currentPage;
|
||||
|
||||
private static readonly Vector2 background_blur = new Vector2(20);
|
||||
|
||||
private ScoreDisplay scoreDisplay;
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
|
||||
private const float overscan = 1.3f;
|
||||
|
||||
private const float circle_outer_scale = 0.96f;
|
||||
|
||||
public Results(Score score)
|
||||
{
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
private const float transition_time = 800;
|
||||
|
||||
private IEnumerable<Drawable> allCircles => new Drawable[] { circleOuterBackground, circleInner, circleOuter };
|
||||
|
||||
protected override void OnEntering(Screen last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
Background.Schedule(() => (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 1000));
|
||||
(Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, EasingTypes.OutQuint);
|
||||
|
||||
allCircles.ForEach(c =>
|
||||
{
|
||||
c.FadeOut();
|
||||
c.ScaleTo(0);
|
||||
});
|
||||
|
||||
backgroundParallax.FadeOut();
|
||||
modeChangeButtons.FadeOut();
|
||||
currentPage.FadeOut();
|
||||
|
||||
circleOuterBackground.ScaleTo(1, transition_time, EasingTypes.OutQuint);
|
||||
circleOuterBackground.FadeTo(1, transition_time, EasingTypes.OutQuint);
|
||||
|
||||
Content.Delay(transition_time * 0.25f, true);
|
||||
|
||||
circleOuter.ScaleTo(1, transition_time, EasingTypes.OutQuint);
|
||||
circleOuter.FadeTo(1, transition_time, EasingTypes.OutQuint);
|
||||
|
||||
Content.Delay(transition_time * 0.3f, true);
|
||||
|
||||
backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint);
|
||||
|
||||
circleInner.ScaleTo(1, transition_time, EasingTypes.OutQuint);
|
||||
circleInner.FadeTo(1, transition_time, EasingTypes.OutQuint);
|
||||
|
||||
Content.Delay(transition_time * 0.4f, true);
|
||||
|
||||
modeChangeButtons.FadeIn(transition_time, EasingTypes.OutQuint);
|
||||
currentPage.FadeIn(transition_time, EasingTypes.OutQuint);
|
||||
|
||||
Content.DelayReset();
|
||||
}
|
||||
|
||||
protected override bool OnExiting(Screen next)
|
||||
{
|
||||
Background.Schedule(() => Background.FadeColour(Color4.White, 500));
|
||||
allCircles.ForEach(c =>
|
||||
{
|
||||
c.ScaleTo(0, transition_time, EasingTypes.OutSine);
|
||||
});
|
||||
|
||||
Content.FadeOut(transition_time / 4);
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
public Score Score
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
set
|
||||
{
|
||||
scoreDisplay?.FadeOut(500);
|
||||
scoreDisplay?.Expire();
|
||||
|
||||
scoreDisplay = new ScoreDisplay(value)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
|
||||
Add(scoreDisplay);
|
||||
|
||||
scoreDisplay.FadeIn(500);
|
||||
scoreDisplay.ScaleTo(0.1f);
|
||||
scoreDisplay.ScaleTo(1, 1000, EasingTypes.OutElastic);
|
||||
scoreDisplay.RotateTo(360 * 5, 1000, EasingTypes.OutElastic);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class ScoreDisplay : Container
|
||||
{
|
||||
public ScoreDisplay(Score s)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
new AspectContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Height = overscan,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
circleOuterBackground = new CircularContainer
|
||||
{
|
||||
TextSize = 40,
|
||||
Text = $@"Accuracy: {s.Accuracy:#0.00%}",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Alpha = 0.2f,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
}
|
||||
}
|
||||
},
|
||||
new OsuSpriteText
|
||||
circleOuter = new CircularContainer
|
||||
{
|
||||
TextSize = 40,
|
||||
Text = $@"Score: {s.TotalScore}",
|
||||
Size = new Vector2(circle_outer_scale),
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0.4f),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Radius = 15,
|
||||
},
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White,
|
||||
},
|
||||
backgroundParallax = new ParallaxContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ParallaxAmount = 0.01f,
|
||||
Scale = new Vector2(1 / circle_outer_scale / overscan),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Sprite
|
||||
{
|
||||
Alpha = 0.2f,
|
||||
Texture = Beatmap?.Background,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fill
|
||||
}
|
||||
}
|
||||
},
|
||||
modeChangeButtons = new ResultModeTabControl
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 50,
|
||||
Margin = new MarginPadding { Bottom = 110 },
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = $"{score.MaxCombo}x",
|
||||
TextSize = 40,
|
||||
RelativePositionAxes = Axes.X,
|
||||
Font = @"Exo2.0-Bold",
|
||||
X = 0.1f,
|
||||
Colour = colours.BlueDarker,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.BottomCentre,
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = "max combo",
|
||||
TextSize = 20,
|
||||
RelativePositionAxes = Axes.X,
|
||||
X = 0.1f,
|
||||
Colour = colours.Gray6,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = $"{score.Accuracy:P2}",
|
||||
TextSize = 40,
|
||||
RelativePositionAxes = Axes.X,
|
||||
Font = @"Exo2.0-Bold",
|
||||
X = 0.9f,
|
||||
Colour = colours.BlueDarker,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.BottomCentre,
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = "accuracy",
|
||||
TextSize = 20,
|
||||
RelativePositionAxes = Axes.X,
|
||||
X = 0.9f,
|
||||
Colour = colours.Gray6,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
}
|
||||
},
|
||||
new OsuSpriteText
|
||||
circleInner = new CircularContainer
|
||||
{
|
||||
TextSize = 40,
|
||||
Text = $@"MaxCombo: {s.MaxCombo}",
|
||||
Size = new Vector2(0.6f),
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0.4f),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Radius = 15,
|
||||
},
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new BackButton
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Action = Exit
|
||||
},
|
||||
};
|
||||
|
||||
modeChangeButtons.AddItem(ResultMode.Summary);
|
||||
modeChangeButtons.AddItem(ResultMode.Ranking);
|
||||
//modeChangeButtons.AddItem(ResultMode.Share);
|
||||
|
||||
modeChangeButtons.Current.ValueChanged += mode =>
|
||||
{
|
||||
currentPage?.FadeOut();
|
||||
currentPage?.Expire();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case ResultMode.Summary:
|
||||
currentPage = new ResultsPageScore(score, Beatmap);
|
||||
break;
|
||||
case ResultMode.Ranking:
|
||||
currentPage = new ResultsPageRanking(score, Beatmap);
|
||||
break;
|
||||
}
|
||||
|
||||
if (currentPage != null)
|
||||
circleInner.Add(currentPage);
|
||||
};
|
||||
|
||||
modeChangeButtons.Current.TriggerChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
92
osu.Game/Screens/Ranking/ResultsPage.cs
Normal file
92
osu.Game/Screens/Ranking/ResultsPage.cs
Normal file
@ -0,0 +1,92 @@
|
||||
// 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.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
internal class ResultsPage : Container
|
||||
{
|
||||
protected readonly Score Score;
|
||||
protected readonly WorkingBeatmap Beatmap;
|
||||
private CircularContainer content;
|
||||
private Box fill;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
public ResultsPage(Score score, WorkingBeatmap beatmap)
|
||||
{
|
||||
Score = score;
|
||||
Beatmap = beatmap;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
fill.Delay(400);
|
||||
fill.FadeInFromZero(600);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AddInternal(new Drawable[]
|
||||
{
|
||||
fill = new Box
|
||||
{
|
||||
Alpha = 0,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.Gray6
|
||||
},
|
||||
new CircularContainer
|
||||
{
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Colour = colours.GrayF.Opacity(0.8f),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Radius = 1,
|
||||
},
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
BorderThickness = 20,
|
||||
BorderColour = Color4.White,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
},
|
||||
}
|
||||
},
|
||||
content = new CircularContainer
|
||||
{
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0.2f),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Radius = 15,
|
||||
},
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Size = new Vector2(0.88f),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
42
osu.Game/Screens/Ranking/ResultsPageRanking.cs
Normal file
42
osu.Game/Screens/Ranking/ResultsPageRanking.cs
Normal file
@ -0,0 +1,42 @@
|
||||
// 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.Sprites;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Select.Leaderboards;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
internal class ResultsPageRanking : ResultsPage
|
||||
{
|
||||
public ResultsPageRanking(Score score, WorkingBeatmap beatmap = null) : base(score, beatmap)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = colours.GrayE,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new Leaderboard
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Beatmap = Beatmap.BeatmapInfo ?? Score.Beatmap,
|
||||
Scale = new Vector2(0.7f)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
393
osu.Game/Screens/Ranking/ResultsPageScore.cs
Normal file
393
osu.Game/Screens/Ranking/ResultsPageScore.cs
Normal file
@ -0,0 +1,393 @@
|
||||
// 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.Screens.Select.Leaderboards;
|
||||
using osu.Game.Users;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
internal class ResultsPageScore : ResultsPage
|
||||
{
|
||||
private ScoreCounter scoreCounter;
|
||||
|
||||
public ResultsPageScore(Score score, WorkingBeatmap beatmap) : base(score, beatmap) { }
|
||||
|
||||
private FillFlowContainer<DrawableScoreStatistic> statisticsContainer;
|
||||
|
||||
[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),
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 60,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SongProgressGraph
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.5f,
|
||||
Objects = Beatmap.Beatmap.HitObjects,
|
||||
},
|
||||
scoreCounter = new SlowScoreCounter(6)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Colour = colours.PinkDarker,
|
||||
Y = 10,
|
||||
TextSize = 56,
|
||||
},
|
||||
}
|
||||
},
|
||||
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 = 15 },
|
||||
},
|
||||
new BeatmapDetails(Beatmap.BeatmapInfo)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Bottom = 10 },
|
||||
},
|
||||
new DateDisplay(Score.Date)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Size = new Vector2(0.75f, 1),
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Top = 10, Bottom = 10 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
ColourInfo = ColourInfo.GradientHorizontal(
|
||||
colours.GrayC.Opacity(0),
|
||||
colours.GrayC.Opacity(0.9f)),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(0.5f, 1),
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
ColourInfo = ColourInfo.GradientHorizontal(
|
||||
colours.GrayC.Opacity(0.9f),
|
||||
colours.GrayC.Opacity(0)),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(0.5f, 1),
|
||||
},
|
||||
}
|
||||
},
|
||||
statisticsContainer = new FillFlowContainer<DrawableScoreStatistic>
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Direction = FillDirection.Horizontal,
|
||||
LayoutDuration = 200,
|
||||
LayoutEasing = EasingTypes.OutQuint
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
statisticsContainer.Children = Score.Statistics.Select(s => new DrawableScoreStatistic(s));
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Schedule(() =>
|
||||
{
|
||||
scoreCounter.Increment(Score.TotalScore);
|
||||
|
||||
int delay = 0;
|
||||
foreach (var s in statisticsContainer.Children)
|
||||
{
|
||||
s.FadeOut();
|
||||
s.Delay(delay += 200);
|
||||
s.FadeIn(300 + delay, EasingTypes.Out);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private class DrawableScoreStatistic : Container
|
||||
{
|
||||
private readonly KeyValuePair<string, dynamic> statistic;
|
||||
|
||||
public DrawableScoreStatistic(KeyValuePair<string, dynamic> statistic)
|
||||
{
|
||||
this.statistic = statistic;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Margin = new MarginPadding { Left = 5, Right = 5 };
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText {
|
||||
Text = statistic.Value.ToString().PadLeft(4, '0'),
|
||||
Colour = colours.Gray7,
|
||||
TextSize = 30,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
new SpriteText {
|
||||
Text = statistic.Key,
|
||||
Colour = colours.Gray7,
|
||||
Font = @"Exo2.0-Bold",
|
||||
Y = 26,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (user.Cover?.Url != null)
|
||||
cover.Texture = textures.Get(user.Cover?.Url);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
DisplayedCountSpriteText.Font = @"Venera-Light";
|
||||
UseCommaSeparator = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -23,6 +23,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
private readonly ScrollContainer scrollContainer;
|
||||
private readonly FillFlowContainer<LeaderboardScore> scrollFlow;
|
||||
|
||||
public Action<Score> ScoreSelected;
|
||||
|
||||
private IEnumerable<Score> scores;
|
||||
public IEnumerable<Score> Scores
|
||||
{
|
||||
@ -52,6 +54,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
var ls = new LeaderboardScore(s, 1 + i)
|
||||
{
|
||||
AlwaysPresent = true,
|
||||
Action = () => ScoreSelected?.Invoke(s),
|
||||
State = Visibility.Hidden,
|
||||
};
|
||||
scrollFlow.Add(ls);
|
||||
|
@ -17,7 +17,7 @@ using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
public class LeaderboardScore : Container, IStateful<Visibility>
|
||||
public class LeaderboardScore : ClickableContainer, IStateful<Visibility>
|
||||
{
|
||||
public static readonly float HEIGHT = 60;
|
||||
|
||||
|
@ -12,6 +12,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -35,6 +36,8 @@ namespace osu.Game.Screens.Select
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = 10, Right = 5 },
|
||||
});
|
||||
|
||||
beatmapDetails.Leaderboard.ScoreSelected += s => Push(new Results(s));
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -40,6 +40,4 @@ namespace osu.Game.Users
|
||||
public int? Id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -57,6 +57,7 @@
|
||||
<HintPath>$(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="DotNetZip">
|
||||
@ -206,6 +207,9 @@
|
||||
<Compile Include="Screens\Edit\Editor.cs" />
|
||||
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
|
||||
<Compile Include="Screens\Play\SquareGraph.cs" />
|
||||
<Compile Include="Screens\Ranking\ResultsPage.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" />
|
||||
@ -229,6 +233,10 @@
|
||||
<Compile Include="Screens\Play\ReplayPlayer.cs" />
|
||||
<Compile Include="Screens\Play\SkipButton.cs" />
|
||||
<Compile Include="Rulesets\UI\StandardComboCounter.cs" />
|
||||
<Compile Include="Screens\Ranking\AspectContainer.cs" />
|
||||
<Compile Include="Screens\Ranking\ResultMode.cs" />
|
||||
<Compile Include="Screens\Ranking\ResultModeButton.cs" />
|
||||
<Compile Include="Screens\Ranking\ResultModeTabControl.cs" />
|
||||
<Compile Include="Screens\Select\BeatmapCarousel.cs" />
|
||||
<Compile Include="Screens\Select\BeatmapDetails.cs" />
|
||||
<Compile Include="Graphics\UserInterface\BarGraph.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user