1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-12 05:13:08 +08:00

Move GridSize out of BeatmapInfo

This commit is contained in:
Bartłomiej Dach 2024-06-12 13:44:36 +02:00
parent 3634307d7c
commit 6685c5ab74
No known key found for this signature in database
13 changed files with 24 additions and 10 deletions

View File

@ -185,6 +185,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
private void gridSizeIs(int size)
=> AddAssert($"grid size is {size}", () => this.ChildrenOfType<RectangularPositionSnapGrid>().Single().Spacing.Value == new Vector2(size)
&& EditorBeatmap.BeatmapInfo.GridSize == size);
&& EditorBeatmap.GridSize == size);
}
}

View File

@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.Osu.Edit
},
};
Spacing.Value = editorBeatmap.BeatmapInfo.GridSize;
Spacing.Value = editorBeatmap.GridSize;
}
protected override void LoadComplete()
@ -137,7 +137,7 @@ namespace osu.Game.Rulesets.Osu.Edit
spacingSlider.ContractedLabelText = $"S: {spacing.NewValue:N0}";
spacingSlider.ExpandedLabelText = $"Spacing: {spacing.NewValue:N0}";
SpacingVector.Value = new Vector2(spacing.NewValue);
editorBeatmap.BeatmapInfo.GridSize = (int)spacing.NewValue;
editorBeatmap.GridSize = (int)spacing.NewValue;
}, true);
GridLinesRotation.BindValueChanged(rotation =>

View File

@ -114,7 +114,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual(expectedBookmarks[i], beatmap.BeatmapInfo.Bookmarks[i]);
Assert.AreEqual(1.8, beatmap.DistanceSpacing);
Assert.AreEqual(4, beatmap.BeatmapInfo.BeatDivisor);
Assert.AreEqual(4, beatmap.BeatmapInfo.GridSize);
Assert.AreEqual(4, beatmap.GridSize);
Assert.AreEqual(2, beatmap.BeatmapInfo.TimelineZoom);
}
}

View File

@ -78,7 +78,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual(expectedBookmarks[i], beatmapInfo.Bookmarks[i]);
Assert.AreEqual(1.8, beatmap.DistanceSpacing);
Assert.AreEqual(4, beatmapInfo.BeatDivisor);
Assert.AreEqual(4, beatmapInfo.GridSize);
Assert.AreEqual(4, beatmap.GridSize);
Assert.AreEqual(2, beatmapInfo.TimelineZoom);
}

View File

@ -130,6 +130,8 @@ namespace osu.Game.Beatmaps
public double DistanceSpacing { get; set; } = 1.0;
public int GridSize { get; set; }
IBeatmap IBeatmap.Clone() => Clone();
public Beatmap<T> Clone() => (Beatmap<T>)MemberwiseClone();

View File

@ -75,6 +75,7 @@ namespace osu.Game.Beatmaps
beatmap.EpilepsyWarning = original.EpilepsyWarning;
beatmap.SamplesMatchPlaybackRate = original.SamplesMatchPlaybackRate;
beatmap.DistanceSpacing = original.DistanceSpacing;
beatmap.GridSize = original.GridSize;
return beatmap;
}

View File

@ -415,7 +415,6 @@ namespace osu.Game.Beatmaps
DifficultyName = decodedInfo.DifficultyName,
OnlineID = decodedInfo.OnlineID,
BeatDivisor = decodedInfo.BeatDivisor,
GridSize = decodedInfo.GridSize,
TimelineZoom = decodedInfo.TimelineZoom,
MD5Hash = memoryStream.ComputeMD5Hash(),
EndTimeObjectCount = decoded.HitObjects.Count(h => h is IHasDuration),

View File

@ -143,8 +143,6 @@ namespace osu.Game.Beatmaps
public int BeatDivisor { get; set; } = 4;
public int GridSize { get; set; }
public double TimelineZoom { get; set; } = 1.0;
/// <summary>

View File

@ -337,7 +337,7 @@ namespace osu.Game.Beatmaps.Formats
break;
case @"GridSize":
beatmap.BeatmapInfo.GridSize = Parsing.ParseInt(pair.Value);
beatmap.GridSize = Parsing.ParseInt(pair.Value);
break;
case @"TimelineZoom":

View File

@ -114,7 +114,7 @@ namespace osu.Game.Beatmaps.Formats
writer.WriteLine(FormattableString.Invariant($"Bookmarks: {string.Join(',', beatmap.BeatmapInfo.Bookmarks)}"));
writer.WriteLine(FormattableString.Invariant($"DistanceSpacing: {beatmap.DistanceSpacing}"));
writer.WriteLine(FormattableString.Invariant($"BeatDivisor: {beatmap.BeatmapInfo.BeatDivisor}"));
writer.WriteLine(FormattableString.Invariant($"GridSize: {beatmap.BeatmapInfo.GridSize}"));
writer.WriteLine(FormattableString.Invariant($"GridSize: {beatmap.GridSize}"));
writer.WriteLine(FormattableString.Invariant($"TimelineZoom: {beatmap.BeatmapInfo.TimelineZoom}"));
}

View File

@ -95,6 +95,8 @@ namespace osu.Game.Beatmaps
/// </remarks>
double DistanceSpacing { get; internal set; }
int GridSize { get; internal set; }
/// <summary>
/// Creates a shallow-clone of this beatmap and returns it.
/// </summary>

View File

@ -385,6 +385,12 @@ namespace osu.Game.Rulesets.Difficulty
set => baseBeatmap.DistanceSpacing = value;
}
public int GridSize
{
get => baseBeatmap.GridSize;
set => baseBeatmap.GridSize = value;
}
#endregion
}
}

View File

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