mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 23:22:54 +08:00
Move WidescreenStoryboard
out of BeatmapInfo
This commit is contained in:
parent
a6b7600bf2
commit
1ab86ebd24
@ -86,7 +86,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.IsTrue(beatmapInfo.Ruleset.OnlineID == 0);
|
||||
Assert.IsFalse(beatmap.LetterboxInBreaks);
|
||||
Assert.IsFalse(beatmap.SpecialStyle);
|
||||
Assert.IsFalse(beatmapInfo.WidescreenStoryboard);
|
||||
Assert.IsFalse(beatmap.WidescreenStoryboard);
|
||||
Assert.IsFalse(beatmapInfo.SamplesMatchPlaybackRate);
|
||||
Assert.AreEqual(CountdownType.None, beatmapInfo.Countdown);
|
||||
Assert.AreEqual(0, beatmapInfo.CountdownOffset);
|
||||
@ -954,7 +954,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.That(decoded.StackLeniency, Is.EqualTo(0.7f));
|
||||
Assert.That(decoded.SpecialStyle, Is.False);
|
||||
Assert.That(decoded.LetterboxInBreaks, Is.False);
|
||||
Assert.That(decoded.BeatmapInfo.WidescreenStoryboard, Is.False);
|
||||
Assert.That(decoded.WidescreenStoryboard, Is.False);
|
||||
Assert.That(decoded.BeatmapInfo.EpilepsyWarning, Is.False);
|
||||
Assert.That(decoded.BeatmapInfo.SamplesMatchPlaybackRate, Is.False);
|
||||
Assert.That(decoded.BeatmapInfo.Countdown, Is.EqualTo(CountdownType.Normal));
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.AreEqual(false, beatmap.SpecialStyle);
|
||||
Assert.IsTrue(beatmapInfo.Ruleset.OnlineID == 0);
|
||||
Assert.AreEqual(false, beatmap.LetterboxInBreaks);
|
||||
Assert.AreEqual(false, beatmapInfo.WidescreenStoryboard);
|
||||
Assert.AreEqual(false, beatmap.WidescreenStoryboard);
|
||||
Assert.AreEqual(CountdownType.None, beatmapInfo.Countdown);
|
||||
Assert.AreEqual(0, beatmapInfo.CountdownOffset);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddStep("load storyboard with only video", () =>
|
||||
{
|
||||
// LegacyStoryboardDecoder doesn't parse WidescreenStoryboard, so it is set manually
|
||||
loadStoryboard("storyboard_only_video.osu", s => s.BeatmapInfo.WidescreenStoryboard = false);
|
||||
loadStoryboard("storyboard_only_video.osu", s => s.Beatmap.WidescreenStoryboard = false);
|
||||
});
|
||||
|
||||
AddAssert("storyboard is correct width", () => Precision.AlmostEquals(storyboard?.Width ?? 0f, 480 * 16 / 9f));
|
||||
|
@ -122,6 +122,8 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public bool LetterboxInBreaks { get; set; }
|
||||
|
||||
public bool WidescreenStoryboard { get; set; } = true;
|
||||
|
||||
IBeatmap IBeatmap.Clone() => Clone();
|
||||
|
||||
public Beatmap<T> Clone() => (Beatmap<T>)MemberwiseClone();
|
||||
|
@ -71,6 +71,7 @@ namespace osu.Game.Beatmaps
|
||||
beatmap.StackLeniency = original.StackLeniency;
|
||||
beatmap.SpecialStyle = original.SpecialStyle;
|
||||
beatmap.LetterboxInBreaks = original.LetterboxInBreaks;
|
||||
beatmap.WidescreenStoryboard = original.WidescreenStoryboard;
|
||||
|
||||
return beatmap;
|
||||
}
|
||||
|
@ -414,7 +414,6 @@ namespace osu.Game.Beatmaps
|
||||
Hash = hash,
|
||||
DifficultyName = decodedInfo.DifficultyName,
|
||||
OnlineID = decodedInfo.OnlineID,
|
||||
WidescreenStoryboard = decodedInfo.WidescreenStoryboard,
|
||||
EpilepsyWarning = decodedInfo.EpilepsyWarning,
|
||||
SamplesMatchPlaybackRate = decodedInfo.SamplesMatchPlaybackRate,
|
||||
DistanceSpacing = decodedInfo.DistanceSpacing,
|
||||
|
@ -138,8 +138,6 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
#region Properties we may not want persisted (but also maybe no harm?)
|
||||
|
||||
public bool WidescreenStoryboard { get; set; } = true;
|
||||
|
||||
public bool EpilepsyWarning { get; set; }
|
||||
|
||||
public bool SamplesMatchPlaybackRate { get; set; } = true;
|
||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
this.beatmap = beatmap;
|
||||
this.beatmap.BeatmapInfo.BeatmapVersion = FormatVersion;
|
||||
|
||||
applyLegacyDefaults(this.beatmap.BeatmapInfo);
|
||||
applyLegacyDefaults(this.beatmap);
|
||||
|
||||
base.ParseStreamInto(stream, beatmap);
|
||||
|
||||
@ -183,10 +183,10 @@ namespace osu.Game.Beatmaps.Formats
|
||||
/// This method's intention is to restore those legacy defaults.
|
||||
/// See also: https://osu.ppy.sh/wiki/en/Client/File_formats/Osu_%28file_format%29
|
||||
/// </summary>
|
||||
private static void applyLegacyDefaults(BeatmapInfo beatmapInfo)
|
||||
private static void applyLegacyDefaults(Beatmap beatmap)
|
||||
{
|
||||
beatmapInfo.WidescreenStoryboard = false;
|
||||
beatmapInfo.SamplesMatchPlaybackRate = false;
|
||||
beatmap.WidescreenStoryboard = false;
|
||||
beatmap.BeatmapInfo.SamplesMatchPlaybackRate = false;
|
||||
}
|
||||
|
||||
protected override void ParseLine(Beatmap beatmap, Section section, string line)
|
||||
@ -293,7 +293,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
break;
|
||||
|
||||
case @"WidescreenStoryboard":
|
||||
beatmap.BeatmapInfo.WidescreenStoryboard = Parsing.ParseInt(pair.Value) == 1;
|
||||
beatmap.WidescreenStoryboard = Parsing.ParseInt(pair.Value) == 1;
|
||||
break;
|
||||
|
||||
case @"EpilepsyWarning":
|
||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
writer.WriteLine(FormattableString.Invariant($@"CountdownOffset: {beatmap.BeatmapInfo.CountdownOffset}"));
|
||||
if (onlineRulesetID == 3)
|
||||
writer.WriteLine(FormattableString.Invariant($"SpecialStyle: {(beatmap.SpecialStyle ? '1' : '0')}"));
|
||||
writer.WriteLine(FormattableString.Invariant($"WidescreenStoryboard: {(beatmap.BeatmapInfo.WidescreenStoryboard ? '1' : '0')}"));
|
||||
writer.WriteLine(FormattableString.Invariant($"WidescreenStoryboard: {(beatmap.WidescreenStoryboard ? '1' : '0')}"));
|
||||
if (beatmap.BeatmapInfo.SamplesMatchPlaybackRate)
|
||||
writer.WriteLine(@"SamplesMatchPlaybackRate: 1");
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
bool LetterboxInBreaks { get; internal set; }
|
||||
|
||||
bool WidescreenStoryboard { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a shallow-clone of this beatmap and returns it.
|
||||
/// </summary>
|
||||
|
@ -361,6 +361,12 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
set => baseBeatmap.LetterboxInBreaks = value;
|
||||
}
|
||||
|
||||
public bool WidescreenStoryboard
|
||||
{
|
||||
get => baseBeatmap.WidescreenStoryboard;
|
||||
set => baseBeatmap.WidescreenStoryboard = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -208,6 +208,12 @@ namespace osu.Game.Screens.Edit
|
||||
set => PlayableBeatmap.LetterboxInBreaks = value;
|
||||
}
|
||||
|
||||
public bool WidescreenStoryboard
|
||||
{
|
||||
get => PlayableBeatmap.WidescreenStoryboard;
|
||||
set => PlayableBeatmap.WidescreenStoryboard = value;
|
||||
}
|
||||
|
||||
public IBeatmap Clone() => (EditorBeatmap)MemberwiseClone();
|
||||
|
||||
private IList mutableHitObjects => (IList)PlayableBeatmap.HitObjects;
|
||||
|
@ -68,7 +68,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
Label = EditorSetupStrings.WidescreenSupport,
|
||||
Description = EditorSetupStrings.WidescreenSupportDescription,
|
||||
Current = { Value = Beatmap.BeatmapInfo.WidescreenStoryboard }
|
||||
Current = { Value = Beatmap.WidescreenStoryboard }
|
||||
},
|
||||
epilepsyWarning = new LabelledSwitchButton
|
||||
{
|
||||
@ -121,7 +121,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
Beatmap.BeatmapInfo.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.BeatmapInfo.WidescreenStoryboard = widescreenSupport.Current.Value;
|
||||
Beatmap.WidescreenStoryboard = widescreenSupport.Current.Value;
|
||||
Beatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning.Current.Value;
|
||||
Beatmap.LetterboxInBreaks = letterboxDuringBreaks.Current.Value;
|
||||
Beatmap.BeatmapInfo.SamplesMatchPlaybackRate = samplesMatchPlaybackRate.Current.Value;
|
||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Storyboards.Drawables
|
||||
|
||||
bool onlyHasVideoElements = Storyboard.Layers.SelectMany(l => l.Elements).All(e => e is StoryboardVideo);
|
||||
|
||||
Width = Height * (storyboard.BeatmapInfo.WidescreenStoryboard || onlyHasVideoElements ? 16 / 9f : 4 / 3f);
|
||||
Width = Height * (storyboard.Beatmap.WidescreenStoryboard || onlyHasVideoElements ? 16 / 9f : 4 / 3f);
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
@ -16,6 +16,7 @@ namespace osu.Game.Storyboards
|
||||
public IEnumerable<StoryboardLayer> Layers => layers.Values;
|
||||
|
||||
public BeatmapInfo BeatmapInfo = new BeatmapInfo();
|
||||
public IBeatmap Beatmap { get; set; } = new Beatmap();
|
||||
|
||||
/// <summary>
|
||||
/// Whether the storyboard should prefer textures from the current skin before using local storyboard textures.
|
||||
|
Loading…
Reference in New Issue
Block a user