mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 22:35:23 +08:00
Nest model class
This commit is contained in:
parent
a55ce9b586
commit
0a7d6948ca
@ -18,9 +18,9 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
|||||||
public BindableBool ShowName = new BindableBool();
|
public BindableBool ShowName = new BindableBool();
|
||||||
public Bindable<FillDirection> Direction = new Bindable<FillDirection>();
|
public Bindable<FillDirection> Direction = new Bindable<FillDirection>();
|
||||||
|
|
||||||
public readonly JudgementCounterInfo Result;
|
public readonly JudgementTally.JudgementCount Result;
|
||||||
|
|
||||||
public JudgementCounter(JudgementCounterInfo result) => Result = result;
|
public JudgementCounter(JudgementTally.JudgementCount result) => Result = result;
|
||||||
|
|
||||||
public OsuSpriteText ResultName = null!;
|
public OsuSpriteText ResultName = null!;
|
||||||
private FillFlowContainer flowContainer = null!;
|
private FillFlowContainer flowContainer = null!;
|
||||||
|
@ -124,7 +124,7 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
|||||||
All
|
All
|
||||||
}
|
}
|
||||||
|
|
||||||
private JudgementCounter createCounter(JudgementCounterInfo info)
|
private JudgementCounter createCounter(JudgementTally.JudgementCount info)
|
||||||
{
|
{
|
||||||
JudgementCounter counter = new JudgementCounter(info)
|
JudgementCounter counter = new JudgementCounter(info)
|
||||||
{
|
{
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
// 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 osu.Framework.Bindables;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
|
||||||
{
|
|
||||||
public struct JudgementCounterInfo
|
|
||||||
{
|
|
||||||
public HitResult Type { get; set; }
|
|
||||||
|
|
||||||
public BindableInt ResultCount { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,19 +12,23 @@ using osu.Game.Rulesets.Scoring;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Keeps track of judgements for a current play session, exposing bindable counts which can
|
||||||
|
/// be used for display purposes.
|
||||||
|
/// </summary>
|
||||||
public partial class JudgementTally : CompositeDrawable
|
public partial class JudgementTally : CompositeDrawable
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private ScoreProcessor scoreProcessor { get; set; } = null!;
|
private ScoreProcessor scoreProcessor { get; set; } = null!;
|
||||||
|
|
||||||
public List<JudgementCounterInfo> Results = new List<JudgementCounterInfo>();
|
public List<JudgementCount> Results = new List<JudgementCount>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IBindable<RulesetInfo> ruleset)
|
private void load(IBindable<RulesetInfo> ruleset)
|
||||||
{
|
{
|
||||||
foreach (var result in ruleset.Value.CreateInstance().GetHitResults())
|
foreach (var result in ruleset.Value.CreateInstance().GetHitResults())
|
||||||
{
|
{
|
||||||
Results.Add(new JudgementCounterInfo
|
Results.Add(new JudgementCount
|
||||||
{
|
{
|
||||||
Type = result.result,
|
Type = result.result,
|
||||||
ResultCount = new BindableInt()
|
ResultCount = new BindableInt()
|
||||||
@ -42,8 +46,15 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
|||||||
|
|
||||||
private void updateCount(JudgementResult judgement, bool revert)
|
private void updateCount(JudgementResult judgement, bool revert)
|
||||||
{
|
{
|
||||||
foreach (JudgementCounterInfo result in Results.Where(result => result.Type == judgement.Type))
|
foreach (JudgementCount result in Results.Where(result => result.Type == judgement.Type))
|
||||||
result.ResultCount.Value = revert ? result.ResultCount.Value - 1 : result.ResultCount.Value + 1;
|
result.ResultCount.Value = revert ? result.ResultCount.Value - 1 : result.ResultCount.Value + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct JudgementCount
|
||||||
|
{
|
||||||
|
public HitResult Type { get; set; }
|
||||||
|
|
||||||
|
public BindableInt ResultCount { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user