mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 10:33:22 +08:00
Move CountdownOffset
out of BeatmapInfo
This commit is contained in:
parent
d373f752d6
commit
dd50d6fa6e
@ -89,7 +89,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.IsFalse(beatmap.WidescreenStoryboard);
|
||||
Assert.IsFalse(beatmap.SamplesMatchPlaybackRate);
|
||||
Assert.AreEqual(CountdownType.None, beatmap.Countdown);
|
||||
Assert.AreEqual(0, beatmapInfo.CountdownOffset);
|
||||
Assert.AreEqual(0, beatmap.CountdownOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -958,7 +958,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.That(decoded.EpilepsyWarning, Is.False);
|
||||
Assert.That(decoded.SamplesMatchPlaybackRate, Is.False);
|
||||
Assert.That(decoded.Countdown, Is.EqualTo(CountdownType.Normal));
|
||||
Assert.That(decoded.BeatmapInfo.CountdownOffset, Is.EqualTo(0));
|
||||
Assert.That(decoded.CountdownOffset, Is.EqualTo(0));
|
||||
Assert.That(decoded.BeatmapInfo.Metadata.PreviewTime, Is.EqualTo(-1));
|
||||
Assert.That(decoded.BeatmapInfo.Ruleset.OnlineID, Is.EqualTo(0));
|
||||
});
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.AreEqual(false, beatmap.LetterboxInBreaks);
|
||||
Assert.AreEqual(false, beatmap.WidescreenStoryboard);
|
||||
Assert.AreEqual(CountdownType.None, beatmap.Countdown);
|
||||
Assert.AreEqual(0, beatmapInfo.CountdownOffset);
|
||||
Assert.AreEqual(0, beatmap.CountdownOffset);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Tests.Database
|
||||
Assert.That(lastChanges?.ModifiedIndices, Is.Empty);
|
||||
Assert.That(lastChanges?.NewModifiedIndices, Is.Empty);
|
||||
|
||||
realm.Write(r => r.All<BeatmapSetInfo>().First().Beatmaps.First().CountdownOffset = 5);
|
||||
realm.Write(r => r.All<BeatmapSetInfo>().First().Beatmaps.First().EditorTimestamp = 5);
|
||||
realm.Run(r => r.Refresh());
|
||||
|
||||
Assert.That(collectionChanges, Is.EqualTo(1));
|
||||
|
@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddStep("commit text", () => InputManager.Key(Key.Enter));
|
||||
|
||||
AddAssert($"displayed value is {expectedFinalValue}", () => designSection.CountdownOffset.Current.Value == expectedFinalValue.ToString(CultureInfo.InvariantCulture));
|
||||
AddAssert($"beatmap value is {expectedFinalValue}", () => editorBeatmap.BeatmapInfo.CountdownOffset == expectedFinalValue);
|
||||
AddAssert($"beatmap value is {expectedFinalValue}", () => editorBeatmap.CountdownOffset == expectedFinalValue);
|
||||
}
|
||||
|
||||
private partial class TestDesignSection : DesignSection
|
||||
|
@ -136,6 +136,8 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public CountdownType Countdown { get; set; } = CountdownType.Normal;
|
||||
|
||||
public int CountdownOffset { get; set; }
|
||||
|
||||
IBeatmap IBeatmap.Clone() => Clone();
|
||||
|
||||
public Beatmap<T> Clone() => (Beatmap<T>)MemberwiseClone();
|
||||
|
@ -77,6 +77,7 @@ namespace osu.Game.Beatmaps
|
||||
beatmap.DistanceSpacing = original.DistanceSpacing;
|
||||
beatmap.GridSize = original.GridSize;
|
||||
beatmap.TimelineZoom = original.TimelineZoom;
|
||||
beatmap.CountdownOffset = original.CountdownOffset;
|
||||
|
||||
return beatmap;
|
||||
}
|
||||
|
@ -148,11 +148,6 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
public double? EditorTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of beats to move the countdown backwards (compared to its default location).
|
||||
/// </summary>
|
||||
public int CountdownOffset { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public bool Equals(BeatmapInfo? other)
|
||||
|
@ -309,7 +309,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
break;
|
||||
|
||||
case @"CountdownOffset":
|
||||
beatmap.BeatmapInfo.CountdownOffset = Parsing.ParseInt(pair.Value);
|
||||
beatmap.CountdownOffset = Parsing.ParseInt(pair.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -97,8 +97,8 @@ namespace osu.Game.Beatmaps.Formats
|
||||
// writer.WriteLine(@"SkinPreference:" + b.SkinPreference);
|
||||
if (beatmap.EpilepsyWarning)
|
||||
writer.WriteLine(@"EpilepsyWarning: 1");
|
||||
if (beatmap.BeatmapInfo.CountdownOffset > 0)
|
||||
writer.WriteLine(FormattableString.Invariant($@"CountdownOffset: {beatmap.BeatmapInfo.CountdownOffset}"));
|
||||
if (beatmap.CountdownOffset > 0)
|
||||
writer.WriteLine(FormattableString.Invariant($@"CountdownOffset: {beatmap.CountdownOffset}"));
|
||||
if (onlineRulesetID == 3)
|
||||
writer.WriteLine(FormattableString.Invariant($"SpecialStyle: {(beatmap.SpecialStyle ? '1' : '0')}"));
|
||||
writer.WriteLine(FormattableString.Invariant($"WidescreenStoryboard: {(beatmap.WidescreenStoryboard ? '1' : '0')}"));
|
||||
|
@ -101,6 +101,11 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
CountdownType Countdown { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of beats to move the countdown backwards (compared to its default location).
|
||||
/// </summary>
|
||||
int CountdownOffset { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a shallow-clone of this beatmap and returns it.
|
||||
/// </summary>
|
||||
|
@ -403,6 +403,12 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
set => baseBeatmap.Countdown = value;
|
||||
}
|
||||
|
||||
public int CountdownOffset
|
||||
{
|
||||
get => baseBeatmap.CountdownOffset;
|
||||
set => baseBeatmap.CountdownOffset = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -250,6 +250,12 @@ namespace osu.Game.Screens.Edit
|
||||
set => PlayableBeatmap.Countdown = value;
|
||||
}
|
||||
|
||||
public int CountdownOffset
|
||||
{
|
||||
get => PlayableBeatmap.CountdownOffset;
|
||||
set => PlayableBeatmap.CountdownOffset = value;
|
||||
}
|
||||
|
||||
public IBeatmap Clone() => (EditorBeatmap)MemberwiseClone();
|
||||
|
||||
private IList mutableHitObjects => (IList)PlayableBeatmap.HitObjects;
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
CountdownOffset = new LabelledNumberBox
|
||||
{
|
||||
Label = EditorSetupStrings.CountdownOffset,
|
||||
Current = { Value = Beatmap.BeatmapInfo.CountdownOffset.ToString() },
|
||||
Current = { Value = Beatmap.CountdownOffset.ToString() },
|
||||
Description = EditorSetupStrings.CountdownOffsetDescription,
|
||||
}
|
||||
}
|
||||
@ -113,13 +113,13 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
updateBeatmap();
|
||||
// update displayed text to ensure parsed value matches display (i.e. if empty string was provided).
|
||||
CountdownOffset.Current.Value = Beatmap.BeatmapInfo.CountdownOffset.ToString(CultureInfo.InvariantCulture);
|
||||
CountdownOffset.Current.Value = Beatmap.CountdownOffset.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
private void updateBeatmap()
|
||||
{
|
||||
Beatmap.Countdown = EnableCountdown.Current.Value ? CountdownSpeed.Current.Value : CountdownType.None;
|
||||
Beatmap.BeatmapInfo.CountdownOffset = int.TryParse(CountdownOffset.Current.Value, NumberStyles.None, CultureInfo.InvariantCulture, out int offset) ? offset : 0;
|
||||
Beatmap.CountdownOffset = int.TryParse(CountdownOffset.Current.Value, NumberStyles.None, CultureInfo.InvariantCulture, out int offset) ? offset : 0;
|
||||
|
||||
Beatmap.WidescreenStoryboard = widescreenSupport.Current.Value;
|
||||
Beatmap.EpilepsyWarning = epilepsyWarning.Current.Value;
|
||||
|
Loading…
Reference in New Issue
Block a user