fix some error that smoogipoo says

This commit is contained in:
ANDY840119-PC\andy840119 2018-01-03 22:58:08 +09:00
parent edb1401f00
commit 5326f71ed9
6 changed files with 52 additions and 59 deletions

View File

@ -2,11 +2,13 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
@ -82,7 +84,11 @@ namespace osu.Game.Rulesets.Mania.Tests
Add(inputManager); Add(inputManager);
ManiaPlayfield playfield; ManiaPlayfield playfield;
inputManager.Add(playfield = new ManiaPlayfield(cols, false) var stages = new List<StageDefinition>()
{
new StageDefinition() { Columns = cols },
};
inputManager.Add(playfield = new ManiaPlayfield(stages)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -104,7 +110,11 @@ namespace osu.Game.Rulesets.Mania.Tests
Add(inputManager); Add(inputManager);
ManiaPlayfield playfield; ManiaPlayfield playfield;
inputManager.Add(playfield = new ManiaPlayfield(4,false) var stages = new List<StageDefinition>()
{
new StageDefinition() { Columns = 4 },
};
inputManager.Add(playfield = new ManiaPlayfield(stages)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

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 = ManiaColumnGroup.HIT_TARGET_POSITION }, Padding = new MarginPadding { Top = ManiaColumnStage.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 = ManiaColumnGroup.HIT_TARGET_POSITION, Height = ManiaColumnStage.HIT_TARGET_POSITION,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box

View File

@ -17,9 +17,9 @@ using OpenTK.Graphics;
namespace osu.Game.Rulesets.Mania.UI namespace osu.Game.Rulesets.Mania.UI
{ {
/// <summary> /// <summary>
/// controls that from up to down /// A collection of <see cref="Column"/>s.
/// </summary> /// </summary>
internal class ManiaColumnGroup : ScrollingPlayfield internal class ManiaColumnStage : ScrollingPlayfield
{ {
public const float HIT_TARGET_POSITION = 50; public const float HIT_TARGET_POSITION = 50;
@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Mania.UI
public readonly int ColumnCount; public readonly int ColumnCount;
public ManiaColumnGroup(int columnCount) public ManiaColumnStage(int columnCount)
: base(Axes.Y) : base(Axes.Y)
{ {
ColumnCount = columnCount; ColumnCount = columnCount;

View File

@ -8,6 +8,7 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Mania.UI
/// <summary> /// <summary>
/// list mania column group /// list mania column group
/// </summary> /// </summary>
private readonly FillFlowContainer<ManiaColumnGroup> listColumnGroup; private readonly FillFlowContainer<ManiaColumnStage> listColumnStages;
/// <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.
@ -33,10 +34,10 @@ namespace osu.Game.Rulesets.Mania.UI
/// </summary> /// </summary>
public SpecialColumnPosition SpecialColumnPosition public SpecialColumnPosition SpecialColumnPosition
{ {
get => listColumnGroup.FirstOrDefault()?.SpecialColumnPosition ?? SpecialColumnPosition.Normal; get => listColumnStages.FirstOrDefault()?.SpecialColumnPosition ?? SpecialColumnPosition.Normal;
set set
{ {
foreach (var singleGroup in listColumnGroup) foreach (var singleGroup in listColumnStages)
{ {
singleGroup.SpecialColumnPosition = value; singleGroup.SpecialColumnPosition = value;
} }
@ -48,25 +49,25 @@ namespace osu.Game.Rulesets.Mania.UI
get get
{ {
var list = new List<Column>(); var list = new List<Column>();
foreach (var single in listColumnGroup) foreach (var stage in listColumnStages)
{ {
list.AddRange(single.Columns); list.AddRange(stage.Columns);
} }
return list; return list;
} }
} }
public ManiaPlayfield(int columnCount, bool coop) public ManiaPlayfield(List<StageDefinition> stages)
: base(Axes.Y) : base(Axes.Y)
{ {
if (columnCount <= 0) if (stages.Count <= 0)
throw new ArgumentException("Can't have zero or fewer columns."); throw new ArgumentException("Can't have zero or fewer columns.");
Inverted.Value = true; Inverted.Value = true;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
listColumnGroup = new FillFlowContainer<ManiaColumnGroup> listColumnStages = new FillFlowContainer<ManiaColumnStage>
{ {
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.Y, 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; var currentAction = ManiaAction.Key1;
for (int i = 0; i < columnCount; i++)
{
var c = new Column
{
//c.Action = c.IsSpecial ? ManiaAction.Special : currentAction++;
Action = currentAction++
};
/* foreach (var stage in stages)
c.IsSpecial = isSpecialColumn(i); {
topLevelContainer.Add(c.TopLevelContainer.CreateProxy()); var group = new ManiaColumnStage(stage.Columns);
columns.Add(c); group.VisibleTimeRange.BindTo(VisibleTimeRange);
*/
getFallDownControlContainerByActualColumn(i).AddColumn(c); listColumnStages.Add(group);
AddNested(c); 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; Inverted.ValueChanged += invertedChanged;
@ -120,7 +109,7 @@ namespace osu.Game.Rulesets.Mania.UI
Scale = new Vector2(1, newValue ? -1 : 1); Scale = new Vector2(1, newValue ? -1 : 1);
//judgements.Scale = Scale; //judgements.Scale = Scale;
foreach (var single in listColumnGroup) foreach (var single in listColumnStages)
{ {
single.Judgements.Scale = Scale; single.Judgements.Scale = Scale;
} }
@ -130,7 +119,7 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
var maniaObject = (ManiaHitObject)judgedObject.HitObject; var maniaObject = (ManiaHitObject)judgedObject.HitObject;
int column = maniaObject.Column; int column = maniaObject.Column;
Columns[maniaObject.Column].OnJudgement(judgedObject, judgement); Columns[column].OnJudgement(judgedObject, judgement);
getFallDownControlContainerByActualColumn(column).AddJudgement(judgement); getFallDownControlContainerByActualColumn(column).AddJudgement(judgement);
} }
@ -139,17 +128,16 @@ namespace osu.Game.Rulesets.Mania.UI
public void Add(BarLine barline) public void Add(BarLine barline)
{ {
//HitObjects.Add(new DrawableBarLine(barline)); foreach (var single in listColumnStages)
foreach (var single in listColumnGroup)
{ {
single.HitObjects.Add(new DrawableBarLine(barline)); single.HitObjects.Add(new DrawableBarLine(barline));
} }
} }
private ManiaColumnGroup getFallDownControlContainerByActualColumn(int actualColumn) private ManiaColumnStage getFallDownControlContainerByActualColumn(int actualColumn)
{ {
int sum = 0; int sum = 0;
foreach (var single in listColumnGroup) foreach (var single in listColumnStages)
{ {
sum = sum + single.ColumnCount; sum = sum + single.ColumnCount;
if (sum > actualColumn) if (sum > actualColumn)

View File

@ -31,11 +31,6 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap; public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap;
/// <summary>
/// Co-op
/// </summary>
public bool Coop { get; set; }
public IEnumerable<BarLine> BarLines; public IEnumerable<BarLine> BarLines;
public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
@ -75,7 +70,7 @@ namespace osu.Game.Rulesets.Mania.UI
BarLines.ForEach(Playfield.Add); 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, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -94,7 +94,7 @@
<Compile Include="Timing\ScrollingAlgorithm.cs" /> <Compile Include="Timing\ScrollingAlgorithm.cs" />
<Compile Include="UI\Column.cs" /> <Compile Include="UI\Column.cs" />
<Compile Include="UI\DrawableManiaJudgement.cs" /> <Compile Include="UI\DrawableManiaJudgement.cs" />
<Compile Include="UI\ManiaColumnGroup.cs" /> <Compile Include="UI\ManiaColumnStage.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" />