1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 22:42:57 +08:00

Move SamplesMatchPlaybackRate out of BeatmapInfo

This commit is contained in:
Bartłomiej Dach 2024-06-12 13:32:23 +02:00
parent f64a0624a5
commit c216283bf4
No known key found for this signature in database
11 changed files with 24 additions and 10 deletions

View File

@ -87,7 +87,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.IsFalse(beatmap.LetterboxInBreaks);
Assert.IsFalse(beatmap.SpecialStyle);
Assert.IsFalse(beatmap.WidescreenStoryboard);
Assert.IsFalse(beatmapInfo.SamplesMatchPlaybackRate);
Assert.IsFalse(beatmap.SamplesMatchPlaybackRate);
Assert.AreEqual(CountdownType.None, beatmapInfo.Countdown);
Assert.AreEqual(0, beatmapInfo.CountdownOffset);
}
@ -956,7 +956,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.That(decoded.LetterboxInBreaks, Is.False);
Assert.That(decoded.WidescreenStoryboard, Is.False);
Assert.That(decoded.EpilepsyWarning, Is.False);
Assert.That(decoded.BeatmapInfo.SamplesMatchPlaybackRate, Is.False);
Assert.That(decoded.SamplesMatchPlaybackRate, Is.False);
Assert.That(decoded.BeatmapInfo.Countdown, Is.EqualTo(CountdownType.Normal));
Assert.That(decoded.BeatmapInfo.CountdownOffset, Is.EqualTo(0));
Assert.That(decoded.BeatmapInfo.Metadata.PreviewTime, Is.EqualTo(-1));

View File

@ -126,6 +126,8 @@ namespace osu.Game.Beatmaps
public bool EpilepsyWarning { get; set; }
public bool SamplesMatchPlaybackRate { get; set; } = true;
IBeatmap IBeatmap.Clone() => Clone();
public Beatmap<T> Clone() => (Beatmap<T>)MemberwiseClone();

View File

@ -73,6 +73,7 @@ namespace osu.Game.Beatmaps
beatmap.LetterboxInBreaks = original.LetterboxInBreaks;
beatmap.WidescreenStoryboard = original.WidescreenStoryboard;
beatmap.EpilepsyWarning = original.EpilepsyWarning;
beatmap.SamplesMatchPlaybackRate = original.SamplesMatchPlaybackRate;
return beatmap;
}

View File

@ -414,7 +414,6 @@ namespace osu.Game.Beatmaps
Hash = hash,
DifficultyName = decodedInfo.DifficultyName,
OnlineID = decodedInfo.OnlineID,
SamplesMatchPlaybackRate = decodedInfo.SamplesMatchPlaybackRate,
DistanceSpacing = decodedInfo.DistanceSpacing,
BeatDivisor = decodedInfo.BeatDivisor,
GridSize = decodedInfo.GridSize,

View File

@ -138,8 +138,6 @@ namespace osu.Game.Beatmaps
#region Properties we may not want persisted (but also maybe no harm?)
public bool SamplesMatchPlaybackRate { get; set; } = true;
/// <summary>
/// The time at which this beatmap was last played by the local user.
/// </summary>

View File

@ -186,7 +186,7 @@ namespace osu.Game.Beatmaps.Formats
private static void applyLegacyDefaults(Beatmap beatmap)
{
beatmap.WidescreenStoryboard = false;
beatmap.BeatmapInfo.SamplesMatchPlaybackRate = false;
beatmap.SamplesMatchPlaybackRate = false;
}
protected override void ParseLine(Beatmap beatmap, Section section, string line)
@ -301,7 +301,7 @@ namespace osu.Game.Beatmaps.Formats
break;
case @"SamplesMatchPlaybackRate":
beatmap.BeatmapInfo.SamplesMatchPlaybackRate = Parsing.ParseInt(pair.Value) == 1;
beatmap.SamplesMatchPlaybackRate = Parsing.ParseInt(pair.Value) == 1;
break;
case @"Countdown":

View File

@ -102,7 +102,7 @@ namespace osu.Game.Beatmaps.Formats
if (onlineRulesetID == 3)
writer.WriteLine(FormattableString.Invariant($"SpecialStyle: {(beatmap.SpecialStyle ? '1' : '0')}"));
writer.WriteLine(FormattableString.Invariant($"WidescreenStoryboard: {(beatmap.WidescreenStoryboard ? '1' : '0')}"));
if (beatmap.BeatmapInfo.SamplesMatchPlaybackRate)
if (beatmap.SamplesMatchPlaybackRate)
writer.WriteLine(@"SamplesMatchPlaybackRate: 1");
}

View File

@ -80,6 +80,8 @@ namespace osu.Game.Beatmaps
bool EpilepsyWarning { get; internal set; }
bool SamplesMatchPlaybackRate { get; internal set; }
/// <summary>
/// Creates a shallow-clone of this beatmap and returns it.
/// </summary>

View File

@ -373,6 +373,12 @@ namespace osu.Game.Rulesets.Difficulty
set => baseBeatmap.EpilepsyWarning = value;
}
public bool SamplesMatchPlaybackRate
{
get => baseBeatmap.SamplesMatchPlaybackRate;
set => baseBeatmap.SamplesMatchPlaybackRate = value;
}
#endregion
}
}

View File

@ -220,6 +220,12 @@ namespace osu.Game.Screens.Edit
set => PlayableBeatmap.EpilepsyWarning = value;
}
public bool SamplesMatchPlaybackRate
{
get => PlayableBeatmap.SamplesMatchPlaybackRate;
set => PlayableBeatmap.SamplesMatchPlaybackRate = value;
}
public IBeatmap Clone() => (EditorBeatmap)MemberwiseClone();
private IList mutableHitObjects => (IList)PlayableBeatmap.HitObjects;

View File

@ -86,7 +86,7 @@ namespace osu.Game.Screens.Edit.Setup
{
Label = EditorSetupStrings.SamplesMatchPlaybackRate,
Description = EditorSetupStrings.SamplesMatchPlaybackRateDescription,
Current = { Value = Beatmap.BeatmapInfo.SamplesMatchPlaybackRate }
Current = { Value = Beatmap.SamplesMatchPlaybackRate }
}
};
}
@ -124,7 +124,7 @@ namespace osu.Game.Screens.Edit.Setup
Beatmap.WidescreenStoryboard = widescreenSupport.Current.Value;
Beatmap.EpilepsyWarning = epilepsyWarning.Current.Value;
Beatmap.LetterboxInBreaks = letterboxDuringBreaks.Current.Value;
Beatmap.BeatmapInfo.SamplesMatchPlaybackRate = samplesMatchPlaybackRate.Current.Value;
Beatmap.SamplesMatchPlaybackRate = samplesMatchPlaybackRate.Current.Value;
Beatmap.SaveState();
}