From a876ab9b90f87780a71ccc7ff48d77ea9b5530c4 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sat, 7 Oct 2017 15:31:42 +0800 Subject: [PATCH] Move spm counter to a seperated control. --- .../Objects/Drawables/DrawableSpinner.cs | 24 +++-------- .../Drawables/Pieces/SpinnerSpmCounter.cs | 42 +++++++++++++++++++ .../osu.Game.Rulesets.Osu.csproj | 1 + 3 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 6a8976ea98..97c2594f69 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly SpinnerDisc disc; private readonly SpinnerTicks ticks; + private readonly SpinnerSpmCounter spmCounter; private readonly Container mainContainer; @@ -31,7 +32,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly Container circleContainer; private readonly CirclePiece circle; private readonly GlowPiece glow; - private readonly OsuSpriteText spmText, spmLabel; private bool spmShown; @@ -108,26 +108,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }, } }, - spmText = new OsuSpriteText + spmCounter = new SpinnerSpmCounter { Anchor = Anchor.Centre, - Origin = Anchor.BottomCentre, - Text = @"0", - Font = @"Venera", - TextSize = 24, + Origin = Anchor.Centre, Y = 120, Alpha = 0 - }, - spmLabel = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.TopCentre, - Text = @"SPINS PER MINUTE", - Font = @"Venera", - TextSize = 12, - Y = 125, - Alpha = 0 - }, + } }; } @@ -185,8 +172,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (!spmShown && disc.Tracking) { spmShown = true; - spmText.FadeIn(TIME_FADEIN); - spmLabel.FadeIn(TIME_FADEIN); + spmCounter.FadeIn(TIME_FADEIN); } base.Update(); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs new file mode 100644 index 0000000000..17b2a813a5 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs @@ -0,0 +1,42 @@ +// Copyright (c) 2007-2017 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.Graphics.Sprites; + +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces +{ + public class SpinnerSpmCounter : Container + { + private readonly OsuSpriteText spmText; + public SpinnerSpmCounter() + { + Children = new Drawable[] + { + spmText = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = @"0", + Font = @"Venera", + TextSize = 24 + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = @"SPINS PER MINUTE", + Font = @"Venera", + TextSize = 12, + Y = 30 + } + }; + } + } +} diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index 300000754c..6bad45b8ca 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -68,6 +68,7 @@ +