mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 07:53:22 +08:00
Fix statistics not being wrapped by containers
This commit is contained in:
parent
34a8fcfd2f
commit
5ce2c712d3
@ -210,6 +210,11 @@ namespace osu.Game.Rulesets
|
|||||||
/// <returns>An empty frame for the current ruleset, or null if unsupported.</returns>
|
/// <returns>An empty frame for the current ruleset, or null if unsupported.</returns>
|
||||||
public virtual IConvertibleReplayFrame CreateConvertibleReplayFrame() => null;
|
public virtual IConvertibleReplayFrame CreateConvertibleReplayFrame() => null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates the statistics for a <see cref="ScoreInfo"/> to be displayed in the results screen.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="score">The <see cref="ScoreInfo"/> to create the statistics for. The score is guaranteed to have <see cref="ScoreInfo.HitEvents"/> populated.</param>
|
||||||
|
/// <returns>The <see cref="StatisticRow"/>s to display. Each <see cref="StatisticRow"/> may contain 0 or more <see cref="StatisticItem"/>.</returns>
|
||||||
[NotNull]
|
[NotNull]
|
||||||
public virtual StatisticRow[] CreateStatistics(ScoreInfo score) => Array.Empty<StatisticRow>();
|
public virtual StatisticRow[] CreateStatistics(ScoreInfo score) => Array.Empty<StatisticRow>();
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,13 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
|
|
||||||
public StatisticContainer(string name)
|
public StatisticContainer(string name)
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
InternalChild = new GridContainer
|
InternalChild = new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
@ -56,13 +60,15 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
{
|
{
|
||||||
content = new Container
|
content = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
RowDimensions = new[]
|
RowDimensions = new[]
|
||||||
{
|
{
|
||||||
new Dimension(GridSizeMode.AutoSize),
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,32 @@ using osu.Framework.Graphics.Containers;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Ranking.Statistics
|
namespace osu.Game.Screens.Ranking.Statistics
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An item to be displayed in a row of statistics inside the results screen.
|
||||||
|
/// </summary>
|
||||||
public class StatisticItem
|
public class StatisticItem
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The name of this item.
|
||||||
|
/// </summary>
|
||||||
public readonly string Name;
|
public readonly string Name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="Drawable"/> content to be displayed.
|
||||||
|
/// </summary>
|
||||||
public readonly Drawable Content;
|
public readonly Drawable Content;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="Dimension"/> of this row. This can be thought of as the column dimension of an encompassing <see cref="GridContainer"/>.
|
||||||
|
/// </summary>
|
||||||
public readonly Dimension Dimension;
|
public readonly Dimension Dimension;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="StatisticItem"/>, to be displayed inside a <see cref="StatisticRow"/> in the results screen.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name of this item.</param>
|
||||||
|
/// <param name="content">The <see cref="Drawable"/> content to be displayed.</param>
|
||||||
|
/// <param name="dimension">The <see cref="Dimension"/> of this row. This can be thought of as the column dimension of an encompassing <see cref="GridContainer"/>.</param>
|
||||||
public StatisticItem([NotNull] string name, [NotNull] Drawable content, [CanBeNull] Dimension dimension = null)
|
public StatisticItem([NotNull] string name, [NotNull] Drawable content, [CanBeNull] Dimension dimension = null)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
|
@ -5,12 +5,15 @@ using JetBrains.Annotations;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Ranking.Statistics
|
namespace osu.Game.Screens.Ranking.Statistics
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A row of statistics to be displayed in the results screen.
|
||||||
|
/// </summary>
|
||||||
public class StatisticRow
|
public class StatisticRow
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The columns of this <see cref="StatisticRow"/>.
|
/// The columns of this <see cref="StatisticRow"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ItemCanBeNull]
|
[ItemNotNull]
|
||||||
public StatisticItem[] Columns;
|
public StatisticItem[] Columns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,15 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Content = new[] { row.Columns?.Select(c => c?.Content).ToArray() },
|
Content = new[]
|
||||||
ColumnDimensions = Enumerable.Range(0, row.Columns?.Length ?? 0).Select(i => row.Columns[i]?.Dimension ?? new Dimension()).ToArray(),
|
{
|
||||||
|
row.Columns?.Select(c => new StatisticContainer(c.Name)
|
||||||
|
{
|
||||||
|
Child = c.Content
|
||||||
|
}).Cast<Drawable>().ToArray()
|
||||||
|
},
|
||||||
|
ColumnDimensions = Enumerable.Range(0, row.Columns?.Length ?? 0)
|
||||||
|
.Select(i => row.Columns[i].Dimension ?? new Dimension()).ToArray(),
|
||||||
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
|
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user