mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Cache StageDefinition
for consumption (and remove ColumnType
)
This commit is contained in:
@ -6,7 +6,6 @@
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -18,7 +17,6 @@ using osu.Game.Rulesets.Mania.UI.Components;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI;
|
||||
@ -26,7 +24,7 @@ using osu.Game.Rulesets.UI;
|
||||
namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
[Cached]
|
||||
public class Column : ScrollingPlayfield, IKeyBindingHandler<ManiaAction>, IHasAccentColour
|
||||
public class Column : ScrollingPlayfield, IKeyBindingHandler<ManiaAction>
|
||||
{
|
||||
public const float COLUMN_WIDTH = 80;
|
||||
public const float SPECIAL_COLUMN_WIDTH = 70;
|
||||
@ -46,14 +44,17 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
private readonly GameplaySampleTriggerSource sampleTriggerSource;
|
||||
|
||||
public readonly ColumnType ColumnType;
|
||||
/// <summary>
|
||||
/// Whether this is a special (ie. scratch) column.
|
||||
/// </summary>
|
||||
public readonly bool IsSpecial;
|
||||
|
||||
public Color4 AccentColour { get; set; }
|
||||
|
||||
public Column(int index, ColumnType columnType)
|
||||
public Column(int index, bool isSpecial)
|
||||
{
|
||||
Index = index;
|
||||
ColumnType = columnType;
|
||||
IsSpecial = isSpecial;
|
||||
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
Width = COLUMN_WIDTH;
|
||||
|
@ -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