1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00
1. Add space before {, before Duration, and after 1000
2. How about just ManiaStage?
3. This is really just Columns.Count, you're not saving much with this extra variable here.
This commit is contained in:
ANDY840119-PC\andy840119 2018-01-14 11:41:52 +09:00
parent 561c9f2233
commit e947e46566
5 changed files with 20 additions and 23 deletions

View File

@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Mania.Tests
RelativeChildSize = new Vector2(1, 10000), RelativeChildSize = new Vector2(1, 10000),
Children = new[] Children = new[]
{ {
new DrawableHoldNote(new HoldNote{Duration = 1000}, ManiaAction.Key1) new DrawableHoldNote(new HoldNote { Duration = 1000 } , ManiaAction.Key1)
{ {
Y = 5000, Y = 5000,
Height = 1000, Height = 1000,

View File

@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
Name = "Hit target + hit objects", Name = "Hit target + hit objects",
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = ManiaColumnStage.HIT_TARGET_POSITION }, Padding = new MarginPadding { Top = ManiaStage.HIT_TARGET_POSITION },
Children = new Drawable[] Children = new Drawable[]
{ {
new Container new Container
@ -115,7 +115,7 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
Name = "Key", Name = "Key",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = ManiaColumnStage.HIT_TARGET_POSITION, Height = ManiaStage.HIT_TARGET_POSITION,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Mania.UI
/// <summary> /// <summary>
/// list mania column stages /// list mania column stages
/// </summary> /// </summary>
private readonly FillFlowContainer<ManiaColumnStage> listColumnStages; private readonly FillFlowContainer<ManiaStage> Stages;
/// <summary> /// <summary>
/// Whether this playfield should be inverted. This flips everything inside the playfield. /// Whether this playfield should be inverted. This flips everything inside the playfield.
@ -37,17 +37,17 @@ namespace osu.Game.Rulesets.Mania.UI
/// </summary> /// </summary>
public SpecialColumnPosition SpecialColumnPosition public SpecialColumnPosition SpecialColumnPosition
{ {
get => listColumnStages.FirstOrDefault()?.SpecialColumnPosition ?? SpecialColumnPosition.Normal; get => Stages.FirstOrDefault()?.SpecialColumnPosition ?? SpecialColumnPosition.Normal;
set set
{ {
foreach (var singleStage in listColumnStages) foreach (var singleStage in Stages)
{ {
singleStage.SpecialColumnPosition = value; singleStage.SpecialColumnPosition = value;
} }
} }
} }
public List<Column> Columns => listColumnStages.SelectMany(x => x.Columns).ToList(); public List<Column> Columns => Stages.SelectMany(x => x.Columns).ToList();
private readonly int columnCount; private readonly int columnCount;
@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Mania.UI
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
listColumnStages = new FillFlowContainer<ManiaColumnStage> Stages = new FillFlowContainer<ManiaStage>
{ {
Name="Stages", Name="Stages",
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
@ -78,10 +78,10 @@ namespace osu.Game.Rulesets.Mania.UI
foreach (var stage in stages) foreach (var stage in stages)
{ {
var drawableStage = new ManiaColumnStage(stage.Columns); var drawableStage = new ManiaStage();
drawableStage.VisibleTimeRange.BindTo(VisibleTimeRange); drawableStage.VisibleTimeRange.BindTo(VisibleTimeRange);
listColumnStages.Add(drawableStage); Stages.Add(drawableStage);
AddNested(drawableStage); AddNested(drawableStage);
for (int i = 0; i < stage.Columns; i++) for (int i = 0; i < stage.Columns; i++)
@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
Scale = new Vector2(1, newValue ? -1 : 1); Scale = new Vector2(1, newValue ? -1 : 1);
foreach (var single in listColumnStages) foreach (var single in Stages)
{ {
single.Judgements.Scale = Scale; single.Judgements.Scale = Scale;
} }
@ -124,18 +124,18 @@ namespace osu.Game.Rulesets.Mania.UI
public void Add(BarLine barline) public void Add(BarLine barline)
{ {
foreach (var single in listColumnStages) foreach (var single in Stages)
{ {
single.HitObjects.Add(new DrawableBarLine(barline)); single.HitObjects.Add(new DrawableBarLine(barline));
} }
} }
private ManiaColumnStage getFallDownControlContainerByActualColumn(int actualColumn) private ManiaStage getFallDownControlContainerByActualColumn(int actualColumn)
{ {
int sum = 0; int sum = 0;
foreach (var single in listColumnStages) foreach (var single in Stages)
{ {
sum = sum + single.ColumnCount; sum = sum + single.Columns.Count();
if (sum > actualColumn) if (sum > actualColumn)
{ {
return single; return single;

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.UI
/// <summary> /// <summary>
/// A collection of <see cref="Column"/>s. /// A collection of <see cref="Column"/>s.
/// </summary> /// </summary>
internal class ManiaColumnStage : ScrollingPlayfield internal class ManiaStage : ScrollingPlayfield
{ {
public const float HIT_TARGET_POSITION = 50; public const float HIT_TARGET_POSITION = 50;
@ -53,12 +53,9 @@ namespace osu.Game.Rulesets.Mania.UI
private List<Color4> normalColumnColours = new List<Color4>(); private List<Color4> normalColumnColours = new List<Color4>();
private Color4 specialColumnColour; private Color4 specialColumnColour;
public readonly int ColumnCount; public ManiaStage()
public ManiaColumnStage(int columnCount)
: base(ScrollingDirection.Up) : base(ScrollingDirection.Up)
{ {
ColumnCount = columnCount;
Name = "Playfield elements"; Name = "Playfield elements";
Anchor = Anchor.TopCentre; Anchor = Anchor.TopCentre;
Origin = Anchor.TopCentre; Origin = Anchor.TopCentre;
@ -142,11 +139,11 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
default: default:
case SpecialColumnPosition.Normal: case SpecialColumnPosition.Normal:
return ColumnCount % 2 == 1 && column == ColumnCount / 2; return columns.Count % 2 == 1 && column == columns.Count / 2;
case SpecialColumnPosition.Left: case SpecialColumnPosition.Left:
return column == 0; return column == 0;
case SpecialColumnPosition.Right: case SpecialColumnPosition.Right:
return column == ColumnCount - 1; return column == columns.Count - 1;
} }
} }

View File

@ -115,7 +115,7 @@
<Compile Include="Tests\TestCasePerformancePoints.cs" /> <Compile Include="Tests\TestCasePerformancePoints.cs" />
<Compile Include="UI\Column.cs" /> <Compile Include="UI\Column.cs" />
<Compile Include="UI\DrawableManiaJudgement.cs" /> <Compile Include="UI\DrawableManiaJudgement.cs" />
<Compile Include="UI\ManiaColumnStage.cs" /> <Compile Include="UI\ManiaStage.cs" />
<Compile Include="UI\HitExplosion.cs" /> <Compile Include="UI\HitExplosion.cs" />
<Compile Include="UI\ManiaRulesetContainer.cs" /> <Compile Include="UI\ManiaRulesetContainer.cs" />
<Compile Include="UI\ManiaPlayfield.cs" /> <Compile Include="UI\ManiaPlayfield.cs" />