mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 16:23:16 +08:00
Remove weird panelIsComplete
flag and replace LINQ with simple foreach
This commit is contained in:
parent
df9d99f5aa
commit
6974c2d255
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -131,41 +132,48 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool panelIsComplete = true;
|
bool anyRequiredHitEvents = false;
|
||||||
|
|
||||||
foreach (var row in statisticRows)
|
foreach (var row in statisticRows)
|
||||||
{
|
{
|
||||||
var columnsToDisplay = hitEventsAvailable
|
var columns = row.Columns;
|
||||||
? row.Columns
|
|
||||||
: row.Columns.Where(c => !c.RequiresHitEvents).ToArray();
|
|
||||||
|
|
||||||
if (columnsToDisplay.Length < row.Columns.Length)
|
if (columns.Length == 0)
|
||||||
panelIsComplete = false;
|
|
||||||
|
|
||||||
if (columnsToDisplay.Length == 0)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
var columnContent = new List<Drawable>();
|
||||||
|
var dimensions = new List<Dimension>();
|
||||||
|
|
||||||
|
foreach (var col in columns)
|
||||||
|
{
|
||||||
|
if (!hitEventsAvailable && col.RequiresHitEvents)
|
||||||
|
{
|
||||||
|
anyRequiredHitEvents = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
columnContent.Add(new StatisticContainer(col)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
});
|
||||||
|
|
||||||
|
dimensions.Add(col.Dimension ?? new Dimension());
|
||||||
|
}
|
||||||
|
|
||||||
rows.Add(new GridContainer
|
rows.Add(new GridContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Content = new[]
|
Content = new[] { columnContent.ToArray() },
|
||||||
{
|
ColumnDimensions = dimensions.ToArray(),
|
||||||
columnsToDisplay?.Select(c => new StatisticContainer(c)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
}).Cast<Drawable>().ToArray()
|
|
||||||
},
|
|
||||||
ColumnDimensions = Enumerable.Range(0, columnsToDisplay.Length)
|
|
||||||
.Select(i => columnsToDisplay[i].Dimension ?? new Dimension()).ToArray(),
|
|
||||||
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
|
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hitEventsAvailable && !panelIsComplete)
|
if (anyRequiredHitEvents)
|
||||||
{
|
{
|
||||||
rows.Add(new FillFlowContainer
|
rows.Add(new FillFlowContainer
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user