From 43f04098937bf2f3e4080736851db1341b37bfff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Oct 2016 19:44:03 +0900 Subject: [PATCH] Start to structure flow of information in Player. - Allow basic clicking of hitobjects. - Break non-osu! game modes temporarily. - Fix some issues with RollingCounters. - Add the ability to increment counters. --- .../Tests/TestCaseHitObjects.cs | 4 +- .../Tests/TestCasePlayer.cs | 6 +- .../Beatmaps/Objects/DrawableHitObject.cs | 71 +++++++++++++++++++ osu.Game/Beatmaps/Objects/HitObject.cs | 4 +- .../Objects/Osu/Drawable/DrawableCircle.cs | 49 ++++--------- .../GameModes/Play/Catch/CatchHitRenderer.cs | 2 +- osu.Game/GameModes/Play/ComboCounter.cs | 11 ++- osu.Game/GameModes/Play/ComboResultCounter.cs | 5 ++ osu.Game/GameModes/Play/HitRenderer.cs | 32 ++++++++- .../GameModes/Play/Mania/ManiaHitRenderer.cs | 13 ++-- osu.Game/GameModes/Play/Osu/OsuHitRenderer.cs | 2 +- .../GameModes/Play/Osu/ScoreOverlayOsu.cs | 55 ++++++++++++++ osu.Game/GameModes/Play/Player.cs | 60 +++++++--------- osu.Game/GameModes/Play/ScoreOverlay.cs | 53 ++++++++++++++ .../GameModes/Play/Taiko/TaikoHitRenderer.cs | 2 +- .../UserInterface/PercentageCounter.cs | 5 ++ .../Graphics/UserInterface/RollingCounter.cs | 11 ++- .../Graphics/UserInterface/ScoreCounter.cs | 5 ++ osu.Game/osu.Game.csproj | 5 +- 19 files changed, 303 insertions(+), 92 deletions(-) create mode 100644 osu.Game/Beatmaps/Objects/DrawableHitObject.cs create mode 100644 osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs create mode 100644 osu.Game/GameModes/Play/ScoreOverlay.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 26275ea9e5..dc881f8c21 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -12,6 +12,7 @@ using osu.Framework.Timing; using osu.Framework.Graphics; using osu.Game.Beatmaps.Objects.Osu; using osu.Game.Beatmaps.Objects.Osu.Drawable; +using osu.Game.Beatmaps.Objects; namespace osu.Desktop.Tests { @@ -50,7 +51,7 @@ namespace osu.Desktop.Tests Anchor = Anchor.Centre, Origin = Anchor.Centre, Depth = -i, - State = HitState.Armed, + State = ArmedState.Armed, }); } } @@ -59,7 +60,6 @@ namespace osu.Desktop.Tests { base.Update(); ourClock.ProcessFrame(); - } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 0b8e60171a..52474d0995 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -32,13 +32,13 @@ namespace osu.Desktop.Tests var objects = new List(); - int time = 500; - for (int i = 0; i < 1; i++) + int time = 1500; + for (int i = 0; i < 50; i++) { objects.Add(new Circle() { StartTime = time, - Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384)) + Position = new Vector2(RNG.Next(100, 400), RNG.Next(100, 200)) }); time += 500; diff --git a/osu.Game/Beatmaps/Objects/DrawableHitObject.cs b/osu.Game/Beatmaps/Objects/DrawableHitObject.cs new file mode 100644 index 0000000000..0f8502b54f --- /dev/null +++ b/osu.Game/Beatmaps/Objects/DrawableHitObject.cs @@ -0,0 +1,71 @@ +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using osu.Framework; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps.Objects.Osu.Drawable; + +namespace osu.Game.Beatmaps.Objects +{ + public abstract class DrawableHitObject : Container, IStateful + { + public Action OnHit; + public Action OnMiss; + + public HitObject HitObject; + + public DrawableHitObject(HitObject hitObject) + { + HitObject = hitObject; + } + + private ArmedState state; + public ArmedState State + { + get { return state; } + + set + { + state = value; + + UpdateState(state); + } + } + + public override void Load(BaseGame game) + { + base.Load(game); + + UpdateState(state); + } + + private bool counted; + + protected override void Update() + { + base.Update(); + + if (Time >= HitObject.EndTime && !counted) + { + counted = true; + if (state == ArmedState.Armed) + OnHit?.Invoke(this); + else + OnMiss?.Invoke(this); + } + } + + protected abstract void UpdateState(ArmedState state); + } + + public enum ArmedState + { + Disarmed, + Armed + } +} diff --git a/osu.Game/Beatmaps/Objects/HitObject.cs b/osu.Game/Beatmaps/Objects/HitObject.cs index 16f0bb8a43..44cab54fa3 100644 --- a/osu.Game/Beatmaps/Objects/HitObject.cs +++ b/osu.Game/Beatmaps/Objects/HitObject.cs @@ -13,9 +13,9 @@ namespace osu.Game.Beatmaps.Objects public abstract class HitObject { public double StartTime; - public double? EndTime; + public virtual double EndTime => StartTime; - public double Duration => (EndTime ?? StartTime) - StartTime; + public double Duration => EndTime - StartTime; public HitSampleInfo Sample; diff --git a/osu.Game/Beatmaps/Objects/Osu/Drawable/DrawableCircle.cs b/osu.Game/Beatmaps/Objects/Osu/Drawable/DrawableCircle.cs index b2cf41f101..bbfcac9d39 100644 --- a/osu.Game/Beatmaps/Objects/Osu/Drawable/DrawableCircle.cs +++ b/osu.Game/Beatmaps/Objects/Osu/Drawable/DrawableCircle.cs @@ -15,13 +15,7 @@ using osu.Framework.MathUtils; namespace osu.Game.Beatmaps.Objects.Osu.Drawable { - public enum HitState - { - Disarmed, - Armed - } - - public class DrawableCircle : Container, IStateful + public class DrawableCircle : DrawableHitObject { private Sprite approachCircle; private CirclePart circle; @@ -32,7 +26,7 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable private GlowPart glow; private OsuBaseHit h; - public DrawableCircle(Circle h) + public DrawableCircle(Circle h) : base(h) { this.h = h; @@ -50,7 +44,7 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable circle = new CirclePart() { Colour = h.Colour, - Hit = delegate { State = HitState.Armed; } + Hit = delegate { State = ArmedState.Armed; } }, number = new NumberPart(), ring = new RingPart(), @@ -68,8 +62,6 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable }; Size = new Vector2(100); - - State = HitState.Armed; } public override void Load(BaseGame game) @@ -77,6 +69,13 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable base.Load(game); approachCircle.Texture = game.Textures.Get(@"Play/osu/approachcircle@2x"); + } + + protected override void UpdateState(ArmedState state) + { + if (!IsLoaded) return; + + Flush(); //move to DrawableHitObject Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime - 1000, EndTime = h.StartTime - 800, StartValue = 0, EndValue = 1 }); @@ -85,35 +84,12 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable glow.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime, EndTime = h.StartTime + 400, StartValue = glow.Alpha, EndValue = 0 }); - updateState(); - - Transforms.Add(new TransformScale(Clock) { StartTime = h.StartTime + h.Duration, EndTime = h.StartTime + h.Duration + 400, StartValue = Scale, EndValue = Scale * 1.5f, Easing = EasingTypes.OutQuad }); - Expire(true); - } - - private HitState state; - public HitState State - { - get { return state; } - - set - { - state = value; - - updateState(); - } - } - - private void updateState() - { - if (!IsLoaded) return; - switch (state) { - case HitState.Disarmed: + case ArmedState.Disarmed: Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 }); break; - case HitState.Armed: + case ArmedState.Armed: const float flashIn = 30; const float fadeOut = 800; @@ -130,6 +106,7 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn + fadeOut, StartValue = 1, EndValue = 0 }); + Transforms.Add(new TransformScale(Clock) { StartTime = h.StartTime + h.Duration, EndTime = h.StartTime + h.Duration + 400, StartValue = Scale, EndValue = Scale * 1.5f, Easing = EasingTypes.OutQuad }); break; } } diff --git a/osu.Game/GameModes/Play/Catch/CatchHitRenderer.cs b/osu.Game/GameModes/Play/Catch/CatchHitRenderer.cs index 3de1c34915..729839de7c 100644 --- a/osu.Game/GameModes/Play/Catch/CatchHitRenderer.cs +++ b/osu.Game/GameModes/Play/Catch/CatchHitRenderer.cs @@ -14,6 +14,6 @@ namespace osu.Game.GameModes.Play.Catch protected override Playfield CreatePlayfield() => new CatchPlayfield(); - protected override Drawable GetVisualRepresentation(CatchBaseHit h) => new DrawableFruit(h); + protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) => null;// new DrawableFruit(h); } } diff --git a/osu.Game/GameModes/Play/ComboCounter.cs b/osu.Game/GameModes/Play/ComboCounter.cs index cd3dac77aa..946569af14 100644 --- a/osu.Game/GameModes/Play/ComboCounter.cs +++ b/osu.Game/GameModes/Play/ComboCounter.cs @@ -17,7 +17,7 @@ using System.Threading.Tasks; namespace osu.Game.GameModes.Play { - public abstract class ComboCounter : Container + public abstract class ComboCounter : AutoSizeContainer { public bool IsRolling { @@ -78,9 +78,14 @@ namespace osu.Game.GameModes.Play } } + public void Increment(ulong amount = 1) + { + Count = Count + amount; + } + protected SpriteText DisplayedCountSpriteText; - private float textSize = 20.0f; + private float textSize; public float TextSize { get { return textSize; } @@ -108,6 +113,8 @@ namespace osu.Game.GameModes.Play Alpha = 0, } }; + + TextSize = 80; } public override void Load(BaseGame game) diff --git a/osu.Game/GameModes/Play/ComboResultCounter.cs b/osu.Game/GameModes/Play/ComboResultCounter.cs index e86a845375..a07e35b263 100644 --- a/osu.Game/GameModes/Play/ComboResultCounter.cs +++ b/osu.Game/GameModes/Play/ComboResultCounter.cs @@ -34,6 +34,11 @@ namespace osu.Game.GameModes.Play return $@"{count}x"; } + public override void Increment(ulong amount) + { + Count = Count + amount; + } + protected class TransformComboResult : Transform { public override ulong CurrentValue diff --git a/osu.Game/GameModes/Play/HitRenderer.cs b/osu.Game/GameModes/Play/HitRenderer.cs index 53cca2072c..c31fb2848e 100644 --- a/osu.Game/GameModes/Play/HitRenderer.cs +++ b/osu.Game/GameModes/Play/HitRenderer.cs @@ -6,10 +6,17 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps.Objects; using osu.Framework; +using System; namespace osu.Game.GameModes.Play { - public abstract class HitRenderer : Container + public abstract class HitRenderer : Container + { + public Action OnHit; + public Action OnMiss; + } + + public abstract class HitRenderer : HitRenderer where T : HitObject { private List objects; @@ -50,9 +57,28 @@ namespace osu.Game.GameModes.Play { if (objects == null) return; foreach (T h in objects) - playfield.Add(GetVisualRepresentation(h)); + { + var drawableObject = GetVisualRepresentation(h); + + if (drawableObject == null) continue; + + drawableObject.OnHit = onHit; + drawableObject.OnMiss = onMiss; + + playfield.Add(drawableObject); + } } - protected abstract Drawable GetVisualRepresentation(T h); + private void onMiss(DrawableHitObject obj) + { + OnMiss?.Invoke(obj.HitObject); + } + + private void onHit(DrawableHitObject obj) + { + OnHit?.Invoke(obj.HitObject); + } + + protected abstract DrawableHitObject GetVisualRepresentation(T h); } } diff --git a/osu.Game/GameModes/Play/Mania/ManiaHitRenderer.cs b/osu.Game/GameModes/Play/Mania/ManiaHitRenderer.cs index 93b9a58822..417ed1b698 100644 --- a/osu.Game/GameModes/Play/Mania/ManiaHitRenderer.cs +++ b/osu.Game/GameModes/Play/Mania/ManiaHitRenderer.cs @@ -22,13 +22,14 @@ namespace osu.Game.GameModes.Play.Mania protected override Playfield CreatePlayfield() => new ManiaPlayfield(columns); - protected override Drawable GetVisualRepresentation(ManiaBaseHit h) + protected override DrawableHitObject GetVisualRepresentation(ManiaBaseHit h) { - return new DrawableNote(h) - { - Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f), - RelativePositionAxes = Axes.Both - }; + return null; + //return new DrawableNote(h) + //{ + // Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f), + // RelativePositionAxes = Axes.Both + //}; } } } diff --git a/osu.Game/GameModes/Play/Osu/OsuHitRenderer.cs b/osu.Game/GameModes/Play/Osu/OsuHitRenderer.cs index 42607cce38..865f567a86 100644 --- a/osu.Game/GameModes/Play/Osu/OsuHitRenderer.cs +++ b/osu.Game/GameModes/Play/Osu/OsuHitRenderer.cs @@ -14,6 +14,6 @@ namespace osu.Game.GameModes.Play.Osu protected override Playfield CreatePlayfield() => new OsuPlayfield(); - protected override Drawable GetVisualRepresentation(OsuBaseHit h) => new DrawableCircle(h as Circle); + protected override DrawableHitObject GetVisualRepresentation(OsuBaseHit h) => new DrawableCircle(h as Circle); } } diff --git a/osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs b/osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs new file mode 100644 index 0000000000..1622379fe8 --- /dev/null +++ b/osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs @@ -0,0 +1,55 @@ +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using osu.Framework.Graphics; +using osu.Game.Graphics.UserInterface; +using OpenTK; +using OpenTK.Input; +using osu.Game.Beatmaps.Objects; + +namespace osu.Game.GameModes.Play.Osu +{ + class ScoreOverlayOsu : ScoreOverlay + { + protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter() + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Position = new Vector2(0, 45) + }; + + protected override ScoreCounter CreateScoreCounter() => new ScoreCounter() + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + TextSize = 60 + }; + + protected override ComboCounter CreateComboCounter() => new OsuComboCounter() + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + }; + + protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection + { + IsCounting = true, + FadeTime = 50, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Position = new Vector2(10), + Counters = new KeyCounter[] + { + new KeyCounterKeyboard(@"Z", Key.Z), + new KeyCounterKeyboard(@"X", Key.X), + new KeyCounterMouse(@"M1", MouseButton.Left), + new KeyCounterMouse(@"M2", MouseButton.Right), + } + }; + } +} diff --git a/osu.Game/GameModes/Play/Player.cs b/osu.Game/GameModes/Play/Player.cs index 96c2475a24..2b529dd988 100644 --- a/osu.Game/GameModes/Play/Player.cs +++ b/osu.Game/GameModes/Play/Player.cs @@ -1,25 +1,15 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using osu.Framework.Graphics; -using osu.Framework.MathUtils; -using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Objects; -using osu.Game.Beatmaps.Objects.Osu; using osu.Game.GameModes.Backgrounds; using osu.Game.GameModes.Play.Catch; using osu.Game.GameModes.Play.Mania; using osu.Game.GameModes.Play.Osu; using osu.Game.GameModes.Play.Taiko; -using osu.Game.Graphics.UserInterface; -using OpenTK; -using OpenTK.Input; using osu.Framework; namespace osu.Game.GameModes.Play @@ -41,57 +31,61 @@ namespace osu.Game.GameModes.Play HitObjects = Beatmap?.HitObjects ?? new List() }; + HitRenderer hitRenderer; + ScoreOverlay scoreOverlay; + switch (PlayMode) { - case PlayMode.Osu: - Add(new OsuHitRenderer + default: + scoreOverlay = new ScoreOverlayOsu(); + + hitRenderer = new OsuHitRenderer { Objects = beatmap.HitObjects, Anchor = Anchor.Centre, Origin = Anchor.Centre - }); + }; break; case PlayMode.Taiko: - Add(new TaikoHitRenderer + scoreOverlay = null; + + hitRenderer = new TaikoHitRenderer { Objects = beatmap.HitObjects, Anchor = Anchor.Centre, Origin = Anchor.Centre - }); + }; break; case PlayMode.Catch: - Add(new CatchHitRenderer + scoreOverlay = null; + + hitRenderer = new CatchHitRenderer { Objects = beatmap.HitObjects, Anchor = Anchor.Centre, Origin = Anchor.Centre - }); + }; break; case PlayMode.Mania: - Add(new ManiaHitRenderer + scoreOverlay = null; + + hitRenderer = new ManiaHitRenderer { Objects = beatmap.HitObjects, Anchor = Anchor.Centre, Origin = Anchor.Centre - }); + }; break; } - Add(new KeyCounterCollection + hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); }; + hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); }; + + Children = new Drawable[] { - IsCounting = true, - FadeTime = 50, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Position = new Vector2(10, 50), - Counters = new KeyCounter[] - { - new KeyCounterKeyboard(@"Z", Key.Z), - new KeyCounterKeyboard(@"X", Key.X), - new KeyCounterMouse(@"M1", MouseButton.Left), - new KeyCounterMouse(@"M2", MouseButton.Right), - } - }); + hitRenderer, + scoreOverlay, + }; } } } \ No newline at end of file diff --git a/osu.Game/GameModes/Play/ScoreOverlay.cs b/osu.Game/GameModes/Play/ScoreOverlay.cs new file mode 100644 index 0000000000..3d60df1858 --- /dev/null +++ b/osu.Game/GameModes/Play/ScoreOverlay.cs @@ -0,0 +1,53 @@ +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps.Objects; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.GameModes.Play +{ + public abstract class ScoreOverlay : Container + { + public KeyCounterCollection KeyCounter; + public ComboCounter ComboCounter; + public ScoreCounter ScoreCounter; + public PercentageCounter AccuracyCounter; + + protected abstract KeyCounterCollection CreateKeyCounter(); + protected abstract ComboCounter CreateComboCounter(); + protected abstract PercentageCounter CreateAccuracyCounter(); + protected abstract ScoreCounter CreateScoreCounter(); + + 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?.Roll(); + AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f); + } + + public ScoreOverlay() + { + RelativeSizeAxes = Axes.Both; + + Children = new Drawable[] { + KeyCounter = CreateKeyCounter(), + ComboCounter = CreateComboCounter(), + ScoreCounter = CreateScoreCounter(), + AccuracyCounter = CreateAccuracyCounter(), + }; + } + } +} diff --git a/osu.Game/GameModes/Play/Taiko/TaikoHitRenderer.cs b/osu.Game/GameModes/Play/Taiko/TaikoHitRenderer.cs index bee74d5451..837185d4d8 100644 --- a/osu.Game/GameModes/Play/Taiko/TaikoHitRenderer.cs +++ b/osu.Game/GameModes/Play/Taiko/TaikoHitRenderer.cs @@ -14,6 +14,6 @@ namespace osu.Game.GameModes.Play.Taiko protected override Playfield CreatePlayfield() => new TaikoPlayfield(); - protected override Drawable GetVisualRepresentation(TaikoBaseHit h) => new DrawableTaikoHit(h); + protected override DrawableHitObject GetVisualRepresentation(TaikoBaseHit h) => null;// new DrawableTaikoHit(h); } } diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index d405a756c6..b12126deb6 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -45,6 +45,11 @@ namespace osu.Game.Graphics.UserInterface return Math.Abs(currentValue - newValue) * RollingDuration * 100.0f; } + public override void Increment(float amount) + { + Count = Count + amount; + } + protected class TransformAccuracy : TransformFloat { public override void Apply(Drawable d) diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 8c887ba9ae..543f775f72 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -86,7 +86,14 @@ namespace osu.Game.Graphics.UserInterface } } - protected float textSize = 20.0f; + public void Set(T value) + { + Count = value; + } + + public abstract void Increment(T amount); + + protected float textSize; public float TextSize { @@ -107,6 +114,8 @@ namespace osu.Game.Graphics.UserInterface { DisplayedCountSpriteText = new SpriteText(), }; + + TextSize = 40; } public override void Load(BaseGame game) diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 28e6b36fd1..eb857a3207 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -49,6 +49,11 @@ namespace osu.Game.Graphics.UserInterface return count.ToString("D" + LeadingZeroes); } + public override void Increment(ulong amount) + { + Count = Count + amount; + } + protected class TransformScore : Transform { public override ulong CurrentValue diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 8dd257fb3d..a2107a3a4b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -63,6 +63,7 @@ + @@ -111,6 +112,7 @@ + @@ -125,6 +127,7 @@ + @@ -209,4 +212,4 @@ --> - + \ No newline at end of file