From 6063219b72db39da7ca158817daeb13553304bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 16 Jul 2017 13:59:26 +0300 Subject: [PATCH] Update framework --- osu-framework | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 12 +------ .../Objects/Drawables/DrawableOsuHitObject.cs | 1 + .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game/Graphics/IHasAccentColour.cs | 5 ++- .../Graphics/Transforms/TransformAccent.cs | 34 ------------------ .../Graphics/UserInterface/RollingCounter.cs | 35 ++----------------- osu.Game/Overlays/DragBar.cs | 12 +------ osu.Game/Screens/Play/HUD/ComboCounter.cs | 18 +++------- .../Tournament/ScrollingTeamContainer.cs | 13 ++----- osu.Game/osu.Game.csproj | 1 - 11 files changed, 15 insertions(+), 120 deletions(-) delete mode 100644 osu.Game/Graphics/Transforms/TransformAccent.cs diff --git a/osu-framework b/osu-framework index cb2c9dd8b6..1b65081418 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit cb2c9dd8b6213cd8f91cc37892da6335ca3bce10 +Subproject commit 1b650814183065be20f10d7df7dce2045cad754e diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 133e1ba861..0d79bb7109 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -234,7 +234,7 @@ namespace osu.Game.Rulesets.Mania.UI private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, EasingTypes easing = EasingTypes.None) { - this.TransformTo(newTimeRange, duration, easing, new TransformTimeSpan(this)); + this.TransformTo(nameof(visibleTimeRange), newTimeRange, duration, easing); } protected override void Update() @@ -243,15 +243,5 @@ namespace osu.Game.Rulesets.Mania.UI // While masking on effectively only the Y-axis, so we need to set the width of the bar line container manually barLineContainer.Width = columns.Width; } - - private class TransformTimeSpan : TransformDouble - { - public TransformTimeSpan(ManiaPlayfield target) : base(target) - { - } - - public override void Apply(ManiaPlayfield d) => d.visibleTimeRange.Value = CurrentValue; - public override void ReadIntoStartValue(ManiaPlayfield d) => StartValue = d.visibleTimeRange.Value; - } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index e09b6bd997..ced50bd0e6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected sealed override void UpdateState(ArmedState state) { Flush(); + DelayReset(); using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true)) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index a30b03fa63..26f503340f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -127,7 +127,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces if (Complete && updateCompleteTick()) { - background.Flush(flushType: typeof(TransformAlpha)); + background.Flush(false, nameof(Alpha)); background.FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo); background.Delay(60); background.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint); diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index 46f9ec4235..0edd2c3ac4 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -4,7 +4,6 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics.Transforms; namespace osu.Game.Graphics { @@ -27,8 +26,8 @@ namespace osu.Game.Graphics /// The new accent colour. /// The tween duration. /// The tween easing. - public static TransformContinuation FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) + public static TransformSequence FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) where T : IHasAccentColour - => accentedDrawable.TransformTo(newColour, duration, easing, new TransformAccent(accentedDrawable)); + => accentedDrawable.TransformTo(nameof(accentedDrawable.AccentColour), newColour, duration, easing); } } diff --git a/osu.Game/Graphics/Transforms/TransformAccent.cs b/osu.Game/Graphics/Transforms/TransformAccent.cs deleted file mode 100644 index e609649fd0..0000000000 --- a/osu.Game/Graphics/Transforms/TransformAccent.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; - -namespace osu.Game.Graphics.Transforms -{ - public class TransformAccent : Transform - { - public TransformAccent(IHasAccentColour target) : base(target) - { - } - - /// - /// Current value of the transformed colour in linear colour space. - /// - public virtual Color4 CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(IHasAccentColour d) => d.AccentColour = CurrentValue; - public override void ReadIntoStartValue(IHasAccentColour d) => StartValue = d.AccentColour; - } -} diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 47346ce440..bc7b49ab6a 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -127,7 +127,7 @@ namespace osu.Game.Graphics.UserInterface /// public virtual void StopRolling() { - Flush(false, typeof(TransformRollingCounter)); + Flush(false, nameof(DisplayedCount)); DisplayedCount = Current; } @@ -173,44 +173,13 @@ namespace osu.Game.Graphics.UserInterface /// Expected count value after modification- /// protected virtual void TransformCount(T currentValue, T newValue) - { - TransformCount(new TransformRollingCounter(this), currentValue, newValue); - } - - /// - /// Intended to be used by TransformCount(T currentValue, T newValue). - /// - protected void TransformCount(TransformRollingCounter transform, T currentValue, T newValue) { double rollingTotalDuration = IsRollingProportional ? GetProportionalDuration(currentValue, newValue) : RollingDuration; - this.TransformTo(newValue, rollingTotalDuration, RollingEasing, transform); - } - - protected class TransformRollingCounter : Transform> - { - public TransformRollingCounter(RollingCounter target) : base(target) - { - } - - public T CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - double result = Interpolation.ValueAt(time, Convert.ToDouble(StartValue), Convert.ToDouble(EndValue), StartTime, EndTime, Easing); - return (T)Convert.ChangeType(result, typeof(T), null); - } - } - - public override void Apply(RollingCounter d) => d.DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(RollingCounter d) => StartValue = d.DisplayedCount; + this.TransformTo(nameof(DisplayedCount), newValue, rollingTotalDuration, RollingEasing); } } } diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 2ae017c592..28aa331ec1 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -75,7 +75,7 @@ namespace osu.Game.Overlays private void updatePosition(float position, bool easing = true) { position = MathHelper.Clamp(position, 0, 1); - Fill.TransformTo(position, easing ? 200 : 0, EasingTypes.OutQuint, new TransformSeek(this)); + Fill.ResizeWidthTo(position, easing ? 200 : 0, EasingTypes.OutQuint); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -97,15 +97,5 @@ namespace osu.Game.Overlays IsSeeking = false; return true; } - - private class TransformSeek : TransformFloat - { - public TransformSeek(Drawable target) : base(target) - { - } - - public override void Apply(Drawable d) => d.Width = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = d.Width; - } } } diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index a7c91bd90a..1bfc7599f7 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -129,7 +129,7 @@ namespace osu.Game.Screens.Play.HUD protected virtual void OnCountRolling(int currentValue, int newValue) { - transformRoll(new TransformComboRoll(this), currentValue, newValue); + transformRoll(currentValue, newValue); } protected virtual void OnCountIncrement(int currentValue, int newValue) @@ -169,7 +169,7 @@ namespace osu.Game.Screens.Play.HUD if (!rolling) { - Flush(false, typeof(TransformComboRoll)); + Flush(false, nameof(DisplayedCount)); IsRolling = false; DisplayedCount = prev; @@ -185,19 +185,9 @@ namespace osu.Game.Screens.Play.HUD } } - private void transformRoll(TransformComboRoll transform, int currentValue, int newValue) + private void transformRoll(int currentValue, int newValue) { - this.TransformTo(newValue, getProportionalDuration(currentValue, newValue), RollingEasing, new TransformComboRoll(this)); - } - - protected class TransformComboRoll : TransformInt - { - public TransformComboRoll(ComboCounter target) : base(target) - { - } - - public override void Apply(ComboCounter d) => d.DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(ComboCounter d) => StartValue = d.DisplayedCount; + this.TransformTo(nameof(DisplayedCount), newValue, getProportionalDuration(currentValue, newValue), RollingEasing); } protected abstract void OnDisplayedCountRolling(int currentValue, int newValue); diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 171b404cd9..65ea195da6 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -297,7 +297,8 @@ namespace osu.Game.Screens.Tournament } } - private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => this.TransformTo(value, duration, easing, new TransformScrollSpeed(this)); + private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => + this.TransformTo(nameof(speed), value, duration, easing); private enum ScrollState { @@ -308,16 +309,6 @@ namespace osu.Game.Screens.Tournament Scrolling } - public class TransformScrollSpeed : TransformFloat - { - public TransformScrollSpeed(ScrollingTeamContainer target) : base(target) - { - } - - public override void Apply(ScrollingTeamContainer d) => d.speed = CurrentValue; - public override void ReadIntoStartValue(ScrollingTeamContainer d) => StartValue = d.speed; - } - public class ScrollingTeam : Container { public const float WIDTH = 58; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 4f8d77367a..7011fa9006 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -119,7 +119,6 @@ -