Cache StageDefinition for consumption (and remove ColumnType)

This commit is contained in:
Dean Herbert
2022-10-04 18:24:49 +09:00
parent df3ad618e1
commit 7796a4c109
12 changed files with 61 additions and 85 deletions

View File

@ -3,7 +3,6 @@
#nullable disable
using System;
using osu.Game.Rulesets.Mania.UI;
namespace osu.Game.Rulesets.Mania.Beatmaps
@ -11,7 +10,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
/// <summary>
/// Defines properties for each stage in a <see cref="ManiaPlayfield"/>.
/// </summary>
public struct StageDefinition
public class StageDefinition
{
/// <summary>
/// The number of <see cref="Column"/>s which this stage contains.
@ -23,20 +22,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
/// </summary>
/// <param name="column">The 0-based column index.</param>
/// <returns>Whether the column is a special column.</returns>
public readonly bool IsSpecialColumn(int column) => Columns % 2 == 1 && column == Columns / 2;
/// <summary>
/// Get the type of column given a column index.
/// </summary>
/// <param name="column">The 0-based column index.</param>
/// <returns>The type of the column.</returns>
public readonly ColumnType GetTypeOfColumn(int column)
{
if (IsSpecialColumn(column))
return ColumnType.Special;
int distanceToEdge = Math.Min(column, (Columns - 1) - column);
return distanceToEdge % 2 == 0 ? ColumnType.Odd : ColumnType.Even;
}
public bool IsSpecialColumn(int column) => Columns % 2 == 1 && column == Columns / 2;
}
}