mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 16:43:52 +09:00
Change interface for creating statistic rows
This commit is contained in:
@ -29,6 +29,7 @@ using osu.Game.Rulesets.Scoring;
|
|||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Osu.Statistics;
|
using osu.Game.Rulesets.Osu.Statistics;
|
||||||
using osu.Game.Screens.Ranking.Statistics;
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
|
|
||||||
@ -189,16 +190,36 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
|
|
||||||
public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuRulesetConfigManager(settings, RulesetInfo);
|
public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuRulesetConfigManager(settings, RulesetInfo);
|
||||||
|
|
||||||
public override IEnumerable<StatisticContainer> CreateStatistics(ScoreInfo score) => new[]
|
public override StatisticRow[] CreateStatistics(ScoreInfo score) => new[]
|
||||||
|
{
|
||||||
|
new StatisticRow
|
||||||
|
{
|
||||||
|
Content = new Drawable[]
|
||||||
{
|
{
|
||||||
new StatisticContainer("Timing Distribution")
|
new StatisticContainer("Timing Distribution")
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 130,
|
||||||
Child = new TimingDistributionGraph((TimingDistribution)score.ExtraStatistics.GetValueOrDefault("timing_distribution"))
|
Child = new TimingDistributionGraph((TimingDistribution)score.ExtraStatistics.GetValueOrDefault("timing_distribution"))
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
}
|
||||||
},
|
},
|
||||||
new StatisticContainer("Accuracy Heatmap")
|
new StatisticContainer("Accuracy Heatmap")
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = new Heatmap((List<HitOffset>)score.ExtraStatistics.GetValueOrDefault("hit_offsets"))
|
Child = new Heatmap((List<HitOffset>)score.ExtraStatistics.GetValueOrDefault("hit_offsets"))
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
ColumnDimensions = new[]
|
||||||
|
{
|
||||||
|
new Dimension(),
|
||||||
|
new Dimension(GridSizeMode.Absolute, 130),
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,6 +210,6 @@ 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;
|
||||||
|
|
||||||
public virtual IEnumerable<StatisticContainer> CreateStatistics(ScoreInfo score) => Enumerable.Empty<StatisticContainer>();
|
public virtual StatisticRow[] CreateStatistics(ScoreInfo score) => Array.Empty<StatisticRow>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
{
|
{
|
||||||
InternalChild = new GridContainer
|
InternalChild = new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
|
15
osu.Game/Screens/Ranking/Statistics/StatisticRow.cs
Normal file
15
osu.Game/Screens/Ranking/Statistics/StatisticRow.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Ranking.Statistics
|
||||||
|
{
|
||||||
|
public class StatisticRow
|
||||||
|
{
|
||||||
|
public Drawable[] Content = Array.Empty<Drawable>();
|
||||||
|
public Dimension[] ColumnDimensions = Array.Empty<Dimension>();
|
||||||
|
}
|
||||||
|
}
|
@ -17,7 +17,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
// Todo: Not correct.
|
// Todo: Not correct.
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Container<StatisticContainer> statistics;
|
FillFlowContainer statisticRows;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -41,16 +41,26 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
Left = ScorePanel.EXPANDED_WIDTH + 30 + 50,
|
Left = ScorePanel.EXPANDED_WIDTH + 30 + 50,
|
||||||
Right = 50
|
Right = 50
|
||||||
},
|
},
|
||||||
Child = statistics = new FillFlowContainer<StatisticContainer>
|
Child = statisticRows = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
Spacing = new Vector2(30, 15),
|
Spacing = new Vector2(30, 15),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var s in score.Ruleset.CreateInstance().CreateStatistics(score))
|
foreach (var s in score.Ruleset.CreateInstance().CreateStatistics(score))
|
||||||
statistics.Add(s);
|
{
|
||||||
|
statisticRows.Add(new GridContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Content = new[] { s.Content },
|
||||||
|
ColumnDimensions = s.ColumnDimensions,
|
||||||
|
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user