mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 22:26:41 +09:00
Cache StageDefinition
for consumption (and remove ColumnType
)
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Pooling;
|
||||
@ -19,7 +20,6 @@ using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
@ -28,6 +28,9 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
/// </summary>
|
||||
public class Stage : ScrollingPlayfield
|
||||
{
|
||||
[Cached]
|
||||
public readonly StageDefinition Definition;
|
||||
|
||||
public const float COLUMN_SPACING = 1;
|
||||
|
||||
public const float HIT_TARGET_POSITION = 110;
|
||||
@ -40,12 +43,12 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
private readonly Drawable barLineContainer;
|
||||
|
||||
private readonly Dictionary<ColumnType, Color4> columnColours = new Dictionary<ColumnType, Color4>
|
||||
{
|
||||
{ ColumnType.Even, new Color4(6, 84, 0, 255) },
|
||||
{ ColumnType.Odd, new Color4(94, 0, 57, 255) },
|
||||
{ ColumnType.Special, new Color4(0, 48, 63, 255) }
|
||||
};
|
||||
// private readonly Dictionary<ColumnType, Color4> columnColours = new Dictionary<ColumnType, Color4>
|
||||
// {
|
||||
// { ColumnType.Even, new Color4(6, 84, 0, 255) },
|
||||
// { ColumnType.Odd, new Color4(94, 0, 57, 255) },
|
||||
// { ColumnType.Special, new Color4(0, 48, 63, 255) }
|
||||
// };
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Columns.Any(c => c.ReceivePositionalInputAt(screenSpacePos));
|
||||
|
||||
@ -54,6 +57,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
public Stage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction)
|
||||
{
|
||||
this.firstColumnIndex = firstColumnIndex;
|
||||
Definition = definition;
|
||||
|
||||
Name = "Stage";
|
||||
|
||||
@ -118,14 +122,15 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
for (int i = 0; i < definition.Columns; i++)
|
||||
{
|
||||
var columnType = definition.GetTypeOfColumn(i);
|
||||
bool isSpecial = definition.IsSpecialColumn(i);
|
||||
|
||||
var column = new Column(firstColumnIndex + i, columnType)
|
||||
var column = new Column(firstColumnIndex + i, isSpecial)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
AccentColour = columnColours[columnType],
|
||||
Action = { Value = columnType == ColumnType.Special ? specialColumnStartAction++ : normalColumnStartAction++ }
|
||||
Width = 1,
|
||||
// TODO: reimplement this somewhere.
|
||||
//AccentColour = columnColours[isSpecial],
|
||||
Action = { Value = isSpecial ? specialColumnStartAction++ : normalColumnStartAction++ }
|
||||
};
|
||||
|
||||
topLevelContainer.Add(column.TopLevelContainer.CreateProxy());
|
||||
|
Reference in New Issue
Block a user