Merge branch 'refactor_hitrenderer' into beatmap_conversion

Conflicts:
	osu.Game/Modes/UI/HitRenderer.cs
This commit is contained in:
smoogipooo
2017-03-12 01:27:28 +09:00
7 changed files with 61 additions and 91 deletions

View File

@ -1,11 +1,11 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transforms;
using osu.Framework.MathUtils;
using osu.Game.Graphics.UserInterface;
using System;
namespace osu.Game.Modes.UI
{
@ -31,7 +31,7 @@ namespace osu.Game.Modes.UI
public override void Increment(ulong amount)
{
Count = Count + amount;
Current.Value = Current + amount;
}
protected class TransformComboResult : Transform<ulong>

View File

@ -11,6 +11,7 @@ using osu.Game.Modes.Objects.Drawables;
using osu.Game.Screens.Play;
using System;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Modes.UI
{
@ -27,28 +28,15 @@ namespace osu.Game.Modes.UI
public abstract Func<Vector2, Vector2> MapPlayfieldToScreenSpace { get; }
/// <summary>
/// The number of Judgements required to be triggered
/// before the game enters post-play routines.
/// Whether all the HitObjects have been judged.
/// </summary>
protected abstract int JudgementCount { get; }
private int maxJudgements;
private int countJudgements;
protected override void LoadComplete()
{
base.LoadComplete();
maxJudgements = JudgementCount;
}
protected abstract bool AllObjectsJudged { get; }
protected void TriggerOnJudgement(JudgementInfo j)
{
countJudgements++;
OnJudgement?.Invoke(j);
if (countJudgements == maxJudgements)
if (AllObjectsJudged)
OnAllJudged?.Invoke();
}
}
@ -60,9 +48,7 @@ namespace osu.Game.Modes.UI
public IEnumerable<DrawableHitObject> DrawableObjects => Playfield.HitObjects.Children;
protected override Container<Drawable> Content => content;
private int judgementCount;
protected override int JudgementCount => judgementCount;
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result.HasValue);
protected Playfield<TObject> Playfield;
@ -107,8 +93,6 @@ namespace osu.Game.Modes.UI
drawableObject.OnJudgement += onJudgement;
Playfield.Add(drawableObject);
judgementCount++;
}
Playfield.PostProcess();

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Modes.Objects;
using osu.Game.Screens.Play;
using System;
@ -29,19 +28,6 @@ namespace osu.Game.Modes.UI
protected abstract ScoreCounter CreateScoreCounter();
protected abstract HealthDisplay CreateHealthDisplay();
public virtual void OnHit(HitObject h)
{
ComboCounter?.Increment();
ScoreCounter?.Increment(300);
AccuracyCounter?.Set(Math.Min(1, AccuracyCounter.Count + 0.01f));
}
public virtual void OnMiss(HitObject h)
{
ComboCounter.Current.Value = 0;
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
}
protected HudOverlay()
{
RelativeSizeAxes = Axes.Both;
@ -76,8 +62,8 @@ namespace osu.Game.Modes.UI
{
//bind processor bindables to combocounter, score display etc.
//TODO: these should be bindable binds, not events!
processor.TotalScore.ValueChanged += delegate { ScoreCounter?.Set((ulong)processor.TotalScore.Value); };
processor.Accuracy.ValueChanged += delegate { AccuracyCounter?.Set((float)processor.Accuracy.Value); };
ScoreCounter?.Current.BindTo(processor.TotalScore);
AccuracyCounter?.Current.BindTo(processor.Accuracy);
ComboCounter?.Current.BindTo(processor.Combo);
HealthDisplay?.Current.BindTo(processor.Health);
}