mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 22:26:41 +09:00
simplify column type check logic
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
@ -21,5 +22,19 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
/// <param name="column">The 0-based column index.</param>
|
||||
/// <returns>Whether the column is a special column.</returns>
|
||||
public 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 ColumnType GetTypeOfColumn(int column)
|
||||
{
|
||||
if (IsSpecialColumn(column))
|
||||
return ColumnType.Special;
|
||||
|
||||
int distanceToEdge = Math.Min(column, (Columns - 1) - column);
|
||||
return distanceToEdge % 2 == 1 ? ColumnType.Odd : ColumnType.Even;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user