Revert nullability change

This commit is contained in:
Dean Herbert
2021-07-20 19:03:29 +09:00
parent 662822a40c
commit 1a8ab77f21
5 changed files with 7 additions and 18 deletions

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using JetBrains.Annotations; using JetBrains.Annotations;
@ -227,13 +226,11 @@ namespace osu.Game.Tests.Visual.Playlists
private MultiplayerScore createUserResponse([NotNull] ScoreInfo userScore) private MultiplayerScore createUserResponse([NotNull] ScoreInfo userScore)
{ {
Debug.Assert(userScore.Date != null);
var multiplayerUserScore = new MultiplayerScore var multiplayerUserScore = new MultiplayerScore
{ {
ID = (int)(userScore.OnlineScoreID ?? currentScoreId++), ID = (int)(userScore.OnlineScoreID ?? currentScoreId++),
Accuracy = userScore.Accuracy, Accuracy = userScore.Accuracy,
EndedAt = userScore.Date.Value, EndedAt = userScore.Date,
Passed = userScore.Passed, Passed = userScore.Passed,
Rank = userScore.Rank, Rank = userScore.Rank,
Position = 200, Position = 200,
@ -254,7 +251,7 @@ namespace osu.Game.Tests.Visual.Playlists
{ {
ID = currentScoreId++, ID = currentScoreId++,
Accuracy = userScore.Accuracy, Accuracy = userScore.Accuracy,
EndedAt = userScore.Date.Value, EndedAt = userScore.Date,
Passed = true, Passed = true,
Rank = userScore.Rank, Rank = userScore.Rank,
MaxCombo = userScore.MaxCombo, MaxCombo = userScore.MaxCombo,
@ -272,7 +269,7 @@ namespace osu.Game.Tests.Visual.Playlists
{ {
ID = currentScoreId++, ID = currentScoreId++,
Accuracy = userScore.Accuracy, Accuracy = userScore.Accuracy,
EndedAt = userScore.Date.Value, EndedAt = userScore.Date,
Passed = true, Passed = true,
Rank = userScore.Rank, Rank = userScore.Rank,
MaxCombo = userScore.MaxCombo, MaxCombo = userScore.MaxCombo,

View File

@ -2,7 +2,6 @@
// 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 System; using System;
using System.Diagnostics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -137,11 +136,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{ {
set set
{ {
Debug.Assert(value.Date != null);
avatar.User = value.User; avatar.User = value.User;
flag.Country = value.User.Country; flag.Country = value.User.Country;
achievedOn.Date = value.Date.Value; achievedOn.Date = value.Date;
usernameText.Clear(); usernameText.Clear();
usernameText.AddUserLink(value.User); usernameText.AddUserLink(value.User);

View File

@ -1,7 +1,6 @@
// 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 System.Diagnostics;
using System.Linq; using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -45,8 +44,6 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Debug.Assert(Score.Date != null);
AddInternal(new ProfileItemContainer AddInternal(new ProfileItemContainer
{ {
Children = new Drawable[] Children = new Drawable[]
@ -95,7 +92,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular), Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
Colour = colours.Yellow Colour = colours.Yellow
}, },
new DrawableDate(Score.Date.Value, 12) new DrawableDate(Score.Date, 12)
{ {
Colour = colourProvider.Foreground1 Colour = colourProvider.Foreground1
} }

View File

@ -59,7 +59,7 @@ namespace osu.Game.Scoring.Legacy
sw.Write((int)score.ScoreInfo.Ruleset.CreateInstance().ConvertToLegacyMods(score.ScoreInfo.Mods)); sw.Write((int)score.ScoreInfo.Ruleset.CreateInstance().ConvertToLegacyMods(score.ScoreInfo.Mods));
sw.Write(getHpGraphFormatted()); sw.Write(getHpGraphFormatted());
sw.Write((score.ScoreInfo.Date ?? DateTimeOffset.Now).DateTime); sw.Write(score.ScoreInfo.Date.DateTime);
sw.WriteByteArray(createReplayData()); sw.WriteByteArray(createReplayData());
sw.Write((long)0); sw.Write((long)0);
writeModSpecificData(score.ScoreInfo, sw); writeModSpecificData(score.ScoreInfo, sw);

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using JetBrains.Annotations;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -156,8 +155,7 @@ namespace osu.Game.Scoring
public long? OnlineScoreID { get; set; } public long? OnlineScoreID { get; set; }
[JsonIgnore] [JsonIgnore]
[CanBeNull] // may be null in cases of autoplay. public DateTimeOffset Date { get; set; }
public DateTimeOffset? Date { get; set; }
[JsonProperty("statistics")] [JsonProperty("statistics")]
public Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>(); public Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>();