mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Apply NRT to osu.Game.Betamaps.Formats
namespace
This commit is contained in:
parent
f9ca7f3e0e
commit
49fc9655d2
@ -1,13 +1,10 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
@ -45,7 +42,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
/// Register dependencies for use with static decoder classes.
|
||||
/// </summary>
|
||||
/// <param name="rulesets">A store containing all available rulesets (used by <see cref="LegacyBeatmapDecoder"/>).</param>
|
||||
public static void RegisterDependencies([NotNull] RulesetStore rulesets)
|
||||
public static void RegisterDependencies(RulesetStore rulesets)
|
||||
{
|
||||
LegacyBeatmapDecoder.RulesetStore = rulesets ?? throw new ArgumentNullException(nameof(rulesets));
|
||||
}
|
||||
@ -63,7 +60,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
throw new IOException(@"Unknown decoder type");
|
||||
|
||||
// start off with the first line of the file
|
||||
string line = stream.PeekLine()?.Trim();
|
||||
string? line = stream.PeekLine()?.Trim();
|
||||
|
||||
while (line != null && line.Length == 0)
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -13,7 +11,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
/// <summary>
|
||||
/// Retrieves the list of combo colours for presentation only.
|
||||
/// </summary>
|
||||
IReadOnlyList<Color4> ComboColours { get; }
|
||||
IReadOnlyList<Color4>? ComboColours { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The list of custom combo colours.
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable 618
|
||||
|
||||
using System;
|
||||
@ -36,11 +34,11 @@ namespace osu.Game.Beatmaps.Formats
|
||||
/// </summary>
|
||||
private const double control_point_leniency = 1;
|
||||
|
||||
internal static RulesetStore RulesetStore;
|
||||
internal static RulesetStore? RulesetStore;
|
||||
|
||||
private Beatmap beatmap;
|
||||
private Beatmap beatmap = null!;
|
||||
|
||||
private ConvertHitObjectParser parser;
|
||||
private ConvertHitObjectParser? parser;
|
||||
|
||||
private LegacySampleBank defaultSampleBank;
|
||||
private int defaultSampleVolume = 100;
|
||||
@ -222,7 +220,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
case @"Mode":
|
||||
int rulesetID = Parsing.ParseInt(pair.Value);
|
||||
|
||||
beatmap.BeatmapInfo.Ruleset = RulesetStore.GetRuleset(rulesetID) ?? throw new ArgumentException("Ruleset is not available locally.");
|
||||
beatmap.BeatmapInfo.Ruleset = RulesetStore?.GetRuleset(rulesetID) ?? throw new ArgumentException("Ruleset is not available locally.");
|
||||
|
||||
switch (rulesetID)
|
||||
{
|
||||
|
@ -1,15 +1,12 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Beatmaps.Legacy;
|
||||
@ -34,8 +31,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
private readonly IBeatmap beatmap;
|
||||
|
||||
[CanBeNull]
|
||||
private readonly ISkin skin;
|
||||
private readonly ISkin? skin;
|
||||
|
||||
private readonly int onlineRulesetID;
|
||||
|
||||
@ -44,7 +40,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The beatmap to encode.</param>
|
||||
/// <param name="skin">The beatmap's skin, used for encoding combo colours.</param>
|
||||
public LegacyBeatmapEncoder(IBeatmap beatmap, [CanBeNull] ISkin skin)
|
||||
public LegacyBeatmapEncoder(IBeatmap beatmap, ISkin? skin)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
this.skin = skin;
|
||||
@ -180,8 +176,8 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
writer.WriteLine("[TimingPoints]");
|
||||
|
||||
SampleControlPoint lastRelevantSamplePoint = null;
|
||||
DifficultyControlPoint lastRelevantDifficultyPoint = null;
|
||||
SampleControlPoint? lastRelevantSamplePoint = null;
|
||||
DifficultyControlPoint? lastRelevantDifficultyPoint = null;
|
||||
|
||||
// In osu!taiko and osu!mania, a scroll speed is stored as "slider velocity" in legacy formats.
|
||||
// In that case, a scrolling speed change is a global effect and per-hit object difficulty control points are ignored.
|
||||
@ -585,7 +581,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
return type;
|
||||
}
|
||||
|
||||
private LegacySampleBank toLegacySampleBank(string sampleBank)
|
||||
private LegacySampleBank toLegacySampleBank(string? sampleBank)
|
||||
{
|
||||
switch (sampleBank?.ToLowerInvariant())
|
||||
{
|
||||
@ -603,7 +599,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
}
|
||||
}
|
||||
|
||||
private int toLegacyCustomSampleBank(HitSampleInfo hitSampleInfo)
|
||||
private int toLegacyCustomSampleBank(HitSampleInfo? hitSampleInfo)
|
||||
{
|
||||
if (hitSampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacy)
|
||||
return legacy.CustomSampleBank;
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@ -19,10 +17,10 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
public class LegacyStoryboardDecoder : LegacyDecoder<Storyboard>
|
||||
{
|
||||
private StoryboardSprite storyboardSprite;
|
||||
private CommandTimelineGroup timelineGroup;
|
||||
private StoryboardSprite? storyboardSprite;
|
||||
private CommandTimelineGroup? timelineGroup;
|
||||
|
||||
private Storyboard storyboard;
|
||||
private Storyboard storyboard = null!;
|
||||
|
||||
private readonly Dictionary<string, string> variables = new Dictionary<string, string>();
|
||||
|
||||
|
@ -232,6 +232,6 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
|
||||
private static Color4 getComboColour(IHasComboColours source, int colourIndex)
|
||||
=> source.ComboColours[colourIndex % source.ComboColours.Count];
|
||||
=> source.ComboColours![colourIndex % source.ComboColours.Count];
|
||||
}
|
||||
}
|
||||
|
@ -203,6 +203,6 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
|
||||
private static Color4 getComboColour(IHasComboColours source, int colourIndex)
|
||||
=> source.ComboColours[colourIndex % source.ComboColours.Count];
|
||||
=> source.ComboColours![colourIndex % source.ComboColours.Count];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user