1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:52:55 +08:00

Move ColumnType to constructor

This commit is contained in:
Dean Herbert 2022-10-04 17:49:00 +09:00
parent e0c66dbdbc
commit df3ad618e1
7 changed files with 15 additions and 17 deletions

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mods;
@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
{
scrollingInfo = ((ScrollingTestContainer)HitObjectContainer).ScrollingInfo;
Add(column = new Column(0)
Add(column = new Column(0, ColumnType.Even)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -28,11 +28,10 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
InternalChildren = new[]
{
this.column = new Column(column)
this.column = new Column(column, column % 2 == 0 ? ColumnType.Even : ColumnType.Odd)
{
Action = { Value = action },
AccentColour = Color4.Orange,
ColumnType = column % 2 == 0 ? ColumnType.Even : ColumnType.Odd,
Alpha = showColumn ? 1 : 0
},
content = new ManiaInputManager(new ManiaRuleset().RulesetInfo, 4)

View File

@ -11,6 +11,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI;
@ -84,7 +85,7 @@ namespace osu.Game.Rulesets.Mania.Tests
private Drawable createColumn(ScrollingDirection direction, ManiaAction action, int index)
{
var column = new Column(index)
var column = new Column(index, ColumnType.Even)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -9,6 +9,7 @@ using osu.Framework.Input.Events;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI;
@ -35,7 +36,7 @@ namespace osu.Game.Rulesets.Mania.Tests
RelativeSizeAxes = Axes.Y,
TimeRange = 2000,
Clock = new FramedClock(clock),
Child = column = new Column(0)
Child = column = new Column(0, ColumnType.Even)
{
Action = { Value = ManiaAction.Key1 },
Height = 0.85f,

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
namespace osu.Game.Rulesets.Mania.Beatmaps
{
public enum ColumnType

View File

@ -46,9 +46,14 @@ namespace osu.Game.Rulesets.Mania.UI
private readonly GameplaySampleTriggerSource sampleTriggerSource;
public Column(int index)
public readonly ColumnType ColumnType;
public Color4 AccentColour { get; set; }
public Column(int index, ColumnType columnType)
{
Index = index;
ColumnType = columnType;
RelativeSizeAxes = Axes.Y;
Width = COLUMN_WIDTH;
@ -92,12 +97,6 @@ namespace osu.Game.Rulesets.Mania.UI
NewResult += OnNewResult;
}
public ColumnType ColumnType { get; set; }
public bool IsSpecial => ColumnType == ColumnType.Special;
public Color4 AccentColour { get; set; }
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));

View File

@ -120,13 +120,12 @@ namespace osu.Game.Rulesets.Mania.UI
{
var columnType = definition.GetTypeOfColumn(i);
var column = new Column(firstColumnIndex + i)
var column = new Column(firstColumnIndex + i, columnType)
{
RelativeSizeAxes = Axes.Both,
Width = 1,
ColumnType = columnType,
AccentColour = columnColours[columnType],
Action = { Value = columnType == ColumnType.Special ? specialColumnStartAction++ : normalColumnStartAction++ }
Width = 1,
};
topLevelContainer.Add(column.TopLevelContainer.CreateProxy());