From 2c23703ca6f85f7c792c9dca1392d3cf015212d1 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 26 May 2017 13:46:44 +0300 Subject: [PATCH] Removed amplitude container --- .../Graphics/UserInterface/TwoLayerButton.cs | 40 ++++--------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 4aeaf6965d..209d9fb468 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface { public class TwoLayerButton : ClickableContainer { - private readonly IconBeatSyncedContainer iconBeatSyncedContainer; + private readonly BouncingIcon bouncingIcon; public Box IconLayer; public Box TextLayer; @@ -98,7 +98,7 @@ namespace osu.Game.Graphics.UserInterface }, } }, - iconBeatSyncedContainer = new IconBeatSyncedContainer + bouncingIcon = new BouncingIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -148,7 +148,7 @@ namespace osu.Game.Graphics.UserInterface { set { - iconBeatSyncedContainer.Icon = value; + bouncingIcon.Icon = value; } } @@ -200,48 +200,34 @@ namespace osu.Game.Graphics.UserInterface return base.OnClick(state); } - private class IconBeatSyncedContainer : BeatSyncedContainer + private class BouncingIcon : BeatSyncedContainer { private const double beat_in_time = 60; private readonly TextAwesome icon; - private readonly Container amplitudeContainer; public FontAwesome Icon { set { icon.Icon = value; } } - public IconBeatSyncedContainer() + public BouncingIcon() { EarlyActivationMilliseconds = beat_in_time; AutoSizeAxes = Axes.Both; Children = new Drawable[] { - amplitudeContainer = new Container + icon = new TextAwesome { - AutoSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Children = new Drawable[] - { - icon = new TextAwesome - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - TextSize = 25 - } - } - }, + TextSize = 25 + } }; } - private int lastBeatIndex; - protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); - lastBeatIndex = beatIndex; - var beatLength = timingPoint.BeatLength; float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum); @@ -252,16 +238,6 @@ namespace osu.Game.Graphics.UserInterface using (icon.BeginDelayedSequence(beat_in_time)) icon.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); } - - protected override void Update() - { - base.Update(); - - const float scale_adjust_cutoff = 0.4f; - - var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; - amplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.1f, 75, EasingTypes.OutQuint); - } } } } \ No newline at end of file