Skip to content

Commit

Permalink
Ruleset: Fix CreateStatisticsForScore method
Browse files Browse the repository at this point in the history
  • Loading branch information
goodtrailer committed Jun 15, 2023
1 parent c8093b1 commit 497f411
Showing 1 changed file with 27 additions and 49 deletions.
76 changes: 27 additions & 49 deletions osu.Game.Rulesets.Soyokaze/SoyokazeRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Bindings;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Overlays.Settings;
Expand Down Expand Up @@ -77,66 +75,46 @@ public override ISkin CreateSkinTransformer(ISkin skin, IBeatmap beatmap)

public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new SoyokazeReplayFrame();

public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap)
public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap)
{
List<HitEvent>[] HitEventsLists = new List<HitEvent>[8];
for (int i = 0; i < HitEventsLists.Length; i++)
HitEventsLists[i] = new List<HitEvent>();
var hitEventLists = new List<HitEvent>[8];
for (int i = 0; i < hitEventLists.Length; i++)
hitEventLists[i] = new List<HitEvent>();

foreach (HitEvent hitEvent in score.HitEvents)
foreach (var hitEvent in score.HitEvents)
{
if (!(hitEvent.HitObject is SoyokazeHitObject soyokazeObject))
continue;

Logger.Log("OBJECT: " + hitEvent.HitObject.GetType());

HitEventsLists[(int)soyokazeObject.Button].Add(hitEvent);
hitEventLists[(int)soyokazeObject.Button].Add(hitEvent);
}

return new StatisticRow[]
return new[]
{
new StatisticRow
new StatisticItem("Button Accuracies", () =>
{
Columns = new StatisticItem[]
Container accuracyGraphsContainer = new Container()
{
new StatisticItem("Button Accuracies", () =>
{
Container accuracyGraphsContainer = new Container()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
};
Vector2[] positions = PositionExtensions.GetPositions(220, 110, true, Anchor.Centre);
for (int i = 0; i < positions.Length; i++)
accuracyGraphsContainer.Add(new AccuracyGraph(HitEventsLists[i]) { Position = positions[i] });
return accuracyGraphsContainer;
}),
},
},
new StatisticRow
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
};
Vector2[] positions = PositionExtensions.GetPositions(220, 110, true, Anchor.Centre);
for (int i = 0; i < positions.Length; i++)
accuracyGraphsContainer.Add(new AccuracyGraph(hitEventLists[i]) { Position = positions[i] });
return accuracyGraphsContainer;
}, true),
new StatisticItem("Overall Distribution", () => new HitEventTimingDistributionGraph(score.HitEvents)
{
Columns = new StatisticItem[]
{
new StatisticItem("Overall Distribution", () => new HitEventTimingDistributionGraph(score.HitEvents)
{
RelativeSizeAxes = Axes.X,
Size = new Vector2(1f, 100f)
}),
}
},
new StatisticRow
RelativeSizeAxes = Axes.X,
Size = new Vector2(1f, 100f)
}, true),
new StatisticItem("", () => new UnstableRate(score.HitEvents)
{
Columns = new StatisticItem[]
{
new StatisticItem("", () => new UnstableRate(score.HitEvents)
{
AutoSizeAxes = Axes.None,
RelativeSizeAxes = Axes.X,
Size = new Vector2(0.2f, 10f)
}),
},
},
AutoSizeAxes = Axes.None,
RelativeSizeAxes = Axes.X,
Size = new Vector2(0.2f, 10f)
}, true),
};
}

Expand Down

0 comments on commit 497f411

Please sign in to comment.