mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 01:43:15 +08:00
Make SpecialColumnPosition only have an effect during load().
This commit is contained in:
parent
a2bdd020e5
commit
e307b6d563
@ -7,6 +7,7 @@ using osu.Framework.Testing;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
@ -22,27 +23,31 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
const int max_columns = 10;
|
||||
|
||||
Action<int, SpecialColumnPosition> createPlayfield = (cols, pos) =>
|
||||
{
|
||||
Clear();
|
||||
Add(new ManiaPlayfield(cols)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
SpecialColumnPosition = pos
|
||||
});
|
||||
};
|
||||
|
||||
for (int i = 1; i <= max_columns; i++)
|
||||
{
|
||||
int tempI = i;
|
||||
|
||||
AddStep($"{i} column" + (i > 1 ? "s" : ""), () =>
|
||||
{
|
||||
Clear();
|
||||
Add(new ManiaPlayfield(tempI)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
});
|
||||
});
|
||||
AddStep($"{i} column" + (i > 1 ? "s" : ""), () => createPlayfield(tempI, SpecialColumnPosition.Normal));
|
||||
|
||||
AddStep("Trigger keys down", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyDown));
|
||||
AddStep("Trigger keys up", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyUp));
|
||||
AddStep("Left special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Left);
|
||||
AddStep("Right special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Right);
|
||||
|
||||
AddStep("Left special style", () => createPlayfield(tempI, SpecialColumnPosition.Left));
|
||||
AddStep("Right special style", () => createPlayfield(tempI, SpecialColumnPosition.Right));
|
||||
}
|
||||
|
||||
AddStep("Normal special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Normal);
|
||||
AddStep("Normal special style", () => createPlayfield(max_columns, SpecialColumnPosition.Normal));
|
||||
}
|
||||
|
||||
private void triggerKeyDown(Column column)
|
||||
|
@ -27,25 +27,10 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
/// </summary>
|
||||
private static readonly Key[] default_keys = { Key.A, Key.S, Key.D, Key.F, Key.J, Key.K, Key.L, Key.Semicolon };
|
||||
|
||||
private SpecialColumnPosition specialColumnPosition;
|
||||
/// <summary>
|
||||
/// The style to use for the special column.
|
||||
/// </summary>
|
||||
public SpecialColumnPosition SpecialColumnPosition
|
||||
{
|
||||
get { return specialColumnPosition; }
|
||||
set
|
||||
{
|
||||
if (specialColumnPosition == value)
|
||||
return;
|
||||
specialColumnPosition = value;
|
||||
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
updateColumnStyle();
|
||||
}
|
||||
}
|
||||
public SpecialColumnPosition SpecialColumnPosition;
|
||||
|
||||
public readonly FlowContainer<Column> Columns;
|
||||
|
||||
@ -103,14 +88,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
specialColumnColour = colours.BlueDark;
|
||||
|
||||
updateColumnStyle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the column style (special style/colours) + keys.
|
||||
/// </summary>
|
||||
private void updateColumnStyle()
|
||||
{
|
||||
// Set the special column + colour + key
|
||||
for (int i = 0; i < columnCount; i++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user