1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 20:47:26 +08:00

Merge branch 'master' into master

This commit is contained in:
Ivan Pavluk 2018-12-06 14:51:13 +07:00 committed by GitHub
commit 881a00f4a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 29 deletions

View File

@ -40,8 +40,11 @@ namespace osu.Desktop.Updater
} }
private async void checkForUpdateAsync() private async void checkForUpdateAsync()
{
try
{ {
var releases = new JsonWebRequest<GitHubRelease>("https://api.github.com/repos/ppy/osu/releases/latest"); var releases = new JsonWebRequest<GitHubRelease>("https://api.github.com/repos/ppy/osu/releases/latest");
await releases.PerformAsync(); await releases.PerformAsync();
var latest = releases.ResponseObject; var latest = releases.ResponseObject;
@ -61,6 +64,11 @@ namespace osu.Desktop.Updater
}); });
} }
} }
catch
{
// we shouldn't crash on a web failure. or any failure for the matter.
}
}
private string getBestUrl(GitHubRelease release) private string getBestUrl(GitHubRelease release)
{ {

View File

@ -100,7 +100,7 @@ namespace osu.Game.Tests.Scores.IO
var toImport = new ScoreInfo var toImport = new ScoreInfo
{ {
Statistics = new Dictionary<HitResult, object> Statistics = new Dictionary<HitResult, int>
{ {
{ HitResult.Perfect, 100 }, { HitResult.Perfect, 100 },
{ HitResult.Miss, 50 } { HitResult.Miss, 50 }

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual
MaxCombo = 123, MaxCombo = 123,
Rank = ScoreRank.A, Rank = ScoreRank.A,
Date = DateTimeOffset.Now, Date = DateTimeOffset.Now,
Statistics = new Dictionary<HitResult, dynamic> Statistics = new Dictionary<HitResult, int>
{ {
{ HitResult.Great, 50 }, { HitResult.Great, 50 },
{ HitResult.Good, 20 }, { HitResult.Good, 20 },

View File

@ -249,10 +249,13 @@ namespace osu.Game.Beatmaps
/// Retrieve a <see cref="WorkingBeatmap"/> instance for the provided <see cref="BeatmapInfo"/> /// Retrieve a <see cref="WorkingBeatmap"/> instance for the provided <see cref="BeatmapInfo"/>
/// </summary> /// </summary>
/// <param name="beatmapInfo">The beatmap to lookup.</param> /// <param name="beatmapInfo">The beatmap to lookup.</param>
/// <param name="previous">The currently loaded <see cref="WorkingBeatmap"/>. Allows for optimisation where elements are shared with the new beatmap.</param> /// <param name="previous">The currently loaded <see cref="WorkingBeatmap"/>. Allows for optimisation where elements are shared with the new beatmap. May be returned if beatmapInfo requested matches</param>
/// <returns>A <see cref="WorkingBeatmap"/> instance correlating to the provided <see cref="BeatmapInfo"/>.</returns> /// <returns>A <see cref="WorkingBeatmap"/> instance correlating to the provided <see cref="BeatmapInfo"/>.</returns>
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
{ {
if (beatmapInfo?.ID > 0 && previous != null && previous.BeatmapInfo?.ID == beatmapInfo.ID)
return previous;
if (beatmapInfo?.BeatmapSet == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) if (beatmapInfo?.BeatmapSet == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
return DefaultBeatmap; return DefaultBeatmap;

View File

@ -65,7 +65,7 @@ namespace osu.Game.Online.API.Requests.Responses
} }
[JsonProperty(@"statistics")] [JsonProperty(@"statistics")]
private Dictionary<string, object> jsonStats private Dictionary<string, int> jsonStats
{ {
set set
{ {

View File

@ -116,12 +116,12 @@ namespace osu.Game.Scoring.Legacy
private void calculateAccuracy(ScoreInfo score) private void calculateAccuracy(ScoreInfo score)
{ {
int countMiss = (int)score.Statistics[HitResult.Miss]; int countMiss = score.Statistics[HitResult.Miss];
int count50 = (int)score.Statistics[HitResult.Meh]; int count50 = score.Statistics[HitResult.Meh];
int count100 = (int)score.Statistics[HitResult.Good]; int count100 = score.Statistics[HitResult.Good];
int count300 = (int)score.Statistics[HitResult.Great]; int count300 = score.Statistics[HitResult.Great];
int countGeki = (int)score.Statistics[HitResult.Perfect]; int countGeki = score.Statistics[HitResult.Perfect];
int countKatu = (int)score.Statistics[HitResult.Ok]; int countKatu = score.Statistics[HitResult.Ok];
switch (score.Ruleset.ID) switch (score.Ruleset.ID)
{ {

View File

@ -104,7 +104,7 @@ namespace osu.Game.Scoring
public DateTimeOffset Date { get; set; } public DateTimeOffset Date { get; set; }
[JsonIgnore] [JsonIgnore]
public Dictionary<HitResult, object> Statistics = new Dictionary<HitResult, object>(); public Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>();
[Column("Statistics")] [Column("Statistics")]
public string StatisticsJson public string StatisticsJson
@ -118,7 +118,7 @@ namespace osu.Game.Scoring
return; return;
} }
Statistics = JsonConvert.DeserializeObject<Dictionary<HitResult, object>>(value); Statistics = JsonConvert.DeserializeObject<Dictionary<HitResult, int>>(value);
} }
} }

View File

@ -196,9 +196,9 @@ namespace osu.Game.Screens.Ranking
private class DrawableScoreStatistic : Container private class DrawableScoreStatistic : Container
{ {
private readonly KeyValuePair<HitResult, object> statistic; private readonly KeyValuePair<HitResult, int> statistic;
public DrawableScoreStatistic(KeyValuePair<HitResult, object> statistic) public DrawableScoreStatistic(KeyValuePair<HitResult, int> statistic)
{ {
this.statistic = statistic; this.statistic = statistic;