From 5326f71ed9b776a6ab152aac5670628367102720 Mon Sep 17 00:00:00 2001 From: "ANDY840119-PC\\andy840119" Date: Wed, 3 Jan 2018 22:58:08 +0900 Subject: [PATCH] fix some error that smoogipoo says --- .../Tests/TestCaseManiaPlayfield.cs | 14 +++- osu.Game.Rulesets.Mania/UI/Column.cs | 4 +- ...aniaColumnGroup.cs => ManiaColumnStage.cs} | 6 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 78 ++++++++----------- .../UI/ManiaRulesetContainer.cs | 7 +- .../osu.Game.Rulesets.Mania.csproj | 2 +- 6 files changed, 52 insertions(+), 59 deletions(-) rename osu.Game.Rulesets.Mania/UI/{ManiaColumnGroup.cs => ManiaColumnStage.cs} (95%) diff --git a/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs b/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs index e9e5d98fb8..defe1a6ba6 100644 --- a/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs @@ -2,11 +2,13 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Timing; +using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; @@ -82,7 +84,11 @@ namespace osu.Game.Rulesets.Mania.Tests Add(inputManager); ManiaPlayfield playfield; - inputManager.Add(playfield = new ManiaPlayfield(cols, false) + var stages = new List() + { + new StageDefinition() { Columns = cols }, + }; + inputManager.Add(playfield = new ManiaPlayfield(stages) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -104,7 +110,11 @@ namespace osu.Game.Rulesets.Mania.Tests Add(inputManager); ManiaPlayfield playfield; - inputManager.Add(playfield = new ManiaPlayfield(4,false) + var stages = new List() + { + new StageDefinition() { Columns = 4 }, + }; + inputManager.Add(playfield = new ManiaPlayfield(stages) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 6140452bb3..f9535bd58c 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Mania.UI { Name = "Hit target + hit objects", RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = ManiaColumnGroup.HIT_TARGET_POSITION }, + Padding = new MarginPadding { Top = ManiaColumnStage.HIT_TARGET_POSITION }, Children = new Drawable[] { new Container @@ -115,7 +115,7 @@ namespace osu.Game.Rulesets.Mania.UI { Name = "Key", RelativeSizeAxes = Axes.X, - Height = ManiaColumnGroup.HIT_TARGET_POSITION, + Height = ManiaColumnStage.HIT_TARGET_POSITION, Children = new Drawable[] { new Box diff --git a/osu.Game.Rulesets.Mania/UI/ManiaColumnGroup.cs b/osu.Game.Rulesets.Mania/UI/ManiaColumnStage.cs similarity index 95% rename from osu.Game.Rulesets.Mania/UI/ManiaColumnGroup.cs rename to osu.Game.Rulesets.Mania/UI/ManiaColumnStage.cs index 1e88b240b5..c0ee3536ff 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaColumnGroup.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaColumnStage.cs @@ -17,9 +17,9 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Mania.UI { /// - /// controls that from up to down + /// A collection of s. /// - internal class ManiaColumnGroup : ScrollingPlayfield + internal class ManiaColumnStage : ScrollingPlayfield { public const float HIT_TARGET_POSITION = 50; @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Mania.UI public readonly int ColumnCount; - public ManiaColumnGroup(int columnCount) + public ManiaColumnStage(int columnCount) : base(Axes.Y) { ColumnCount = columnCount; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index a5c5979057..8003738562 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -8,6 +8,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; @@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Mania.UI /// /// list mania column group /// - private readonly FillFlowContainer listColumnGroup; + private readonly FillFlowContainer listColumnStages; /// /// Whether this playfield should be inverted. This flips everything inside the playfield. @@ -33,10 +34,10 @@ namespace osu.Game.Rulesets.Mania.UI /// public SpecialColumnPosition SpecialColumnPosition { - get => listColumnGroup.FirstOrDefault()?.SpecialColumnPosition ?? SpecialColumnPosition.Normal; + get => listColumnStages.FirstOrDefault()?.SpecialColumnPosition ?? SpecialColumnPosition.Normal; set { - foreach (var singleGroup in listColumnGroup) + foreach (var singleGroup in listColumnStages) { singleGroup.SpecialColumnPosition = value; } @@ -48,25 +49,25 @@ namespace osu.Game.Rulesets.Mania.UI get { var list = new List(); - foreach (var single in listColumnGroup) + foreach (var stage in listColumnStages) { - list.AddRange(single.Columns); + list.AddRange(stage.Columns); } return list; } } - public ManiaPlayfield(int columnCount, bool coop) + public ManiaPlayfield(List stages) : base(Axes.Y) { - if (columnCount <= 0) + if (stages.Count <= 0) throw new ArgumentException("Can't have zero or fewer columns."); Inverted.Value = true; InternalChildren = new Drawable[] { - listColumnGroup = new FillFlowContainer + listColumnStages = new FillFlowContainer { Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.Y, @@ -76,39 +77,27 @@ namespace osu.Game.Rulesets.Mania.UI } }; - int numberOfGroup = 1; - if (coop) - numberOfGroup = 2; - - for (int i = 0; i < numberOfGroup; i++) - { - var group = new ManiaColumnGroup(columnCount / numberOfGroup); - listColumnGroup.Add(group); - } - - - foreach (var single in listColumnGroup) - { - single.VisibleTimeRange.BindTo(VisibleTimeRange); - AddNested(single); - } - var currentAction = ManiaAction.Key1; - for (int i = 0; i < columnCount; i++) - { - var c = new Column - { - //c.Action = c.IsSpecial ? ManiaAction.Special : currentAction++; - Action = currentAction++ - }; - /* - c.IsSpecial = isSpecialColumn(i); - topLevelContainer.Add(c.TopLevelContainer.CreateProxy()); - columns.Add(c); - */ - getFallDownControlContainerByActualColumn(i).AddColumn(c); - AddNested(c); + foreach (var stage in stages) + { + var group = new ManiaColumnStage(stage.Columns); + group.VisibleTimeRange.BindTo(VisibleTimeRange); + + listColumnStages.Add(group); + AddNested(group); + + for (int i = 0; i < stage.Columns; i++) + { + var c = new Column + { + //c.Action = c.IsSpecial ? ManiaAction.Special : currentAction++; + Action = currentAction++ + }; + + group.AddColumn(c); + AddNested(c); + } } Inverted.ValueChanged += invertedChanged; @@ -120,7 +109,7 @@ namespace osu.Game.Rulesets.Mania.UI Scale = new Vector2(1, newValue ? -1 : 1); //judgements.Scale = Scale; - foreach (var single in listColumnGroup) + foreach (var single in listColumnStages) { single.Judgements.Scale = Scale; } @@ -130,7 +119,7 @@ namespace osu.Game.Rulesets.Mania.UI { var maniaObject = (ManiaHitObject)judgedObject.HitObject; int column = maniaObject.Column; - Columns[maniaObject.Column].OnJudgement(judgedObject, judgement); + Columns[column].OnJudgement(judgedObject, judgement); getFallDownControlContainerByActualColumn(column).AddJudgement(judgement); } @@ -139,17 +128,16 @@ namespace osu.Game.Rulesets.Mania.UI public void Add(BarLine barline) { - //HitObjects.Add(new DrawableBarLine(barline)); - foreach (var single in listColumnGroup) + foreach (var single in listColumnStages) { single.HitObjects.Add(new DrawableBarLine(barline)); } } - private ManiaColumnGroup getFallDownControlContainerByActualColumn(int actualColumn) + private ManiaColumnStage getFallDownControlContainerByActualColumn(int actualColumn) { int sum = 0; - foreach (var single in listColumnGroup) + foreach (var single in listColumnStages) { sum = sum + single.ColumnCount; if (sum > actualColumn) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 53fd60b58f..ef611bb591 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -31,11 +31,6 @@ namespace osu.Game.Rulesets.Mania.UI { public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap; - /// - /// Co-op - /// - public bool Coop { get; set; } - public IEnumerable BarLines; public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) @@ -75,7 +70,7 @@ namespace osu.Game.Rulesets.Mania.UI BarLines.ForEach(Playfield.Add); } - protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.TotalColumns) + protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index ca94a9eb7e..1a8211b719 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -94,7 +94,7 @@ - +