From c73a1ae058fa03bd5c5708b738fc0052936343fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 14 Jul 2017 16:46:00 +0300 Subject: [PATCH 001/132] Use TransformTo in rolling counters --- .../Graphics/UserInterface/RollingCounter.cs | 18 ++---------------- osu.Game/Screens/Play/HUD/ComboCounter.cs | 15 +-------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index db6e6ff44f..2afa4da058 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -15,6 +15,7 @@ using OpenTK.Graphics; namespace osu.Game.Graphics.UserInterface { public abstract class RollingCounter : Container, IHasAccentColour + where T : struct, IEquatable { /// /// The current value. @@ -193,27 +194,12 @@ namespace osu.Game.Graphics.UserInterface /// protected void TransformCount(Transform transform, T currentValue, T newValue) { - Type type = transform.GetType(); - - Flush(false, type); - - if (RollingDuration < 1) - { - DisplayedCount = Current; - return; - } - double rollingTotalDuration = IsRollingProportional ? GetProportionalDuration(currentValue, newValue) : RollingDuration; - transform.StartTime = TransformStartTime; - transform.EndTime = TransformStartTime + rollingTotalDuration; - transform.EndValue = newValue; - transform.Easing = RollingEasing; - - Transforms.Add(transform); + TransformTo(newValue, rollingTotalDuration, RollingEasing, transform); } } } diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index f527eaacaf..4a9ea0fa59 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -188,20 +188,7 @@ namespace osu.Game.Screens.Play.HUD private void transformRoll(TransformComboRoll transform, int currentValue, int newValue) { - Flush(false, typeof(TransformComboRoll)); - - if (RollingDuration < 1) - { - DisplayedCount = Current; - return; - } - - transform.StartTime = Time.Current; - transform.EndTime = Time.Current + getProportionalDuration(currentValue, newValue); - transform.EndValue = newValue; - transform.Easing = RollingEasing; - - Transforms.Add(transform); + TransformTo(newValue, getProportionalDuration(currentValue, newValue), RollingEasing, new TransformComboRoll()); } protected class TransformComboRoll : Transform From fd58c6e835557c14d4f5033a2192e95609a157b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 14 Jul 2017 19:14:07 +0300 Subject: [PATCH 002/132] Nicer generic rolling counters --- .../UserInterface/PercentageCounter.cs | 20 -------- .../Graphics/UserInterface/RollingCounter.cs | 48 ++++++++++++------- .../Graphics/UserInterface/ScoreCounter.cs | 20 -------- .../UserInterface/SimpleComboCounter.cs | 20 -------- .../Screens/Play/HUD/ComboResultCounter.cs | 28 ++--------- 5 files changed, 34 insertions(+), 102 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index b51dd2287b..4065978de8 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -13,8 +13,6 @@ namespace osu.Game.Graphics.UserInterface /// public class PercentageCounter : RollingCounter { - protected override Type TransformType => typeof(TransformAccuracy); - protected override double RollingDuration => 750; private float epsilon => 1e-10f; @@ -44,23 +42,5 @@ namespace osu.Game.Graphics.UserInterface { Current.Value = Current + amount; } - - protected class TransformAccuracy : Transform - { - public virtual double CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return Interpolation.ValueAt(time, (float)StartValue, (float)EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((PercentageCounter)d).DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((PercentageCounter)d).DisplayedCount; - } } } diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 2afa4da058..ac4e877ae1 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using OpenTK.Graphics; +using osu.Framework.MathUtils; namespace osu.Game.Graphics.UserInterface { @@ -22,14 +23,6 @@ namespace osu.Game.Graphics.UserInterface /// public Bindable Current = new Bindable(); - /// - /// Type of the Transform to use. - /// - /// - /// Must be a subclass of Transform(T) - /// - protected virtual Type TransformType => typeof(Transform); - protected SpriteText DisplayedCountSpriteText; /// @@ -59,7 +52,8 @@ namespace osu.Game.Graphics.UserInterface { return displayedCount; } - protected set + + set { if (EqualityComparer.Default.Equals(displayedCount, value)) return; @@ -134,7 +128,7 @@ namespace osu.Game.Graphics.UserInterface /// public virtual void StopRolling() { - Flush(false, TransformType); + Flush(false, typeof(TransformRollingCounter)); DisplayedCount = Current; } @@ -181,25 +175,43 @@ namespace osu.Game.Graphics.UserInterface /// protected virtual void TransformCount(T currentValue, T newValue) { - Debug.Assert( - typeof(Transform).IsAssignableFrom(TransformType), - @"transformType should be a subclass of Transform." - ); - - TransformCount((Transform)Activator.CreateInstance(TransformType), currentValue, newValue); + TransformCount(new TransformRollingCounter(this), currentValue, newValue); } /// /// Intended to be used by TransformCount(T currentValue, T newValue). /// - protected void TransformCount(Transform transform, T currentValue, T newValue) + protected void TransformCount(TransformRollingCounter transform, T currentValue, T newValue) { double rollingTotalDuration = IsRollingProportional ? GetProportionalDuration(currentValue, newValue) : RollingDuration; - TransformTo(newValue, rollingTotalDuration, RollingEasing, transform); + 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; } } } diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 6fe43e1fcc..604185d930 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -10,8 +10,6 @@ namespace osu.Game.Graphics.UserInterface { public class ScoreCounter : RollingCounter { - protected override Type TransformType => typeof(TransformScore); - protected override double RollingDuration => 1000; protected override EasingTypes RollingEasing => EasingTypes.Out; @@ -55,23 +53,5 @@ namespace osu.Game.Graphics.UserInterface { Current.Value = Current + amount; } - - protected class TransformScore : Transform - { - public virtual double CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return Interpolation.ValueAt(time, (float)StartValue, (float)EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((ScoreCounter)d).DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((ScoreCounter)d).DisplayedCount; - } } } diff --git a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs index 7664eeee40..16ba8c6d76 100644 --- a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs +++ b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs @@ -13,8 +13,6 @@ namespace osu.Game.Graphics.UserInterface /// public class SimpleComboCounter : RollingCounter { - protected override Type TransformType => typeof(TransformCounterCount); - protected override double RollingDuration => 750; public SimpleComboCounter() @@ -36,23 +34,5 @@ namespace osu.Game.Graphics.UserInterface { Current.Value = Current + amount; } - - private class TransformCounterCount : Transform - { - public int CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return (int)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((SimpleComboCounter)d).DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((SimpleComboCounter)d).DisplayedCount; - } } } \ No newline at end of file diff --git a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs index c280702390..e658658306 100644 --- a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs @@ -12,44 +12,24 @@ namespace osu.Game.Screens.Play.HUD /// /// Used to display combo with a roll-up animation in results screen. /// - public class ComboResultCounter : RollingCounter + public class ComboResultCounter : RollingCounter { - protected override Type TransformType => typeof(TransformComboResult); - protected override double RollingDuration => 500; protected override EasingTypes RollingEasing => EasingTypes.Out; - protected override double GetProportionalDuration(ulong currentValue, ulong newValue) + protected override double GetProportionalDuration(long currentValue, long newValue) { return currentValue > newValue ? currentValue - newValue : newValue - currentValue; } - protected override string FormatCount(ulong count) + protected override string FormatCount(long count) { return $@"{count}x"; } - public override void Increment(ulong amount) + public override void Increment(long amount) { Current.Value = Current + amount; } - - protected class TransformComboResult : Transform - { - public virtual ulong CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return (ulong)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((ComboResultCounter)d).DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((ComboResultCounter)d).DisplayedCount; - } } } From a5e610a7baf8a9b7f91d8092b2fd5c54bfa59c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 14 Jul 2017 19:18:12 +0300 Subject: [PATCH 003/132] Update framework and fix compilation Most issues were related to BeginLoopedSequence usage and lack of "this." in front of transform helpers. --- osu-framework | 2 +- .../Tests/TestCaseBeatSyncedContainer.cs | 1 + .../Tests/TestCaseContextMenu.cs | 30 ++++++++----------- .../Tests/TestCaseKeyCounter.cs | 1 + .../Tests/TestCaseScrollingHitObjects.cs | 3 +- .../Tests/TestCaseTaikoPlayfield.cs | 1 + osu.Desktop/Overlays/VersionManager.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 19 ++++-------- .../Objects/Drawables/DrawableHitCircle.cs | 8 ++--- .../Objects/Drawables/DrawableOsuHitObject.cs | 3 +- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/DrawableSliderTick.cs | 18 +++++------ .../Objects/Drawables/DrawableSpinner.cs | 6 ++-- .../Objects/Drawables/Pieces/SliderBouncer.cs | 3 +- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- .../Objects/Drawables/DrawableBarLine.cs | 4 +-- .../Objects/Drawables/DrawableHit.cs | 10 +++---- .../Objects/Drawables/DrawableSwell.cs | 2 +- .../UI/DrawableTaikoJudgement.cs | 3 +- osu.Game.Rulesets.Taiko/UI/HitExplosion.cs | 6 ++-- .../UI/KiaiHitExplosion.cs | 4 +-- osu.Game/Beatmaps/Drawables/Panel.cs | 4 +-- .../Graphics/Cursor/OsuTooltipContainer.cs | 6 ++-- osu.Game/Graphics/IHasAccentColour.cs | 8 ++--- .../Graphics/Transforms/TransformAccent.cs | 11 ++++--- .../UserInterface/BreadcrumbControl.cs | 8 ++--- .../UserInterface/LoadingAnimation.cs | 7 ++--- osu.Game/Graphics/UserInterface/Nub.cs | 6 ++-- .../Graphics/UserInterface/OsuContextMenu.cs | 6 ++-- osu.Game/Graphics/UserInterface/OsuMenu.cs | 6 ++-- .../UserInterface/PercentageCounter.cs | 3 -- .../Graphics/UserInterface/RollingCounter.cs | 1 - .../Graphics/UserInterface/ScoreCounter.cs | 3 -- .../UserInterface/SimpleComboCounter.cs | 3 -- .../Graphics/UserInterface/TwoLayerButton.cs | 4 +-- .../UserInterface/Volume/VolumeControl.cs | 4 +-- osu.Game/Overlays/Chat/ChannelListItem.cs | 6 ++-- osu.Game/Overlays/Chat/ChannelSection.cs | 2 +- .../Overlays/Chat/ChannelSelectionOverlay.cs | 10 +++---- osu.Game/Overlays/Chat/ChatTabControl.cs | 4 +-- osu.Game/Overlays/ChatOverlay.cs | 8 ++--- osu.Game/Overlays/DialogOverlay.cs | 4 +-- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectListPanel.cs | 2 +- osu.Game/Overlays/DragBar.cs | 6 +++- osu.Game/Overlays/LoginOverlay.cs | 4 +-- osu.Game/Overlays/MedalOverlay.cs | 15 ++++------ .../Overlays/MedalSplash/DrawableMedal.cs | 8 ++--- osu.Game/Overlays/Music/PlaylistItem.cs | 2 +- osu.Game/Overlays/Music/PlaylistOverlay.cs | 8 ++--- osu.Game/Overlays/MusicController.cs | 4 +-- osu.Game/Overlays/NotificationManager.cs | 8 ++--- .../Overlays/Notifications/Notification.cs | 17 +++++------ .../Notifications/ProgressNotification.cs | 4 +-- osu.Game/Overlays/Settings/SettingsItem.cs | 2 +- osu.Game/Overlays/Settings/SettingsSection.cs | 2 +- .../Overlays/Settings/SettingsSubsection.cs | 2 +- osu.Game/Overlays/Settings/Sidebar.cs | 4 +-- osu.Game/Overlays/SettingsOverlay.cs | 4 +-- osu.Game/Overlays/Toolbar/Toolbar.cs | 8 ++--- .../Overlays/Toolbar/ToolbarModeSelector.cs | 2 +- osu.Game/Overlays/WaveOverlayContainer.cs | 12 ++++---- .../Rulesets/Judgements/DrawableJudgement.cs | 18 +++++------ osu.Game/Screens/Edit/Editor.cs | 1 + osu.Game/Screens/Menu/Button.cs | 8 ++--- osu.Game/Screens/Multiplayer/Match.cs | 1 + osu.Game/Screens/Play/HUD/ComboCounter.cs | 21 ++++--------- .../Screens/Play/HUD/ComboResultCounter.cs | 3 -- .../Screens/Play/HUD/StandardComboCounter.cs | 1 + osu.Game/Screens/Play/KeyCounterCollection.cs | 2 +- osu.Game/Screens/Play/MenuOverlay.cs | 4 +-- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Play/SkipButton.cs | 8 ++--- osu.Game/Screens/Play/SongProgress.cs | 6 ++-- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 10 +++---- .../Select/Leaderboards/LeaderboardScore.cs | 2 +- .../Select/Options/BeatmapOptionsOverlay.cs | 4 +-- .../Tournament/ScrollingTeamContainer.cs | 12 +++++--- osu.Game/Users/UserPanel.cs | 4 +-- 79 files changed, 220 insertions(+), 247 deletions(-) diff --git a/osu-framework b/osu-framework index 991177da4f..cb2c9dd8b6 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 991177da4fbed2dd8260c215f2d341ebc858b03e +Subproject commit cb2c9dd8b6213cd8f91cc37892da6335ca3bce10 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 909ee9b134..8b682d14ce 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -15,6 +15,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Lists; using System; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics.Transforms; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index f9dc424153..cfb618e5d1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; @@ -59,20 +60,13 @@ namespace osu.Desktop.VisualTests.Tests { base.LoadComplete(); - using (container.BeginLoopedSequence()) - { - container.MoveTo(new Vector2(0, 100), duration); - using (container.BeginDelayedSequence(duration)) - { - container.MoveTo(new Vector2(100, 100), duration); - using (container.BeginDelayedSequence(duration)) - { - container.MoveTo(new Vector2(100, 0), duration); - using (container.BeginDelayedSequence(duration)) - container.MoveTo(Vector2.Zero, duration); - } - } - } + // Move box along a square trajectory + container.Loop(b => b + .MoveTo(new Vector2(0, 100), duration) + .Then().MoveTo(new Vector2(100, 100), duration) + .Then().MoveTo(new Vector2(100, 0), duration) + .Then().MoveTo(Vector2.Zero, duration) + ); } private class MyContextMenuContainer : Container, IHasContextMenu @@ -95,10 +89,10 @@ namespace osu.Desktop.VisualTests.Tests { new OsuContextMenuItem(@"Simple option"), new OsuContextMenuItem(@"Simple very very long option"), - new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted) { Action = () => ResizeWidthTo(Width * 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted) { Action = () => ResizeHeightTo(Height * 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive) { Action = () => ResizeWidthTo(Width / 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive) { Action = () => ResizeHeightTo(Height / 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted) { Action = () => this.ResizeWidthTo(Width * 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted) { Action = () => this.ResizeHeightTo(Height * 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive) { Action = () => this.ResizeWidthTo(Width / 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive) { Action = () => this.ResizeHeightTo(Height / 2, 100, EasingTypes.OutQuint) }, }; } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 87a40a76ca..7a4584d4f8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -13,6 +13,7 @@ using osu.Framework.MathUtils; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Play; +using osu.Framework.Graphics.Transforms; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index 8e5cf8687c..33b7399343 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; using osu.Game.Graphics.Sprites; @@ -196,7 +197,7 @@ namespace osu.Desktop.VisualTests.Tests protected override void LoadComplete() { base.LoadComplete(); - FadeInFromZero(250, EasingTypes.OutQuint); + this.FadeInFromZero(250, EasingTypes.OutQuint); } protected override void Update() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 00929c06c2..4fd27220bc 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -4,6 +4,7 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Framework.Timing; diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index a8ab97ce37..5b79ecfaf1 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -175,7 +175,7 @@ namespace osu.Desktop.Overlays protected override void PopIn() { - FadeIn(1000); + this.FadeIn(1000); } protected override void PopOut() diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 3feb448752..133e1ba861 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Input; using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Timing; using osu.Framework.Configuration; @@ -235,7 +234,7 @@ namespace osu.Game.Rulesets.Mania.UI private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, EasingTypes easing = EasingTypes.None) { - TransformTo(newTimeRange, duration, easing, new TransformTimeSpan()); + this.TransformTo(newTimeRange, duration, easing, new TransformTimeSpan(this)); } protected override void Update() @@ -245,22 +244,14 @@ namespace osu.Game.Rulesets.Mania.UI barLineContainer.Width = columns.Width; } - private class TransformTimeSpan : Transform + private class TransformTimeSpan : TransformDouble { - public double CurrentValue + public TransformTimeSpan(ManiaPlayfield target) : base(target) { - 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(Drawable d) => ((ManiaPlayfield)d).visibleTimeRange.Value = (float)CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((ManiaPlayfield)d).visibleTimeRange.Value; + 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/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 75b2dc0a32..947af733ec 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -119,12 +119,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { case ArmedState.Idle: using (BeginDelayedSequence(duration + TIME_PREEMPT)) - FadeOut(TIME_FADEOUT); + this.FadeOut(TIME_FADEOUT); Expire(true); break; case ArmedState.Miss: ApproachCircle.FadeOut(50); - FadeOut(TIME_FADEOUT / 5); + this.FadeOut(TIME_FADEOUT / 5); Expire(); break; case ArmedState.Hit: @@ -145,8 +145,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables circle.FadeOut(); number.FadeOut(); - FadeOut(800); - ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad); + this.FadeOut(800); + this.ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad); } Expire(); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 2711ec1a62..e09b6bd997 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Judgements; +using osu.Framework.Graphics; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -44,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected virtual void UpdatePreemptState() { - FadeIn(TIME_FADEIN); + this.FadeIn(TIME_FADEIN); } protected virtual void UpdateCurrentState(ArmedState state) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index c6c009e8f2..c3c7d8862f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -163,7 +163,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables body.FadeOut(160); ball.FadeOut(160); - FadeOut(800); + this.FadeOut(800); Expire(); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 28fbf46a92..6ced16930b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -62,12 +62,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { var animIn = Math.Min(150, sliderTick.StartTime - FadeInTime); - ScaleTo(0.5f); - ScaleTo(1.2f, animIn); - FadeIn(animIn); + this.ScaleTo(0.5f); + this.ScaleTo(1.2f, animIn); + this.FadeIn(animIn); Delay(animIn); - ScaleTo(1, 150, EasingTypes.Out); + this.ScaleTo(1, 150, EasingTypes.Out); Delay(-animIn); } @@ -78,15 +78,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { case ArmedState.Idle: Delay(FadeOutTime - sliderTick.StartTime); - FadeOut(); + this.FadeOut(); break; case ArmedState.Miss: - FadeOut(160); - FadeColour(Color4.Red, 80); + this.FadeOut(160); + this.FadeColour(Color4.Red, 80); break; case ArmedState.Hit: - FadeOut(120, EasingTypes.OutQuint); - ScaleTo(Scale * 1.5f, 120, EasingTypes.OutQuint); + this.FadeOut(120, EasingTypes.OutQuint); + this.ScaleTo(Scale * 1.5f, 120, EasingTypes.OutQuint); break; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 840acb8221..0ac790c520 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -200,16 +200,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Delay(spinner.Duration, true); - FadeOut(160); + this.FadeOut(160); switch (state) { case ArmedState.Hit: - ScaleTo(Scale * 1.2f, 320, EasingTypes.Out); + this.ScaleTo(Scale * 1.2f, 320, EasingTypes.Out); Expire(); break; case ArmedState.Miss: - ScaleTo(Scale * 0.8f, 320, EasingTypes.In); + this.ScaleTo(Scale * 0.8f, 320, EasingTypes.In); Expire(); break; } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs index a34ff30a43..a15812054f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs @@ -37,8 +37,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces protected override void LoadComplete() { base.LoadComplete(); - using (icon.BeginLoopedSequence()) - icon.RotateTo(360, 1000); + icon.Spin(1000); } public void UpdateProgress(double progress, int repeat) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index f3ddf683d2..a30b03fa63 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -133,7 +133,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces background.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint); } - RotateTo(currentRotation / 2, validAndTracking ? 500 : 1500, EasingTypes.OutExpo); + this.RotateTo(currentRotation / 2, validAndTracking ? 500 : 1500, EasingTypes.OutExpo); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index 5d627f2b50..841964b743 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -65,10 +65,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { base.LoadComplete(); Delay(BarLine.StartTime - Time.Current); - FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000); + this.FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000); } - private void updateScrollPosition(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.ScrollTime)); + private void updateScrollPosition(double time) => this.MoveToX((float)((BarLine.StartTime - time) / BarLine.ScrollTime)); protected override void Update() { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index a4a46e3b48..53518a28de 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -77,10 +77,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables Delay(HitObject.HitWindowMiss); break; case ArmedState.Miss: - FadeOut(100); + this.FadeOut(100); break; case ArmedState.Hit: - FadeOut(600); + this.FadeOut(600); var flash = circlePiece?.FlashBox; if (flash != null) @@ -90,16 +90,16 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } - FadeOut(800); + this.FadeOut(800); const float gravity_time = 300; const float gravity_travel_height = 200; Content.ScaleTo(0.8f, gravity_time * 2, EasingTypes.OutQuad); - MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out); + this.MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out); Delay(gravity_time, true); - MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In); + this.MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In); break; } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 1c72f2a7dd..43f6bc930c 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -198,7 +198,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables break; } - FadeOut(out_transition_time, EasingTypes.Out); + this.FadeOut(out_transition_time, EasingTypes.Out); Expire(); } diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs index 08fd8dbecc..779471b8dc 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs @@ -6,6 +6,7 @@ using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; +using osu.Framework.Graphics; namespace osu.Game.Rulesets.Taiko.UI { @@ -47,7 +48,7 @@ namespace osu.Game.Rulesets.Taiko.UI switch (Judgement.Result) { case HitResult.Hit: - MoveToY(-100, 500); + this.MoveToY(-100, 500); break; } diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs index 4d39ba0ead..8766f7b9f5 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs @@ -62,8 +62,8 @@ namespace osu.Game.Rulesets.Taiko.UI { base.LoadComplete(); - ScaleTo(3f, 1000, EasingTypes.OutQuint); - FadeOut(500); + this.ScaleTo(3f, 1000, EasingTypes.OutQuint); + this.FadeOut(500); Expire(); } @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// public void VisualiseSecondHit() { - ResizeTo(new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER), 50); + this.ResizeTo(new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER), 50); } } } diff --git a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs index b4aec7057b..346f435e5d 100644 --- a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs @@ -59,8 +59,8 @@ namespace osu.Game.Rulesets.Taiko.UI { base.LoadComplete(); - ScaleTo(new Vector2(1, 3f), 500, EasingTypes.OutQuint); - FadeOut(250); + this.ScaleTo(new Vector2(1, 3f), 500, EasingTypes.OutQuint); + this.FadeOut(250); Expire(); } diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index 3dac50732c..10eeba53e0 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -64,9 +64,9 @@ namespace osu.Game.Beatmaps.Drawables } if (state == PanelSelectedState.Hidden) - FadeOut(300, EasingTypes.OutQuint); + this.FadeOut(300, EasingTypes.OutQuint); else - FadeIn(250); + this.FadeIn(250); } private PanelSelectedState state = PanelSelectedState.NotSelected; diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index 7608a366dc..5ce836bbe5 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -83,13 +83,13 @@ namespace osu.Game.Graphics.Cursor protected override void PopIn() { instantMovement |= !IsPresent; - FadeIn(500, EasingTypes.OutQuint); + this.FadeIn(500, EasingTypes.OutQuint); } protected override void PopOut() { using (BeginDelayedSequence(150)) - FadeOut(500, EasingTypes.OutQuint); + this.FadeOut(500, EasingTypes.OutQuint); } public override void Move(Vector2 pos) @@ -101,7 +101,7 @@ namespace osu.Game.Graphics.Cursor } else { - MoveTo(pos, 200, EasingTypes.OutQuint); + this.MoveTo(pos, 200, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index 9eb66d8fac..46f9ec4235 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -27,10 +27,8 @@ namespace osu.Game.Graphics /// The new accent colour. /// The tween duration. /// The tween easing. - public static void FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) - where T : Transformable, IHasAccentColour - { - accentedDrawable.TransformTo(newColour, duration, easing, new TransformAccent()); - } + public static TransformContinuation FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) + where T : IHasAccentColour + => accentedDrawable.TransformTo(newColour, duration, easing, new TransformAccent(accentedDrawable)); } } diff --git a/osu.Game/Graphics/Transforms/TransformAccent.cs b/osu.Game/Graphics/Transforms/TransformAccent.cs index 53a452ad8a..e609649fd0 100644 --- a/osu.Game/Graphics/Transforms/TransformAccent.cs +++ b/osu.Game/Graphics/Transforms/TransformAccent.cs @@ -2,14 +2,17 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; -using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; namespace osu.Game.Graphics.Transforms { - public class TransformAccent : Transform + public class TransformAccent : Transform { + public TransformAccent(IHasAccentColour target) : base(target) + { + } + /// /// Current value of the transformed colour in linear colour space. /// @@ -25,7 +28,7 @@ namespace osu.Game.Graphics.Transforms } } - public override void Apply(Drawable d) => ((IHasAccentColour)d).AccentColour = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((IHasAccentColour)d).AccentColour; + 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/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 155b08fde8..e69f9e3f42 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -54,13 +54,13 @@ namespace osu.Game.Graphics.UserInterface if (State == Visibility.Visible) { - FadeIn(transition_duration, EasingTypes.OutQuint); - ScaleTo(new Vector2(1f), transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, EasingTypes.OutQuint); + this.ScaleTo(new Vector2(1f), transition_duration, EasingTypes.OutQuint); } else { - FadeOut(transition_duration, EasingTypes.OutQuint); - ScaleTo(new Vector2(0.8f, 1f), transition_duration, EasingTypes.OutQuint); + this.FadeOut(transition_duration, EasingTypes.OutQuint); + this.ScaleTo(new Vector2(0.8f, 1f), transition_duration, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs index eed5061abd..5e293eff03 100644 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs @@ -34,14 +34,13 @@ namespace osu.Game.Graphics.UserInterface { base.LoadComplete(); - using (spinner.BeginLoopedSequence()) - spinner.RotateTo(360, 2000); + spinner.Spin(2000); } private const float transition_duration = 500; - protected override void PopIn() => FadeIn(transition_duration * 5, EasingTypes.OutQuint); + protected override void PopIn() => this.FadeIn(transition_duration * 5, EasingTypes.OutQuint); - protected override void PopOut() => FadeOut(transition_duration, EasingTypes.OutQuint); + protected override void PopOut() => this.FadeOut(transition_duration, EasingTypes.OutQuint); } } diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index d5059945c6..298badcb77 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -80,13 +80,13 @@ namespace osu.Game.Graphics.UserInterface if (value) { - FadeColour(GlowingAccentColour, 500, EasingTypes.OutQuint); + this.FadeColour(GlowingAccentColour, 500, EasingTypes.OutQuint); FadeEdgeEffectTo(1, 500, EasingTypes.OutQuint); } else { FadeEdgeEffectTo(0, 500); - FadeColour(AccentColour, 500); + this.FadeColour(AccentColour, 500); } } } @@ -95,7 +95,7 @@ namespace osu.Game.Graphics.UserInterface { set { - ResizeTo(new Vector2(value ? EXPANDED_SIZE : COLLAPSED_SIZE, 12), 500, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(value ? EXPANDED_SIZE : COLLAPSED_SIZE, 12), 500, EasingTypes.OutQuint); } } diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs index e17ce2a5b2..66c214f6a3 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs @@ -39,13 +39,13 @@ namespace osu.Game.Graphics.UserInterface Background.Colour = colours.ContextMenuGray; } - protected override void AnimateOpen() => FadeIn(fade_duration, EasingTypes.OutQuint); - protected override void AnimateClose() => FadeOut(fade_duration, EasingTypes.OutQuint); + protected override void AnimateOpen() => this.FadeIn(fade_duration, EasingTypes.OutQuint); + protected override void AnimateClose() => this.FadeOut(fade_duration, EasingTypes.OutQuint); protected override void UpdateContentHeight() { var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight; - ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 84b88da96e..2bcf0a467c 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -19,14 +19,14 @@ namespace osu.Game.Graphics.UserInterface ItemsContainer.Padding = new MarginPadding(5); } - protected override void AnimateOpen() => FadeIn(300, EasingTypes.OutQuint); + protected override void AnimateOpen() => this.FadeIn(300, EasingTypes.OutQuint); - protected override void AnimateClose() => FadeOut(300, EasingTypes.OutQuint); + protected override void AnimateClose() => this.FadeOut(300, EasingTypes.OutQuint); protected override void UpdateContentHeight() { var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight; - ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 4065978de8..0a402f9045 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -1,9 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; using System; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index ac4e877ae1..47346ce440 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Transforms; using osu.Game.Graphics.Sprites; using System; using System.Collections.Generic; -using System.Diagnostics; using OpenTK.Graphics; using osu.Framework.MathUtils; diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 604185d930..a1fa48e3cd 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -2,9 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; -using System; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs index 16ba8c6d76..211de72efc 100644 --- a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs +++ b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs @@ -2,9 +2,6 @@ // 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; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 7f2bbb8f9f..5713f5fe27 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(InputState state) { - ResizeTo(SIZE_EXTENDED, transform_time, EasingTypes.OutElastic); + this.ResizeTo(SIZE_EXTENDED, transform_time, EasingTypes.OutElastic); IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic); bouncingIcon.ScaleTo(1.1f, transform_time, EasingTypes.OutElastic); @@ -183,7 +183,7 @@ namespace osu.Game.Graphics.UserInterface protected override void OnHoverLost(InputState state) { - ResizeTo(SIZE_RETRACTED, transform_time, EasingTypes.OutElastic); + this.ResizeTo(SIZE_RETRACTED, transform_time, EasingTypes.OutElastic); IconLayer.FadeColour(TextLayer.Colour, transform_time, EasingTypes.OutElastic); bouncingIcon.ScaleTo(1, transform_time, EasingTypes.OutElastic); diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index a758d5fdef..fd2a7742f8 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -93,14 +93,14 @@ namespace osu.Game.Graphics.UserInterface.Volume protected override void PopIn() { ClearTransforms(); - FadeIn(100); + this.FadeIn(100); schedulePopOut(); } protected override void PopOut() { - FadeOut(100); + this.FadeOut(100); } private void schedulePopOut() diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index aca65bbc17..7b11ba2de0 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Chat { set { - FadeTo(value ? 1f : 0f, 100); + this.FadeTo(value ? 1f : 0f, 100); } } @@ -175,14 +175,14 @@ namespace osu.Game.Overlays.Chat joinedCheckmark.FadeTo(1f, transition_duration); topic.FadeTo(0.8f, transition_duration); topic.FadeColour(Color4.White, transition_duration); - FadeColour(joinedColour, transition_duration); + this.FadeColour(joinedColour, transition_duration); } else { joinedCheckmark.FadeTo(0f, transition_duration); topic.FadeTo(1f, transition_duration); topic.FadeColour(topicColour, transition_duration); - FadeColour(Color4.White, transition_duration); + this.FadeColour(Color4.White, transition_duration); } } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index cafb88b6ac..1f046aff2a 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Chat { set { - FadeTo(value ? 1f : 0f, 100); + this.FadeTo(value ? 1f : 0f, 100); } } diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 135f8f43b9..380275475b 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -158,10 +158,10 @@ namespace osu.Game.Overlays.Chat protected override void PopIn() { - if (Alpha == 0) MoveToY(DrawHeight); + if (Alpha == 0) this.MoveToY(DrawHeight); - FadeIn(transition_duration, EasingTypes.OutQuint); - MoveToY(0, transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, EasingTypes.OutQuint); + this.MoveToY(0, transition_duration, EasingTypes.OutQuint); search.HoldFocus = true; base.PopIn(); @@ -169,8 +169,8 @@ namespace osu.Game.Overlays.Chat protected override void PopOut() { - FadeOut(transition_duration, EasingTypes.InSine); - MoveToY(DrawHeight, transition_duration, EasingTypes.InSine); + this.FadeOut(transition_duration, EasingTypes.InSine); + this.MoveToY(DrawHeight, transition_duration, EasingTypes.InSine); search.HoldFocus = false; base.PopOut(); diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 92147db57f..cb85bdb0c9 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Chat private void fadeActive() { - ResizeTo(new Vector2(Width, 1.1f), transition_length, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(Width, 1.1f), transition_length, EasingTypes.OutQuint); box.FadeColour(backgroundActive, transition_length, EasingTypes.OutQuint); highlightBox.FadeIn(transition_length, EasingTypes.OutQuint); @@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Chat private void fadeInactive() { - ResizeTo(new Vector2(Width, 1), transition_length, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(Width, 1), transition_length, EasingTypes.OutQuint); box.FadeColour(backgroundInactive, transition_length, EasingTypes.OutQuint); highlightBox.FadeOut(transition_length, EasingTypes.OutQuint); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 700889ed26..a6bd8a47e6 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -235,8 +235,8 @@ namespace osu.Game.Overlays protected override void PopIn() { - MoveToY(0, transition_length, EasingTypes.OutQuint); - FadeIn(transition_length, EasingTypes.OutQuint); + this.MoveToY(0, transition_length, EasingTypes.OutQuint); + this.FadeIn(transition_length, EasingTypes.OutQuint); inputTextBox.HoldFocus = true; base.PopIn(); @@ -244,8 +244,8 @@ namespace osu.Game.Overlays protected override void PopOut() { - MoveToY(Height, transition_length, EasingTypes.InSine); - FadeOut(transition_length, EasingTypes.InSine); + this.MoveToY(Height, transition_length, EasingTypes.InSine); + this.FadeOut(transition_length, EasingTypes.InSine); inputTextBox.HoldFocus = false; base.PopOut(); diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index f1a6bc1681..71015bf810 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -45,13 +45,13 @@ namespace osu.Game.Overlays protected override void PopIn() { base.PopIn(); - FadeIn(PopupDialog.ENTER_DURATION, EasingTypes.OutQuint); + this.FadeIn(PopupDialog.ENTER_DURATION, EasingTypes.OutQuint); } protected override void PopOut() { base.PopOut(); - FadeOut(PopupDialog.EXIT_DURATION, EasingTypes.InSine); + this.FadeOut(PopupDialog.EXIT_DURATION, EasingTypes.InSine); } public DialogOverlay() diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 3c464af05d..cc7d57e04b 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Direct { base.LoadComplete(); - FadeInFromZero(200, EasingTypes.Out); + this.FadeInFromZero(200, EasingTypes.Out); bottomPanel.LayoutDuration = 200; bottomPanel.LayoutEasing = EasingTypes.Out; bottomPanel.Origin = Anchor.BottomLeft; diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index f693998563..1b36798639 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Direct { base.LoadComplete(); - FadeInFromZero(200, EasingTypes.Out); + this.FadeInFromZero(200, EasingTypes.Out); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 89bb81c70b..2ae017c592 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()); + Fill.TransformTo(position, easing ? 200 : 0, EasingTypes.OutQuint, new TransformSeek(this)); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -100,6 +100,10 @@ namespace osu.Game.Overlays 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/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index 790530342f..3a3bb362d2 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -66,7 +66,7 @@ namespace osu.Game.Overlays base.PopIn(); settingsSection.Bounding = true; - FadeIn(transition_time, EasingTypes.OutQuint); + this.FadeIn(transition_time, EasingTypes.OutQuint); InputManager.ChangeFocus(settingsSection); } @@ -76,7 +76,7 @@ namespace osu.Game.Overlays base.PopOut(); settingsSection.Bounding = false; - FadeOut(transition_time); + this.FadeOut(transition_time); } } } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 5f85474ede..fce4604d9d 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -194,16 +194,13 @@ namespace osu.Game.Overlays { base.PopIn(); - FadeIn(200); + this.FadeIn(200); background.FlashColour(Color4.White.Opacity(0.25f), 400); getSample.Play(); - using (innerSpin.BeginLoopedSequence()) - innerSpin.RotateTo(360, 20000); - - using (outerSpin.BeginLoopedSequence()) - outerSpin.RotateTo(360, 40000); + innerSpin.Spin(20000); + outerSpin.Spin(40000); using (BeginDelayedSequence(200, true)) { @@ -233,7 +230,7 @@ namespace osu.Game.Overlays protected override void PopOut() { base.PopOut(); - FadeOut(200); + this.FadeOut(200); } private void dismiss() @@ -295,8 +292,8 @@ namespace osu.Game.Overlays Radius = 5, }; - MoveTo(positionForOffset(DISC_SIZE / 2 + 200), 500); - FadeOut(500); + this.MoveTo(positionForOffset(DISC_SIZE / 2 + 200), 500); + this.FadeOut(500); Expire(); } } diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 7d7ffbd12a..bba58e1a26 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -154,16 +154,16 @@ namespace osu.Game.Overlays.MedalSplash medalContainer.ScaleTo(1); medalContainer.Show(); - ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); - MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo); + this.ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); + this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo); unlocked.FadeInFromZero(duration); break; case DisplayState.Full: medalContainer.ScaleTo(1); medalContainer.Show(); - ScaleTo(scale_when_full, duration, EasingTypes.OutExpo); - MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo); + this.ScaleTo(scale_when_full, duration, EasingTypes.OutExpo); + this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo); name.FadeInFromZero(duration + 100); description.FadeInFromZero(duration * 2); break; diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 69cb9c3464..de459cd0f8 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -144,7 +144,7 @@ namespace osu.Game.Overlays.Music matching = value; - FadeTo(matching ? 1 : 0, 200); + this.FadeTo(matching ? 1 : 0, 200); } } } diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index e5dc66fc75..ee5c50eb1a 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -105,16 +105,16 @@ namespace osu.Game.Overlays.Music filter.Search.HoldFocus = true; Schedule(() => inputManager.ChangeFocus(filter.Search)); - ResizeTo(new Vector2(1, playlist_height), transition_duration, EasingTypes.OutQuint); - FadeIn(transition_duration, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(1, playlist_height), transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, EasingTypes.OutQuint); } protected override void PopOut() { filter.Search.HoldFocus = false; - ResizeTo(new Vector2(1, 0), transition_duration, EasingTypes.OutQuint); - FadeOut(transition_duration); + this.ResizeTo(new Vector2(1, 0), transition_duration, EasingTypes.OutQuint); + this.FadeOut(transition_duration); } private void itemSelected(BeatmapSetInfo set) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index baf58ae26c..d30c66e03d 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -370,7 +370,7 @@ namespace osu.Game.Overlays { base.PopIn(); - FadeIn(transition_length, EasingTypes.OutQuint); + this.FadeIn(transition_length, EasingTypes.OutQuint); dragContainer.ScaleTo(1, transition_length, EasingTypes.OutElastic); } @@ -378,7 +378,7 @@ namespace osu.Game.Overlays { base.PopOut(); - FadeOut(transition_length, EasingTypes.OutQuint); + this.FadeOut(transition_length, EasingTypes.OutQuint); dragContainer.ScaleTo(0.9f, transition_length, EasingTypes.OutQuint); } diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index 18cb49f335..f83aeb1275 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -90,8 +90,8 @@ namespace osu.Game.Overlays base.PopIn(); scrollContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); - MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); - FadeTo(1, TRANSITION_LENGTH / 2); + this.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); + this.FadeTo(1, TRANSITION_LENGTH / 2); } private void markAllRead() @@ -105,8 +105,8 @@ namespace osu.Game.Overlays markAllRead(); - MoveToX(width, TRANSITION_LENGTH, EasingTypes.OutQuint); - FadeTo(0, TRANSITION_LENGTH / 2); + this.MoveToX(width, TRANSITION_LENGTH, EasingTypes.OutQuint); + this.FadeTo(0, TRANSITION_LENGTH / 2); } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index f5613d6656..4337989a13 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -135,7 +135,7 @@ namespace osu.Game.Overlays.Notifications protected override void LoadComplete() { base.LoadComplete(); - FadeInFromZero(200); + this.FadeInFromZero(200); NotificationContent.MoveToX(DrawSize.X); NotificationContent.MoveToX(0, 500, EasingTypes.OutQuint); } @@ -148,7 +148,7 @@ namespace osu.Game.Overlays.Notifications wasClosed = true; Closed?.Invoke(); - FadeOut(100); + this.FadeOut(100); Expire(); } @@ -181,13 +181,13 @@ namespace osu.Game.Overlays.Notifications protected override bool OnHover(InputState state) { - FadeColour(hoverColour, 200); + this.FadeColour(hoverColour, 200); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - FadeColour(OsuColour.Gray(0.2f), 200); + this.FadeColour(OsuColour.Gray(0.2f), 200); base.OnHoverLost(state); } } @@ -212,12 +212,9 @@ namespace osu.Game.Overlays.Notifications if (pulsate) { const float length = 1000; - using (pulsateLayer.BeginLoopedSequence(length / 2)) - { - pulsateLayer.FadeTo(0.4f, length, EasingTypes.In); - using (pulsateLayer.BeginDelayedSequence(length)) - pulsateLayer.FadeTo(1, length, EasingTypes.Out); - } + pulsateLayer.Loop(length / 2, + p => p.FadeTo(0.4f, length, EasingTypes.In).Then().FadeTo(1, length, EasingTypes.Out) + ); } } } diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index f0fa7e6da1..18ad148702 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Notifications { case ProgressNotificationState.Completed: NotificationContent.MoveToY(-DrawSize.Y / 2, 200, EasingTypes.OutQuint); - FadeTo(0.01f, 200); //don't completely fade out or our scheduled task won't run. + this.FadeTo(0.01f, 200); //don't completely fade out or our scheduled task won't run. Delay(100); Schedule(Completed); @@ -196,7 +196,7 @@ namespace osu.Game.Overlays.Notifications set { active = value; - FadeColour(active ? colourActive : colourInactive, 100); + this.FadeColour(active ? colourActive : colourInactive, 100); } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index f80fef4a99..c74f4070e7 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Settings set { // probably needs a better transition. - FadeTo(value ? 1 : 0); + this.FadeTo(value ? 1 : 0); } } diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 77bf87f718..68ebde6b28 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Settings { set { - FadeTo(value ? 1 : 0); + this.FadeTo(value ? 1 : 0); } } diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 0a9f7ba5d0..ac6d2fa239 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings { set { - FadeTo(value ? 1 : 0); + this.FadeTo(value ? 1 : 0); } } diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index 44d296a079..f5ab3b301b 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -94,10 +94,10 @@ namespace osu.Game.Overlays.Settings switch (state) { default: - ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, EasingTypes.OutQuint); break; case ExpandedState.Expanded: - ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, EasingTypes.OutQuint); break; } } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 66b15234c3..d7d45371ff 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -127,7 +127,7 @@ namespace osu.Game.Overlays sectionsContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); sidebar.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); - FadeTo(1, TRANSITION_LENGTH / 2); + this.FadeTo(1, TRANSITION_LENGTH / 2); searchTextBox.HoldFocus = true; } @@ -138,7 +138,7 @@ namespace osu.Game.Overlays sectionsContainer.MoveToX(-width, TRANSITION_LENGTH, EasingTypes.OutQuint); sidebar.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, EasingTypes.OutQuint); - FadeTo(0, TRANSITION_LENGTH / 2); + this.FadeTo(0, TRANSITION_LENGTH / 2); searchTextBox.HoldFocus = false; if (searchTextBox.HasFocus) diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index a7e5f8dcc4..9070bc45ad 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -121,16 +121,16 @@ namespace osu.Game.Overlays.Toolbar protected override void PopIn() { - MoveToY(0, transition_time, EasingTypes.OutQuint); - FadeIn(transition_time / 2, EasingTypes.OutQuint); + this.MoveToY(0, transition_time, EasingTypes.OutQuint); + this.FadeIn(transition_time / 2, EasingTypes.OutQuint); } protected override void PopOut() { userArea?.LoginOverlay.Hide(); - MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint); - FadeOut(transition_time); + this.MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint); + this.FadeOut(transition_time); } } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 95906464ec..3ecf0fd83c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Toolbar public override bool HandleInput => !ruleset.Disabled; - private void disabledChanged(bool isDisabled) => FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); + private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); protected override void Update() { diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 1bb7813d90..ce587c9ed2 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -137,23 +137,23 @@ namespace osu.Game.Overlays foreach (var w in wavesContainer.Children) w.State = Visibility.Visible; - FadeIn(100, EasingTypes.OutQuint); + this.FadeIn(100, EasingTypes.OutQuint); contentContainer.MoveToY(0, APPEAR_DURATION, EasingTypes.OutQuint); - FadeIn(100, EasingTypes.OutQuint); + this.FadeIn(100, EasingTypes.OutQuint); } protected override void PopOut() { base.PopOut(); - FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); + this.FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, EasingTypes.In); foreach (var w in wavesContainer.Children) w.State = Visibility.Hidden; - FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); + this.FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); } protected override void UpdateAfterChildren() @@ -210,10 +210,10 @@ namespace osu.Game.Overlays switch (value) { case Visibility.Hidden: - MoveToY(Parent.Parent.DrawSize.Y, DISAPPEAR_DURATION, easing_hide); + this.MoveToY(Parent.Parent.DrawSize.Y, DISAPPEAR_DURATION, easing_hide); break; case Visibility.Visible: - MoveToY(FinalPosition, APPEAR_DURATION, easing_show); + this.MoveToY(FinalPosition, APPEAR_DURATION, easing_show); break; } } diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 3a82827497..ad21650f36 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -64,26 +64,26 @@ namespace osu.Game.Rulesets.Judgements { base.LoadComplete(); - FadeInFromZero(100, EasingTypes.OutQuint); + this.FadeInFromZero(100, EasingTypes.OutQuint); switch (Judgement.Result) { case HitResult.Miss: - ScaleTo(1.6f); - ScaleTo(1, 100, EasingTypes.In); + this.ScaleTo(1.6f); + this.ScaleTo(1, 100, EasingTypes.In); - MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); - RotateTo(40, 800, EasingTypes.InQuint); + this.MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); + this.RotateTo(40, 800, EasingTypes.InQuint); Delay(600); - FadeOut(200); + this.FadeOut(200); break; case HitResult.Hit: - ScaleTo(0.9f); - ScaleTo(1, 500, EasingTypes.OutElastic); + this.ScaleTo(0.9f); + this.ScaleTo(1, 500, EasingTypes.OutElastic); Delay(100); - FadeOut(400); + this.FadeOut(400); break; } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 2582c68296..8580d043fe 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -7,6 +7,7 @@ using OpenTK.Graphics; using osu.Framework.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Select; +using osu.Framework.Graphics; namespace osu.Game.Screens.Edit { diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 8dad83bd0e..aa866574cc 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -248,23 +248,23 @@ namespace osu.Game.Screens.Menu { default: box.ScaleTo(new Vector2(0, 1), 500, EasingTypes.OutExpo); - FadeOut(500); + this.FadeOut(500); break; case 1: box.ScaleTo(new Vector2(0, 1), 400, EasingTypes.InSine); - FadeOut(800); + this.FadeOut(800); break; } break; case ButtonState.Expanded: const int expand_duration = 500; box.ScaleTo(new Vector2(1, 1), expand_duration, EasingTypes.OutExpo); - FadeIn(expand_duration / 6f); + this.FadeIn(expand_duration / 6f); break; case ButtonState.Exploded: const int explode_duration = 200; box.ScaleTo(new Vector2(2, 1), explode_duration, EasingTypes.OutExpo); - FadeOut(explode_duration / 4f * 3); + this.FadeOut(explode_duration / 4f * 3); break; } } diff --git a/osu.Game/Screens/Multiplayer/Match.cs b/osu.Game/Screens/Multiplayer/Match.cs index ec6a66062d..a0843bfcae 100644 --- a/osu.Game/Screens/Multiplayer/Match.cs +++ b/osu.Game/Screens/Multiplayer/Match.cs @@ -8,6 +8,7 @@ using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; using OpenTK.Graphics; using osu.Game.Screens.Select; +using osu.Framework.Graphics; namespace osu.Game.Screens.Multiplayer { diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index 4a9ea0fa59..a7c91bd90a 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Play.HUD @@ -130,7 +129,7 @@ namespace osu.Game.Screens.Play.HUD protected virtual void OnCountRolling(int currentValue, int newValue) { - transformRoll(new TransformComboRoll(), currentValue, newValue); + transformRoll(new TransformComboRoll(this), currentValue, newValue); } protected virtual void OnCountIncrement(int currentValue, int newValue) @@ -188,25 +187,17 @@ namespace osu.Game.Screens.Play.HUD private void transformRoll(TransformComboRoll transform, int currentValue, int newValue) { - TransformTo(newValue, getProportionalDuration(currentValue, newValue), RollingEasing, new TransformComboRoll()); + this.TransformTo(newValue, getProportionalDuration(currentValue, newValue), RollingEasing, new TransformComboRoll(this)); } - protected class TransformComboRoll : Transform + protected class TransformComboRoll : TransformInt { - public virtual int CurrentValue + public TransformComboRoll(ComboCounter target) : base(target) { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return (int)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); - } } - public override void Apply(Drawable d) => ((ComboCounter)d).DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((ComboCounter)d).DisplayedCount; + public override void Apply(ComboCounter d) => d.DisplayedCount = CurrentValue; + public override void ReadIntoStartValue(ComboCounter d) => StartValue = d.DisplayedCount; } protected abstract void OnDisplayedCountRolling(int currentValue, int newValue); diff --git a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs index e658658306..1686b6174d 100644 --- a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs @@ -1,10 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // 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; namespace osu.Game.Screens.Play.HUD diff --git a/osu.Game/Screens/Play/HUD/StandardComboCounter.cs b/osu.Game/Screens/Play/HUD/StandardComboCounter.cs index 525e52d207..04fe78116e 100644 --- a/osu.Game/Screens/Play/HUD/StandardComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/StandardComboCounter.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using osu.Framework.Graphics; namespace osu.Game.Screens.Play.HUD { diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index b4b2691390..01e20fdbd7 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Play private void load(OsuConfigManager config) { showKeyCounter = config.GetBindable(OsuSetting.KeyOverlay); - showKeyCounter.ValueChanged += keyCounterVisibility => FadeTo(keyCounterVisibility ? 1 : 0, duration); + showKeyCounter.ValueChanged += keyCounterVisibility => this.FadeTo(keyCounterVisibility ? 1 : 0, duration); showKeyCounter.TriggerChange(); } diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index aedbffbab9..ee08bcc031 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -76,8 +76,8 @@ namespace osu.Game.Screens.Play public override bool HandleInput => State == Visibility.Visible; - protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In); - protected override void PopOut() => FadeOut(transition_duration, EasingTypes.In); + protected override void PopIn() => this.FadeIn(transition_duration, EasingTypes.In); + protected override void PopOut() => this.FadeOut(transition_duration, EasingTypes.In); // Don't let mouse down events through the overlay or people can click circles while paused. protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index f2ed378e7c..35502c2d4a 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -143,7 +143,7 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(Screen next) { Content.ScaleTo(0.7f, 150, EasingTypes.InQuint); - FadeOut(150); + this.FadeOut(150); return base.OnExiting(next); } diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index b0e3de0ea4..6637680c15 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -100,9 +100,9 @@ namespace osu.Game.Screens.Play return; } - FadeInFromZero(fade_time); + this.FadeInFromZero(fade_time); using (BeginAbsoluteSequence(beginFadeTime)) - FadeOut(fade_time); + this.FadeOut(fade_time); button.Action = () => AudioClock?.Seek(startTime - skip_required_cutoff - fade_time); @@ -154,14 +154,14 @@ namespace osu.Game.Screens.Play { case Visibility.Visible: if (lastState == Visibility.Hidden) - FadeIn(500, EasingTypes.OutExpo); + this.FadeIn(500, EasingTypes.OutExpo); if (!IsHovered) using (BeginDelayedSequence(1000)) scheduledHide = Schedule(() => State = Visibility.Hidden); break; case Visibility.Hidden: - FadeOut(1000, EasingTypes.OutExpo); + this.FadeOut(1000, EasingTypes.OutExpo); break; } } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index e5b18292ab..88c30f8c1a 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -123,18 +123,18 @@ namespace osu.Game.Screens.Play private void updateBarVisibility() { bar.FadeTo(allowSeeking ? 1 : 0, transition_duration, EasingTypes.In); - MoveTo(new Vector2(0, allowSeeking ? 0 : bottom_bar_height), transition_duration, EasingTypes.In); + this.MoveTo(new Vector2(0, allowSeeking ? 0 : bottom_bar_height), transition_duration, EasingTypes.In); } protected override void PopIn() { updateBarVisibility(); - FadeIn(500, EasingTypes.OutQuint); + this.FadeIn(500, EasingTypes.OutQuint); } protected override void PopOut() { - FadeOut(100); + this.FadeOut(100); } protected override void Update() diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 42f9598096..72f4a215d0 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -51,14 +51,14 @@ namespace osu.Game.Screens.Select protected override void PopIn() { - MoveToX(0, 800, EasingTypes.OutQuint); - RotateTo(0, 800, EasingTypes.OutQuint); + this.MoveToX(0, 800, EasingTypes.OutQuint); + this.RotateTo(0, 800, EasingTypes.OutQuint); } protected override void PopOut() { - MoveToX(-100, 800, EasingTypes.InQuint); - RotateTo(10, 800, EasingTypes.InQuint); + this.MoveToX(-100, 800, EasingTypes.InQuint); + this.RotateTo(10, 800, EasingTypes.InQuint); } public void UpdateBeatmap(WorkingBeatmap beatmap) @@ -84,7 +84,7 @@ namespace osu.Game.Screens.Select Shear = -Shear, OnLoadComplete = d => { - FadeIn(250); + this.FadeIn(250); lastContainer?.FadeOut(250); lastContainer?.Expire(); diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 48de4c2d3a..7a211e406c 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select.Leaderboards nameLabel.MoveToX(150); break; case Visibility.Visible: - FadeIn(200); + this.FadeIn(200); content.MoveToY(0, 800, EasingTypes.OutQuint); Delay(100, true); diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index 6345807ea3..4b9a85f7f8 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select.Options { base.PopIn(); - FadeIn(transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, EasingTypes.OutQuint); if (buttonsContainer.Position.X == 1 || Alpha == 0) buttonsContainer.MoveToX(x_position - x_movement); @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select.Options buttonsContainer.MoveToX(x_position + x_movement, transition_duration, EasingTypes.InSine); buttonsContainer.TransformSpacingTo(new Vector2(200f, 0f), transition_duration, EasingTypes.InSine); - FadeOut(transition_duration, EasingTypes.InQuint); + this.FadeOut(transition_duration, EasingTypes.InQuint); } public BeatmapOptionsOverlay() diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 30f109e598..171b404cd9 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -297,7 +297,7 @@ namespace osu.Game.Screens.Tournament } } - private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => TransformTo(value, duration, easing, new TransformScrollSpeed()); + private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => this.TransformTo(value, duration, easing, new TransformScrollSpeed(this)); private enum ScrollState { @@ -308,10 +308,14 @@ namespace osu.Game.Screens.Tournament Scrolling } - public class TransformScrollSpeed : TransformFloat + public class TransformScrollSpeed : TransformFloat { - public override void Apply(Drawable d) => ((ScrollingTeamContainer)d).speed = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((ScrollingTeamContainer)d).speed; + 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 diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 881aaf2e07..46aadb9580 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -183,13 +183,13 @@ namespace osu.Game.Users { statusBar.ResizeHeightTo(0f, transition_duration, EasingTypes.OutQuint); statusBar.FadeOut(transition_duration, EasingTypes.OutQuint); - ResizeHeightTo(height - status_height, transition_duration, EasingTypes.OutQuint); + this.ResizeHeightTo(height - status_height, transition_duration, EasingTypes.OutQuint); } else { statusBar.ResizeHeightTo(status_height, transition_duration, EasingTypes.OutQuint); statusBar.FadeIn(transition_duration, EasingTypes.OutQuint); - ResizeHeightTo(height, transition_duration, EasingTypes.OutQuint); + this.ResizeHeightTo(height, transition_duration, EasingTypes.OutQuint); statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint); statusMessage.Text = status.Message; From 5372b9467432beaa04079db6117123cbb0c29a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 14 Jul 2017 19:35:44 +0300 Subject: [PATCH 004/132] Remove some unnecessary usings --- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 1 - osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs | 1 - osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs | 1 - osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs | 1 - osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 1 - 5 files changed, 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 8b682d14ce..909ee9b134 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -15,7 +15,6 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Lists; using System; using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics.Transforms; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index cfb618e5d1..112a11d400 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 7a4584d4f8..87a40a76ca 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -13,7 +13,6 @@ using osu.Framework.MathUtils; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Play; -using osu.Framework.Graphics.Transforms; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index 33b7399343..eed2fa95c1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; using osu.Game.Graphics.Sprites; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 4fd27220bc..00929c06c2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -4,7 +4,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Framework.Timing; 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 005/132] 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 @@ - From 71105bb9ee8c0b8ac571eee64bc50fa40e911843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 16 Jul 2017 14:06:46 +0300 Subject: [PATCH 006/132] Delay -> ApplyDelay; DelayReset -> ResetDelay --- osu-framework | 2 +- .../Tests/TestCaseNotificationManager.cs | 2 +- .../Tests/TestCaseTaikoPlayfield.cs | 2 +- .../Drawables/Connections/FollowPointRenderer.cs | 2 +- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/DrawableSliderTick.cs | 6 +++--- .../Objects/Drawables/DrawableSpinner.cs | 4 ++-- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- .../Objects/Drawables/DrawableBarLine.cs | 2 +- .../Objects/Drawables/DrawableHit.cs | 6 +++--- .../Objects/Drawables/DrawableSwell.cs | 6 +++--- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 4 ++-- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- .../Graphics/UserInterface/Volume/VolumeControl.cs | 2 +- osu.Game/OsuGame.cs | 2 +- osu.Game/Overlays/DialogOverlay.cs | 2 +- .../Overlays/Notifications/ProgressNotification.cs | 2 +- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 4 ++-- osu.Game/Screens/Menu/Disclaimer.cs | 6 +++--- osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs | 2 +- osu.Game/Screens/Play/PauseContainer.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 10 +++++----- osu.Game/Screens/Ranking/ResultsPage.cs | 2 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 2 +- osu.Game/Screens/ScreenWhiteBox.cs | 2 +- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 2 +- .../Screens/Select/Leaderboards/LeaderboardScore.cs | 6 +++--- 28 files changed, 45 insertions(+), 45 deletions(-) diff --git a/osu-framework b/osu-framework index 1b65081418..0bdb38e12e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 1b650814183065be20f10d7df7dce2045cad754e +Subproject commit 0bdb38e12e99716e563d27035737ba167d17763d diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 4ba50c8220..4d9a0fe9a2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -57,7 +57,7 @@ namespace osu.Desktop.VisualTests.Tests if (remaining > 0) { - Delay(80); + ApplyDelay(80); Schedule(() => sendBarrage(remaining - 1)); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 00929c06c2..46ad7acb52 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -84,7 +84,7 @@ namespace osu.Desktop.VisualTests.Tests break; case 5: addSwell(1000); - playfieldContainer.Delay(scroll_time - 100); + playfieldContainer.ApplyDelay(scroll_time - 100); break; } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index 925767b851..3a32d9765e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections fp.MoveTo(pointEndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); - fp.Delay(fadeOutTime - fadeInTime); + fp.ApplyDelay(fadeOutTime - fadeInTime); fp.FadeOut(DrawableOsuHitObject.TIME_FADEIN); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index ced50bd0e6..1bc6070c33 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected sealed override void UpdateState(ArmedState state) { Flush(); - DelayReset(); + ResetDelay(true); using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true)) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index c3c7d8862f..63721dee4f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -158,7 +158,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { ball.FadeIn(); - Delay(slider.Duration, true); + ApplyDelay(slider.Duration, true); body.FadeOut(160); ball.FadeOut(160); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 6ced16930b..d0e141db6c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -66,10 +66,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables this.ScaleTo(1.2f, animIn); this.FadeIn(animIn); - Delay(animIn); + ApplyDelay(animIn); this.ScaleTo(1, 150, EasingTypes.Out); - Delay(-animIn); + ApplyDelay(-animIn); } protected override void UpdateCurrentState(ArmedState state) @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables switch (state) { case ArmedState.Idle: - Delay(FadeOutTime - sliderTick.StartTime); + ApplyDelay(FadeOutTime - sliderTick.StartTime); this.FadeOut(); break; case ArmedState.Miss: diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 0ac790c520..0bb2f718d3 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -192,13 +192,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables mainContainer.ScaleTo(0); mainContainer.ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, EasingTypes.OutQuint); - mainContainer.Delay(TIME_PREEMPT - 150); + mainContainer.ApplyDelay(TIME_PREEMPT - 150); mainContainer.ScaleTo(1, 500, EasingTypes.OutQuint); } protected override void UpdateCurrentState(ArmedState state) { - Delay(spinner.Duration, true); + ApplyDelay(spinner.Duration, true); this.FadeOut(160); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 26f503340f..ee2ecfa8b1 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -129,7 +129,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { background.Flush(false, nameof(Alpha)); background.FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo); - background.Delay(60); + background.ApplyDelay(60); background.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index 841964b743..bd713ec8b7 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void LoadComplete() { base.LoadComplete(); - Delay(BarLine.StartTime - Time.Current); + ApplyDelay(BarLine.StartTime - Time.Current); this.FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 53518a28de..31e92e4c70 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void UpdateState(ArmedState state) { - Delay(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true); + ApplyDelay(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true); var circlePiece = MainPiece as CirclePiece; @@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables switch (State) { case ArmedState.Idle: - Delay(HitObject.HitWindowMiss); + ApplyDelay(HitObject.HitWindowMiss); break; case ArmedState.Miss: this.FadeOut(100); @@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables Content.ScaleTo(0.8f, gravity_time * 2, EasingTypes.OutQuad); this.MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out); - Delay(gravity_time, true); + ApplyDelay(gravity_time, true); this.MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In); break; } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 43f6bc930c..90e1d594e9 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -181,13 +181,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { const float preempt = 100; - Delay(HitObject.StartTime - Time.Current - preempt, true); + ApplyDelay(HitObject.StartTime - Time.Current - preempt, true); targetRing.ScaleTo(target_ring_scale, preempt * 4, EasingTypes.OutQuint); - Delay(preempt, true); + ApplyDelay(preempt, true); - Delay(Judgement.TimeOffset + HitObject.Duration, true); + ApplyDelay(Judgement.TimeOffset + HitObject.Duration, true); const float out_transition_time = 300; diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 999d76ab0b..279092424b 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -150,12 +150,12 @@ namespace osu.Game.Rulesets.Taiko.UI const float up_time = 1000; back.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); - back.Delay(down_time); + back.ApplyDelay(down_time); back.ScaleTo(1, up_time, EasingTypes.OutQuint); target.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); target.FadeTo(Math.Min(target.Alpha + alpha_amount, 1), down_time, EasingTypes.OutQuint); - target.Delay(down_time); + target.ApplyDelay(down_time); target.ScaleTo(1, up_time, EasingTypes.OutQuint); target.FadeOut(up_time, EasingTypes.OutQuint); } diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 3f1b81893d..bb85c9681d 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -99,7 +99,7 @@ namespace osu.Game.Graphics.UserInterface colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In); flash(); - Delay(click_duration); + ApplyDelay(click_duration); Schedule(delegate { colourContainer.ResizeTo(new Vector2(0.8f, 1f)); spriteText.Spacing = Vector2.Zero; diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index fd2a7742f8..19af0991f5 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -106,7 +106,7 @@ namespace osu.Game.Graphics.UserInterface.Volume private void schedulePopOut() { popOutDelegate?.Cancel(); - Delay(1000); + ApplyDelay(1000); popOutDelegate = Schedule(Hide); } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 843861c0da..7f9ddb685d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -119,7 +119,7 @@ namespace osu.Game if (!menu.IsCurrentScreen) { menu.MakeCurrent(); - Delay(500); + ApplyDelay(500); scoreLoad = Schedule(() => LoadScore(s)); return; } diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 71015bf810..5580287276 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays if (v != Visibility.Hidden) return; //handle the dialog being dismissed. - dialog.Delay(PopupDialog.EXIT_DURATION); + dialog.ApplyDelay(PopupDialog.EXIT_DURATION); dialog.Expire(); if (dialog == currentDialog) diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 18ad148702..1d76990859 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Notifications NotificationContent.MoveToY(-DrawSize.Y / 2, 200, EasingTypes.OutQuint); this.FadeTo(0.01f, 200); //don't completely fade out or our scheduled task won't run. - Delay(100); + ApplyDelay(100); Schedule(Completed); break; } diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index ad21650f36..d5075ec400 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -75,14 +75,14 @@ namespace osu.Game.Rulesets.Judgements this.MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); this.RotateTo(40, 800, EasingTypes.InQuint); - Delay(600); + ApplyDelay(600); this.FadeOut(200); break; case HitResult.Hit: this.ScaleTo(0.9f); this.ScaleTo(1, 500, EasingTypes.OutElastic); - Delay(100); + ApplyDelay(100); this.FadeOut(400); break; } diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index beaaa373b6..718fe5d8be 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -100,14 +100,14 @@ namespace osu.Game.Screens.Menu Content.FadeInFromZero(500); - icon.Delay(1500); + icon.ApplyDelay(1500); icon.FadeColour(iconColour, 200); - Delay(6000, true); + ApplyDelay(6000, true); Content.FadeOut(250); - Delay(250); + ApplyDelay(250); Schedule(() => Push(intro)); } diff --git a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index cac1f1a71b..a5c4f262f8 100644 --- a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -98,7 +98,7 @@ namespace osu.Game.Screens.Play.HUD return; fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint); - fill.Delay(glow_fade_delay); + fill.ApplyDelay(glow_fade_delay); fill.FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint); } diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index f052bafd63..7a257a4b6d 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Play { OnResume = delegate { - Delay(400); + ApplyDelay(400); Schedule(Resume); }, OnRetry = () => OnRetry(), diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 35502c2d4a..ba92fb095d 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play Beatmap = player.Beatmap, }); - Delay(400); + ApplyDelay(400); Schedule(pushWhenLoaded); } @@ -104,14 +104,14 @@ namespace osu.Game.Screens.Play contentIn(); - Delay(500, true); + ApplyDelay(500, true); logo.MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo); - Delay(250, true); + ApplyDelay(250, true); info.FadeIn(500); - Delay(1400, true); + ApplyDelay(1400, true); Schedule(pushWhenLoaded); } @@ -123,7 +123,7 @@ namespace osu.Game.Screens.Play contentOut(); - Delay(250); + ApplyDelay(250); Schedule(() => { diff --git a/osu.Game/Screens/Ranking/ResultsPage.cs b/osu.Game/Screens/Ranking/ResultsPage.cs index 59173748ed..55e71cfcc4 100644 --- a/osu.Game/Screens/Ranking/ResultsPage.cs +++ b/osu.Game/Screens/Ranking/ResultsPage.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Ranking protected override void LoadComplete() { base.LoadComplete(); - fill.Delay(400); + fill.ApplyDelay(400); fill.FadeInFromZero(600); } diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 96e63585bf..6f96ef500e 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -179,7 +179,7 @@ namespace osu.Game.Screens.Ranking foreach (var s in statisticsContainer.Children) { s.FadeOut(); - s.Delay(delay += 200); + s.ApplyDelay(delay += 200); s.FadeIn(300 + delay, EasingTypes.Out); } }); diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index 21239e8030..e6c25ff6f4 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens boxContainer.ScaleTo(0.2f); boxContainer.RotateTo(-20); - Content.Delay(300, true); + Content.ApplyDelay(300, true); boxContainer.ScaleTo(1, transition_time, EasingTypes.OutElastic); boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 2a8e4ca5fb..dcf39a7880 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Select.Leaderboards }; scrollFlow.Add(ls); - ls.Delay(i++ * 50, true); + ls.ApplyDelay(i++ * 50, true); ls.Show(); } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 7a211e406c..02d6833d3f 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -64,18 +64,18 @@ namespace osu.Game.Screens.Select.Leaderboards this.FadeIn(200); content.MoveToY(0, 800, EasingTypes.OutQuint); - Delay(100, true); + ApplyDelay(100, true); avatar.FadeIn(300, EasingTypes.OutQuint); nameLabel.FadeIn(350, EasingTypes.OutQuint); avatar.MoveToX(0, 300, EasingTypes.OutQuint); nameLabel.MoveToX(0, 350, EasingTypes.OutQuint); - Delay(250, true); + ApplyDelay(250, true); scoreLabel.FadeIn(200); scoreRank.FadeIn(200); - Delay(50, true); + ApplyDelay(50, true); var drawables = new Drawable[] { flagBadgeContainer, maxCombo, accuracy, modsContainer, }; for (int i = 0; i < drawables.Length; i++) From 99221260c4fecdfe042f43b983daaf2d313d8cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 16 Jul 2017 17:37:59 +0300 Subject: [PATCH 007/132] Replace several usages of BeginDelayedSequence with LINQ-style --- osu-framework | 2 +- .../Tests/TestCaseContextMenu.cs | 4 +-- .../Objects/Drawables/DrawableHitCircle.cs | 26 +++++-------------- .../Objects/Drawables/DrawableSwell.cs | 5 ++-- .../Objects/Drawables/Pieces/CirclePiece.cs | 5 ++-- .../Graphics/Cursor/OsuTooltipContainer.cs | 6 +---- .../Graphics/UserInterface/StarCounter.cs | 8 ++---- .../Graphics/UserInterface/TwoLayerButton.cs | 5 ++-- osu.Game/Overlays/MedalOverlay.cs | 24 ++++++++++------- .../Overlays/MedalSplash/DrawableMedal.cs | 9 +++---- osu.Game/Overlays/Mods/ModButton.cs | 7 ++--- osu.Game/Overlays/OnScreenDisplay.cs | 13 ++++------ osu.Game/Screens/Menu/Button.cs | 13 ++++------ osu.Game/Screens/Menu/ButtonSystem.cs | 6 +---- osu.Game/Screens/Menu/MenuSideFlashes.cs | 5 ++-- osu.Game/Screens/Menu/OsuLogo.cs | 25 +++++------------- osu.Game/Screens/Play/HUDOverlay.cs | 5 +--- osu.Game/Screens/Play/Player.cs | 19 +++++--------- osu.Game/Screens/Ranking/Results.cs | 10 +++---- 19 files changed, 70 insertions(+), 127 deletions(-) diff --git a/osu-framework b/osu-framework index 0bdb38e12e..c2a20bd8b3 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 0bdb38e12e99716e563d27035737ba167d17763d +Subproject commit c2a20bd8b31144c6d196ab6ae0e8858acabbe032 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index 112a11d400..d89397e793 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -60,12 +60,12 @@ namespace osu.Desktop.VisualTests.Tests base.LoadComplete(); // Move box along a square trajectory - container.Loop(b => b + container .MoveTo(new Vector2(0, 100), duration) .Then().MoveTo(new Vector2(100, 100), duration) .Then().MoveTo(new Vector2(100, 0), duration) .Then().MoveTo(Vector2.Zero, duration) - ); + .Loop(); } private class MyContextMenuContainer : Container, IHasContextMenu diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 947af733ec..ec047d2aa8 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -112,14 +112,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { double duration = ((HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime) - HitObject.StartTime; - using (glow.BeginDelayedSequence(duration)) - glow.FadeOut(400); + glow.Delay(duration).FadeOut(400); switch (state) { case ArmedState.Idle: - using (BeginDelayedSequence(duration + TIME_PREEMPT)) - this.FadeOut(TIME_FADEOUT); + this.Delay(duration + TIME_PREEMPT).FadeOut(TIME_FADEOUT); Expire(true); break; case ArmedState.Miss: @@ -131,23 +129,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables ApproachCircle.FadeOut(50); const double flash_in = 40; - - flash.FadeTo(0.8f, flash_in); - using (flash.BeginDelayedSequence(flash_in)) - flash.FadeOut(100); - + flash.FadeTo(0.8f, flash_in).Then().FadeOut(100); explode.FadeIn(flash_in); - using (BeginDelayedSequence(flash_in, true)) - { - //after the flash, we can hide some elements that were behind it - ring.FadeOut(); - circle.FadeOut(); - number.FadeOut(); - - this.FadeOut(800); - this.ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad); - } + ring.Delay(flash_in).FadeOut(); + circle.Delay(flash_in).FadeOut(); + number.Delay(flash_in).FadeOut(); + this.Delay(flash_in).FadeOut(800).ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad); Expire(); break; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 90e1d594e9..4cb5f211e4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -147,9 +147,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables var completion = (float)userHits / HitObject.RequiredHits; - expandingRing.FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50); - using (expandingRing.BeginDelayedSequence(50)) - expandingRing.FadeTo(completion / 8, 2000, EasingTypes.OutQuint); + expandingRing.FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50) + .Then().FadeTo(completion / 8, 2000, EasingTypes.OutQuint); symbol.RotateTo((float)(completion * HitObject.Duration / 8), 4000, EasingTypes.OutQuint); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 3f8249f5a9..cd7e70eff3 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -166,9 +166,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces double duration = timingPoint.BeatLength * 2; - background.FadeEdgeEffectTo(1, pre_beat_transition_time, EasingTypes.OutQuint); - using (background.BeginDelayedSequence(pre_beat_transition_time)) - background.FadeEdgeEffectTo(edge_alpha_kiai, duration, EasingTypes.OutQuint); + background.FadeEdgeEffectTo(1, pre_beat_transition_time, EasingTypes.OutQuint) + .Then().FadeEdgeEffectTo(edge_alpha_kiai, duration, EasingTypes.OutQuint); } } } \ No newline at end of file diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index 5ce836bbe5..d3d01a5bc8 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -86,11 +86,7 @@ namespace osu.Game.Graphics.Cursor this.FadeIn(500, EasingTypes.OutQuint); } - protected override void PopOut() - { - using (BeginDelayedSequence(150)) - this.FadeOut(500, EasingTypes.OutQuint); - } + protected override void PopOut() => this.Delay(150).FadeOut(500, EasingTypes.OutQuint); public override void Move(Vector2 pos) { diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index 490ea6e64a..41ecb56db4 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -133,12 +133,8 @@ namespace osu.Game.Graphics.UserInterface star.ClearTransforms(true); var delay = (countStars <= newValue ? Math.Max(i - countStars, 0) : Math.Max(countStars - 1 - i, 0)) * animationDelay; - - using (BeginDelayedSequence(delay, true)) - { - star.FadeTo(i < newValue ? 1.0f : minStarAlpha, fadingDuration); - star.Icon.ScaleTo(getStarScale(i, newValue), scalingDuration, scalingEasing); - } + star.Delay(delay).FadeTo(i < newValue ? 1.0f : minStarAlpha, fadingDuration); + star.Icon.Delay(delay).ScaleTo(getStarScale(i, newValue), scalingDuration, scalingEasing); i++; } diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 5713f5fe27..32903b4eaf 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -245,9 +245,8 @@ namespace osu.Game.Graphics.UserInterface if (beatIndex < 0) return; - icon.ScaleTo(1 - 0.1f * amplitudeAdjust, beat_in_time, EasingTypes.Out); - using (icon.BeginDelayedSequence(beat_in_time)) - icon.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + icon.ScaleTo(1 - 0.1f * amplitudeAdjust, beat_in_time, EasingTypes.Out) + .Then().ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index fce4604d9d..627e485993 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -204,25 +204,31 @@ namespace osu.Game.Overlays using (BeginDelayedSequence(200, true)) { - disc.FadeIn(initial_duration); + disc.FadeIn(initial_duration).ScaleTo(1f, initial_duration * 2, EasingTypes.OutElastic); particleContainer.FadeIn(initial_duration); outerSpin.FadeTo(0.1f, initial_duration * 2); - disc.ScaleTo(1f, initial_duration * 2, EasingTypes.OutElastic); using (BeginDelayedSequence(initial_duration + 200, true)) { backgroundStrip.FadeIn(step_duration); leftStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint); rightStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint); - Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Icon; }); - using (BeginDelayedSequence(step_duration, true)) + this.Animate().Schedule(() => { - Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.MedalUnlocked; }); - - using (BeginDelayedSequence(step_duration, true)) - Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Full; }); - } + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.Icon; + }) + .Delay(step_duration).Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.MedalUnlocked; + }) + .Delay(step_duration).Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.Full; + }); } } } diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index bba58e1a26..166b8e8d41 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -147,20 +147,17 @@ namespace osu.Game.Overlays.MedalSplash medalContainer.ScaleTo(0); break; case DisplayState.Icon: - medalContainer.ScaleTo(1, duration, EasingTypes.OutElastic); - medalContainer.FadeIn(duration); + medalContainer.FadeIn(duration).ScaleTo(1, duration, EasingTypes.OutElastic); break; case DisplayState.MedalUnlocked: - medalContainer.ScaleTo(1); - medalContainer.Show(); + medalContainer.FadeTo(1).ScaleTo(1); this.ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo); unlocked.FadeInFromZero(duration); break; case DisplayState.Full: - medalContainer.ScaleTo(1); - medalContainer.Show(); + medalContainer.FadeTo(1).ScaleTo(1); this.ScaleTo(scale_when_full, duration, EasingTypes.OutExpo); this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo); diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index aca73d2828..45da537a60 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -81,11 +81,8 @@ namespace osu.Game.Overlays.Mods backgroundIcon.Icon = modAfter.Icon; using (BeginDelayedSequence(mod_switch_duration, true)) { - foregroundIcon.RotateTo(-rotate_angle * direction); - foregroundIcon.RotateTo(0f, mod_switch_duration, mod_switch_easing); - - backgroundIcon.RotateTo(rotate_angle * direction); - backgroundIcon.RotateTo(0f, mod_switch_duration, mod_switch_easing); + foregroundIcon.RotateTo(-rotate_angle * direction).RotateTo(0f, mod_switch_duration, mod_switch_easing); + backgroundIcon.RotateTo(rotate_angle * direction).RotateTo(0f, mod_switch_duration, mod_switch_easing); Schedule(() => displayMod(modAfter)); } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 464c9893d1..93e2cdfbbc 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -154,14 +154,11 @@ namespace osu.Game.Overlays textLine2.Text = settingValue; textLine3.Text = shortcut.ToUpper(); - box.FadeIn(500, EasingTypes.OutQuint); - box.ResizeHeightTo(height, 500, EasingTypes.OutQuint); - - using (box.BeginDelayedSequence(500)) - { - box.FadeOutFromOne(1500, EasingTypes.InQuint); - box.ResizeHeightTo(height_contracted, 1500, EasingTypes.InQuint); - } + box.Animate( + b => b.FadeIn(500, EasingTypes.OutQuint).ResizeHeightTo(height, 500, EasingTypes.OutQuint) + ).Then( + b => b.FadeOutFromOne(1500, EasingTypes.InQuint).ResizeHeightTo(height_contracted, 1500, EasingTypes.InQuint) + ); int optionCount = 0; int selectedOption = -1; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index aa866574cc..4b5d815c02 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -130,14 +130,11 @@ namespace osu.Game.Screens.Menu icon.RotateTo(rightward ? 10 : -10, duration * 2, EasingTypes.InOutSine); - icon.MoveToY(-10, duration, EasingTypes.Out); - icon.ScaleTo(Vector2.One, duration, EasingTypes.Out); - - using (icon.BeginDelayedSequence(duration)) - { - icon.MoveToY(0, duration, EasingTypes.In); - icon.ScaleTo(new Vector2(1, 0.9f), duration, EasingTypes.In); - } + icon.Animate( + i => i.MoveToY(-10, duration, EasingTypes.Out).ScaleTo(1, duration, EasingTypes.Out) + ).Then( + i => i.MoveToY(0, duration, EasingTypes.In).ScaleTo(new Vector2(1, 0.9f), duration, EasingTypes.In) + ); } protected override bool OnHover(InputState state) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 24fee10195..e27cf666c0 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -229,11 +229,7 @@ namespace osu.Game.Screens.Menu buttonAreaBackground.ScaleTo(Vector2.One, 500, EasingTypes.Out); buttonArea.FadeOut(300); - using (osuLogo.BeginDelayedSequence(150)) - { - osuLogo.MoveTo(Vector2.Zero, 800, EasingTypes.OutExpo); - osuLogo.ScaleTo(1, 800, EasingTypes.OutExpo); - } + osuLogo.Delay(150).ScaleTo(1, 800, EasingTypes.OutExpo).MoveTo(Vector2.Zero, 800, EasingTypes.OutExpo); foreach (Button b in buttonsTopLevel) b.State = ButtonState.Contracted; diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 065c7c5be0..4b7c2a0e00 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -90,9 +90,8 @@ namespace osu.Game.Screens.Menu private void flash(Drawable d, double beatLength, bool kiai, TrackAmplitudes amplitudes) { - d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time); - using (d.BeginDelayedSequence(box_fade_in_time)) - d.FadeOut(beatLength, EasingTypes.In); + d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time) + .Then().FadeOut(beatLength, EasingTypes.In); } } } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index efbd106cb5..db2bffa079 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -237,34 +237,23 @@ namespace osu.Game.Screens.Menu if (beatIndex < 0) return; if (IsHovered) - { - using (BeginDelayedSequence(early_activation)) - Schedule(() => sampleBeat.Play()); - } + this.Delay(early_activation).Schedule(() => sampleBeat.Play()); - logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, EasingTypes.Out); - using (logoBeatContainer.BeginDelayedSequence(early_activation)) - logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, EasingTypes.Out) + .Then().ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); ripple.ClearTransforms(); - ripple.ScaleTo(logoAmplitudeContainer.Scale); - ripple.Alpha = 0.15f * amplitudeAdjust; - - ripple.ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, EasingTypes.OutQuint); - ripple.FadeOut(beatLength, EasingTypes.OutQuint); + ripple.ScaleTo(logoAmplitudeContainer.Scale).ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, EasingTypes.OutQuint); + ripple.FadeTo(0.15f * amplitudeAdjust).FadeOut(beatLength, EasingTypes.OutQuint); if (effectPoint.KiaiMode && flashLayer.Alpha < 0.4f) { flashLayer.ClearTransforms(); visualizer.ClearTransforms(); - flashLayer.FadeTo(0.2f * amplitudeAdjust, early_activation, EasingTypes.Out); - visualizer.FadeTo(0.9f * amplitudeAdjust, early_activation, EasingTypes.Out); - using (flashLayer.BeginDelayedSequence(early_activation)) - flashLayer.FadeOut(beatLength); - using (visualizer.BeginDelayedSequence(early_activation)) - visualizer.FadeTo(0.5f, beatLength); + flashLayer.FadeTo(0.2f * amplitudeAdjust, early_activation, EasingTypes.Out).Then().FadeOut(beatLength); + visualizer.FadeTo(0.9f * amplitudeAdjust, early_activation, EasingTypes.Out).Then().FadeTo(0.5f, beatLength); } } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 3248495b61..70093a1407 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -98,10 +98,7 @@ namespace osu.Game.Screens.Play // in the case a replay isn't loaded, we want some elements to only appear briefly. if (!replayLoaded) - { - using (ModDisplay.BeginDelayedSequence(2000)) - ModDisplay.FadeOut(200); - } + ModDisplay.Delay(2000).FadeOut(200); } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c9ca91faa0..aafe459800 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -272,19 +272,14 @@ namespace osu.Game.Screens.Play dimLevel.ValueChanged += newDim => Background?.FadeTo(1 - (float)newDim, 800); - Content.ScaleTo(0.7f); + Content.ScaleTo(0.7f).ScaleTo(1, 750, EasingTypes.OutQuint); + Content.Delay(250).FadeIn(250); - using (Content.BeginDelayedSequence(250)) - Content.FadeIn(250); - - Content.ScaleTo(1, 750, EasingTypes.OutQuint); - - using (BeginDelayedSequence(750)) - Schedule(() => - { - if (!pauseContainer.IsPaused) - decoupledClock.Start(); - }); + this.Delay(750).Schedule(() => + { + if (!pauseContainer.IsPaused) + decoupledClock.Start(); + }); pauseContainer.Alpha = 0; pauseContainer.FadeIn(750, EasingTypes.OutQuint); diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 636851e14d..34e9cd186f 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -67,20 +67,16 @@ namespace osu.Game.Screens.Ranking modeChangeButtons.FadeOut(); currentPage.FadeOut(); - circleOuterBackground.ScaleTo(1, transition_time, EasingTypes.OutQuint); - circleOuterBackground.FadeTo(1, transition_time, EasingTypes.OutQuint); + circleOuterBackground.FadeIn(transition_time, EasingTypes.OutQuint).ScaleTo(1, transition_time, EasingTypes.OutQuint); using (BeginDelayedSequence(transition_time * 0.25f, true)) { - circleOuter.ScaleTo(1, transition_time, EasingTypes.OutQuint); - circleOuter.FadeTo(1, transition_time, EasingTypes.OutQuint); + circleOuter.FadeIn(transition_time, EasingTypes.OutQuint).ScaleTo(1, transition_time, EasingTypes.OutQuint); using (BeginDelayedSequence(transition_time * 0.3f, true)) { backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint); - - circleInner.ScaleTo(1, transition_time, EasingTypes.OutQuint); - circleInner.FadeTo(1, transition_time, EasingTypes.OutQuint); + circleInner.FadeIn(transition_time, EasingTypes.OutQuint).ScaleTo(1, transition_time, EasingTypes.OutQuint); using (BeginDelayedSequence(transition_time * 0.4f, true)) { From 032e9df67bda26d6120511b2490d057dafbbb058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 16 Jul 2017 17:47:29 +0300 Subject: [PATCH 008/132] ApplyDelay -> AddDelay --- osu-framework | 2 +- .../Tests/TestCaseNotificationManager.cs | 2 +- .../Tests/TestCaseTaikoPlayfield.cs | 2 +- .../Drawables/Connections/FollowPointRenderer.cs | 2 +- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/DrawableSliderTick.cs | 6 +++--- .../Objects/Drawables/DrawableSpinner.cs | 4 ++-- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- .../Objects/Drawables/DrawableBarLine.cs | 2 +- .../Objects/Drawables/DrawableHit.cs | 6 +++--- .../Objects/Drawables/DrawableSwell.cs | 6 +++--- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 4 ++-- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- .../Graphics/UserInterface/Volume/VolumeControl.cs | 2 +- osu.Game/OsuGame.cs | 2 +- osu.Game/Overlays/DialogOverlay.cs | 2 +- .../Overlays/Notifications/ProgressNotification.cs | 2 +- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 4 ++-- osu.Game/Screens/Menu/Disclaimer.cs | 6 +++--- osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs | 2 +- osu.Game/Screens/Play/PauseContainer.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 10 +++++----- osu.Game/Screens/Ranking/ResultsPage.cs | 2 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 2 +- osu.Game/Screens/ScreenWhiteBox.cs | 2 +- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 2 +- .../Screens/Select/Leaderboards/LeaderboardScore.cs | 6 +++--- 27 files changed, 44 insertions(+), 44 deletions(-) diff --git a/osu-framework b/osu-framework index c2a20bd8b3..23f971f90e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit c2a20bd8b31144c6d196ab6ae0e8858acabbe032 +Subproject commit 23f971f90eef75108932c961738bec93a0627e1c diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 4d9a0fe9a2..837545b114 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -57,7 +57,7 @@ namespace osu.Desktop.VisualTests.Tests if (remaining > 0) { - ApplyDelay(80); + AddDelay(80); Schedule(() => sendBarrage(remaining - 1)); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 46ad7acb52..434689641f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -84,7 +84,7 @@ namespace osu.Desktop.VisualTests.Tests break; case 5: addSwell(1000); - playfieldContainer.ApplyDelay(scroll_time - 100); + playfieldContainer.AddDelay(scroll_time - 100); break; } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index 3a32d9765e..be901a5748 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections fp.MoveTo(pointEndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); - fp.ApplyDelay(fadeOutTime - fadeInTime); + fp.AddDelay(fadeOutTime - fadeInTime); fp.FadeOut(DrawableOsuHitObject.TIME_FADEIN); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 63721dee4f..0d2b200c76 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -158,7 +158,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { ball.FadeIn(); - ApplyDelay(slider.Duration, true); + AddDelay(slider.Duration, true); body.FadeOut(160); ball.FadeOut(160); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index d0e141db6c..92c7ff6f2a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -66,10 +66,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables this.ScaleTo(1.2f, animIn); this.FadeIn(animIn); - ApplyDelay(animIn); + AddDelay(animIn); this.ScaleTo(1, 150, EasingTypes.Out); - ApplyDelay(-animIn); + AddDelay(-animIn); } protected override void UpdateCurrentState(ArmedState state) @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables switch (state) { case ArmedState.Idle: - ApplyDelay(FadeOutTime - sliderTick.StartTime); + AddDelay(FadeOutTime - sliderTick.StartTime); this.FadeOut(); break; case ArmedState.Miss: diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 0bb2f718d3..d7fe0e32bf 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -192,13 +192,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables mainContainer.ScaleTo(0); mainContainer.ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, EasingTypes.OutQuint); - mainContainer.ApplyDelay(TIME_PREEMPT - 150); + mainContainer.AddDelay(TIME_PREEMPT - 150); mainContainer.ScaleTo(1, 500, EasingTypes.OutQuint); } protected override void UpdateCurrentState(ArmedState state) { - ApplyDelay(spinner.Duration, true); + AddDelay(spinner.Duration, true); this.FadeOut(160); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index ee2ecfa8b1..d0f953ea1f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -129,7 +129,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { background.Flush(false, nameof(Alpha)); background.FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo); - background.ApplyDelay(60); + background.AddDelay(60); background.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index bd713ec8b7..3b5ecf244d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void LoadComplete() { base.LoadComplete(); - ApplyDelay(BarLine.StartTime - Time.Current); + AddDelay(BarLine.StartTime - Time.Current); this.FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 31e92e4c70..2e8f9d945b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void UpdateState(ArmedState state) { - ApplyDelay(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true); + AddDelay(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true); var circlePiece = MainPiece as CirclePiece; @@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables switch (State) { case ArmedState.Idle: - ApplyDelay(HitObject.HitWindowMiss); + AddDelay(HitObject.HitWindowMiss); break; case ArmedState.Miss: this.FadeOut(100); @@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables Content.ScaleTo(0.8f, gravity_time * 2, EasingTypes.OutQuad); this.MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out); - ApplyDelay(gravity_time, true); + AddDelay(gravity_time, true); this.MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In); break; } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 4cb5f211e4..5f989579a2 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -180,13 +180,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { const float preempt = 100; - ApplyDelay(HitObject.StartTime - Time.Current - preempt, true); + AddDelay(HitObject.StartTime - Time.Current - preempt, true); targetRing.ScaleTo(target_ring_scale, preempt * 4, EasingTypes.OutQuint); - ApplyDelay(preempt, true); + AddDelay(preempt, true); - ApplyDelay(Judgement.TimeOffset + HitObject.Duration, true); + AddDelay(Judgement.TimeOffset + HitObject.Duration, true); const float out_transition_time = 300; diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 279092424b..737f5d344e 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -150,12 +150,12 @@ namespace osu.Game.Rulesets.Taiko.UI const float up_time = 1000; back.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); - back.ApplyDelay(down_time); + back.AddDelay(down_time); back.ScaleTo(1, up_time, EasingTypes.OutQuint); target.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); target.FadeTo(Math.Min(target.Alpha + alpha_amount, 1), down_time, EasingTypes.OutQuint); - target.ApplyDelay(down_time); + target.AddDelay(down_time); target.ScaleTo(1, up_time, EasingTypes.OutQuint); target.FadeOut(up_time, EasingTypes.OutQuint); } diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index bb85c9681d..67202c9e0d 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -99,7 +99,7 @@ namespace osu.Game.Graphics.UserInterface colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In); flash(); - ApplyDelay(click_duration); + AddDelay(click_duration); Schedule(delegate { colourContainer.ResizeTo(new Vector2(0.8f, 1f)); spriteText.Spacing = Vector2.Zero; diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index 19af0991f5..8c5347bd23 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -106,7 +106,7 @@ namespace osu.Game.Graphics.UserInterface.Volume private void schedulePopOut() { popOutDelegate?.Cancel(); - ApplyDelay(1000); + AddDelay(1000); popOutDelegate = Schedule(Hide); } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7f9ddb685d..e45f030fd1 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -119,7 +119,7 @@ namespace osu.Game if (!menu.IsCurrentScreen) { menu.MakeCurrent(); - ApplyDelay(500); + AddDelay(500); scoreLoad = Schedule(() => LoadScore(s)); return; } diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 5580287276..c558ac5933 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays if (v != Visibility.Hidden) return; //handle the dialog being dismissed. - dialog.ApplyDelay(PopupDialog.EXIT_DURATION); + dialog.AddDelay(PopupDialog.EXIT_DURATION); dialog.Expire(); if (dialog == currentDialog) diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 1d76990859..098088191f 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Notifications NotificationContent.MoveToY(-DrawSize.Y / 2, 200, EasingTypes.OutQuint); this.FadeTo(0.01f, 200); //don't completely fade out or our scheduled task won't run. - ApplyDelay(100); + AddDelay(100); Schedule(Completed); break; } diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index d5075ec400..5d471cb700 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -75,14 +75,14 @@ namespace osu.Game.Rulesets.Judgements this.MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); this.RotateTo(40, 800, EasingTypes.InQuint); - ApplyDelay(600); + AddDelay(600); this.FadeOut(200); break; case HitResult.Hit: this.ScaleTo(0.9f); this.ScaleTo(1, 500, EasingTypes.OutElastic); - ApplyDelay(100); + AddDelay(100); this.FadeOut(400); break; } diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 718fe5d8be..908b64a3aa 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -100,14 +100,14 @@ namespace osu.Game.Screens.Menu Content.FadeInFromZero(500); - icon.ApplyDelay(1500); + icon.AddDelay(1500); icon.FadeColour(iconColour, 200); - ApplyDelay(6000, true); + AddDelay(6000, true); Content.FadeOut(250); - ApplyDelay(250); + AddDelay(250); Schedule(() => Push(intro)); } diff --git a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index a5c4f262f8..229c05859f 100644 --- a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -98,7 +98,7 @@ namespace osu.Game.Screens.Play.HUD return; fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint); - fill.ApplyDelay(glow_fade_delay); + fill.AddDelay(glow_fade_delay); fill.FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint); } diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index 7a257a4b6d..6683ba8fd5 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Play { OnResume = delegate { - ApplyDelay(400); + AddDelay(400); Schedule(Resume); }, OnRetry = () => OnRetry(), diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index ba92fb095d..50287ebe7d 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play Beatmap = player.Beatmap, }); - ApplyDelay(400); + AddDelay(400); Schedule(pushWhenLoaded); } @@ -104,14 +104,14 @@ namespace osu.Game.Screens.Play contentIn(); - ApplyDelay(500, true); + AddDelay(500, true); logo.MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo); - ApplyDelay(250, true); + AddDelay(250, true); info.FadeIn(500); - ApplyDelay(1400, true); + AddDelay(1400, true); Schedule(pushWhenLoaded); } @@ -123,7 +123,7 @@ namespace osu.Game.Screens.Play contentOut(); - ApplyDelay(250); + AddDelay(250); Schedule(() => { diff --git a/osu.Game/Screens/Ranking/ResultsPage.cs b/osu.Game/Screens/Ranking/ResultsPage.cs index 55e71cfcc4..b88e993886 100644 --- a/osu.Game/Screens/Ranking/ResultsPage.cs +++ b/osu.Game/Screens/Ranking/ResultsPage.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Ranking protected override void LoadComplete() { base.LoadComplete(); - fill.ApplyDelay(400); + fill.AddDelay(400); fill.FadeInFromZero(600); } diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 6f96ef500e..4e3458e522 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -179,7 +179,7 @@ namespace osu.Game.Screens.Ranking foreach (var s in statisticsContainer.Children) { s.FadeOut(); - s.ApplyDelay(delay += 200); + s.AddDelay(delay += 200); s.FadeIn(300 + delay, EasingTypes.Out); } }); diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index e6c25ff6f4..2ec721f0c0 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens boxContainer.ScaleTo(0.2f); boxContainer.RotateTo(-20); - Content.ApplyDelay(300, true); + Content.AddDelay(300, true); boxContainer.ScaleTo(1, transition_time, EasingTypes.OutElastic); boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index dcf39a7880..4a00ef71a0 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Select.Leaderboards }; scrollFlow.Add(ls); - ls.ApplyDelay(i++ * 50, true); + ls.AddDelay(i++ * 50, true); ls.Show(); } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 02d6833d3f..3867d4e379 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -64,18 +64,18 @@ namespace osu.Game.Screens.Select.Leaderboards this.FadeIn(200); content.MoveToY(0, 800, EasingTypes.OutQuint); - ApplyDelay(100, true); + AddDelay(100, true); avatar.FadeIn(300, EasingTypes.OutQuint); nameLabel.FadeIn(350, EasingTypes.OutQuint); avatar.MoveToX(0, 300, EasingTypes.OutQuint); nameLabel.MoveToX(0, 350, EasingTypes.OutQuint); - ApplyDelay(250, true); + AddDelay(250, true); scoreLabel.FadeIn(200); scoreRank.FadeIn(200); - ApplyDelay(50, true); + AddDelay(50, true); var drawables = new Drawable[] { flagBadgeContainer, maxCombo, accuracy, modsContainer, }; for (int i = 0; i < drawables.Length; i++) From e6916ec57b0834c392e2b61123e3836a8904eafd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 16 Jul 2017 17:48:47 +0300 Subject: [PATCH 009/132] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 23f971f90e..a3ed5b642f 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 23f971f90eef75108932c961738bec93a0627e1c +Subproject commit a3ed5b642fcce039483801ca01fdbbf9117cec15 From 19fb03e73763cdfda42a5dafe5d39c153b11e6a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 16 Jul 2017 18:28:20 +0300 Subject: [PATCH 010/132] Try different formatting style --- .../Tests/TestCaseContextMenu.cs | 12 ++++----- .../Objects/Drawables/DrawableHitCircle.cs | 19 ++++++++++---- .../Objects/Drawables/DrawableSwell.cs | 6 +++-- .../Objects/Drawables/Pieces/CirclePiece.cs | 6 +++-- .../Graphics/UserInterface/TwoLayerButton.cs | 3 ++- osu.Game/Overlays/MedalOverlay.cs | 4 ++- .../Overlays/MedalSplash/DrawableMedal.cs | 12 ++++++--- osu.Game/Overlays/Mods/ModButton.cs | 9 +++++-- osu.Game/Overlays/OnScreenDisplay.cs | 6 +++-- osu.Game/Screens/Menu/Button.cs | 6 +++-- osu.Game/Screens/Menu/ButtonSystem.cs | 4 ++- osu.Game/Screens/Menu/MenuSideFlashes.cs | 3 ++- osu.Game/Screens/Menu/OsuLogo.cs | 25 +++++++++++++------ osu.Game/Screens/Play/Player.cs | 7 ++++-- osu.Game/Screens/Ranking/Results.cs | 13 +++++++--- 15 files changed, 94 insertions(+), 41 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index d89397e793..bf8f9bf7f4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -60,12 +60,12 @@ namespace osu.Desktop.VisualTests.Tests base.LoadComplete(); // Move box along a square trajectory - container - .MoveTo(new Vector2(0, 100), duration) - .Then().MoveTo(new Vector2(100, 100), duration) - .Then().MoveTo(new Vector2(100, 0), duration) - .Then().MoveTo(Vector2.Zero, duration) - .Loop(); + container.Loop(c => c + .MoveTo(new Vector2(0, 100), duration).Then() + .MoveTo(new Vector2(100, 100), duration).Then() + .MoveTo(new Vector2(100, 0), duration).Then() + .MoveTo(Vector2.Zero, duration) + ); } private class MyContextMenuContainer : Container, IHasContextMenu diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index ec047d2aa8..a890a0cdb4 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -129,13 +129,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables ApproachCircle.FadeOut(50); const double flash_in = 40; - flash.FadeTo(0.8f, flash_in).Then().FadeOut(100); + flash.FadeTo(0.8f, flash_in) + .Then() + .FadeOut(100); + explode.FadeIn(flash_in); - ring.Delay(flash_in).FadeOut(); - circle.Delay(flash_in).FadeOut(); - number.Delay(flash_in).FadeOut(); - this.Delay(flash_in).FadeOut(800).ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad); + using (BeginDelayedSequence(flash_in, true)) + { + //after the flash, we can hide some elements that were behind it + ring.FadeOut(); + circle.FadeOut(); + number.FadeOut(); + + this.FadeOut(800) + .ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad); + } Expire(); break; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 5f989579a2..363dcae883 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -147,8 +147,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables var completion = (float)userHits / HitObject.RequiredHits; - expandingRing.FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50) - .Then().FadeTo(completion / 8, 2000, EasingTypes.OutQuint); + expandingRing + .FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50) + .Then() + .FadeTo(completion / 8, 2000, EasingTypes.OutQuint); symbol.RotateTo((float)(completion * HitObject.Duration / 8), 4000, EasingTypes.OutQuint); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index cd7e70eff3..a4cd026e4c 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -166,8 +166,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces double duration = timingPoint.BeatLength * 2; - background.FadeEdgeEffectTo(1, pre_beat_transition_time, EasingTypes.OutQuint) - .Then().FadeEdgeEffectTo(edge_alpha_kiai, duration, EasingTypes.OutQuint); + background + .FadeEdgeEffectTo(1, pre_beat_transition_time, EasingTypes.OutQuint) + .Then() + .FadeEdgeEffectTo(edge_alpha_kiai, duration, EasingTypes.OutQuint); } } } \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 32903b4eaf..b763cd7971 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -246,7 +246,8 @@ namespace osu.Game.Graphics.UserInterface if (beatIndex < 0) return; icon.ScaleTo(1 - 0.1f * amplitudeAdjust, beat_in_time, EasingTypes.Out) - .Then().ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + .Then() + .ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 627e485993..c3825e32b8 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -204,7 +204,9 @@ namespace osu.Game.Overlays using (BeginDelayedSequence(200, true)) { - disc.FadeIn(initial_duration).ScaleTo(1f, initial_duration * 2, EasingTypes.OutElastic); + disc.FadeIn(initial_duration) + .ScaleTo(1f, initial_duration * 2, EasingTypes.OutElastic); + particleContainer.FadeIn(initial_duration); outerSpin.FadeTo(0.1f, initial_duration * 2); diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 166b8e8d41..89e991f5ef 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -147,17 +147,23 @@ namespace osu.Game.Overlays.MedalSplash medalContainer.ScaleTo(0); break; case DisplayState.Icon: - medalContainer.FadeIn(duration).ScaleTo(1, duration, EasingTypes.OutElastic); + medalContainer + .FadeIn(duration) + .ScaleTo(1, duration, EasingTypes.OutElastic); break; case DisplayState.MedalUnlocked: - medalContainer.FadeTo(1).ScaleTo(1); + medalContainer + .FadeTo(1) + .ScaleTo(1); this.ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo); unlocked.FadeInFromZero(duration); break; case DisplayState.Full: - medalContainer.FadeTo(1).ScaleTo(1); + medalContainer + .FadeTo(1) + .ScaleTo(1); this.ScaleTo(scale_when_full, duration, EasingTypes.OutExpo); this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo); diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 45da537a60..bea0aae57e 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -81,8 +81,13 @@ namespace osu.Game.Overlays.Mods backgroundIcon.Icon = modAfter.Icon; using (BeginDelayedSequence(mod_switch_duration, true)) { - foregroundIcon.RotateTo(-rotate_angle * direction).RotateTo(0f, mod_switch_duration, mod_switch_easing); - backgroundIcon.RotateTo(rotate_angle * direction).RotateTo(0f, mod_switch_duration, mod_switch_easing); + foregroundIcon + .RotateTo(-rotate_angle * direction) + .RotateTo(0f, mod_switch_duration, mod_switch_easing); + + backgroundIcon + .RotateTo(rotate_angle * direction) + .RotateTo(0f, mod_switch_duration, mod_switch_easing); Schedule(() => displayMod(modAfter)); } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 93e2cdfbbc..e6a55800ef 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -155,9 +155,11 @@ namespace osu.Game.Overlays textLine3.Text = shortcut.ToUpper(); box.Animate( - b => b.FadeIn(500, EasingTypes.OutQuint).ResizeHeightTo(height, 500, EasingTypes.OutQuint) + b => b.FadeIn(500, EasingTypes.OutQuint), + b => b.ResizeHeightTo(height, 500, EasingTypes.OutQuint) ).Then( - b => b.FadeOutFromOne(1500, EasingTypes.InQuint).ResizeHeightTo(height_contracted, 1500, EasingTypes.InQuint) + b => b.FadeOutFromOne(1500, EasingTypes.InQuint), + b => b.ResizeHeightTo(height_contracted, 1500, EasingTypes.InQuint) ); int optionCount = 0; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 4b5d815c02..e04e3ce66b 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -131,9 +131,11 @@ namespace osu.Game.Screens.Menu icon.RotateTo(rightward ? 10 : -10, duration * 2, EasingTypes.InOutSine); icon.Animate( - i => i.MoveToY(-10, duration, EasingTypes.Out).ScaleTo(1, duration, EasingTypes.Out) + i => i.MoveToY(-10, duration, EasingTypes.Out), + i => i.ScaleTo(1, duration, EasingTypes.Out) ).Then( - i => i.MoveToY(0, duration, EasingTypes.In).ScaleTo(new Vector2(1, 0.9f), duration, EasingTypes.In) + i => i.MoveToY(0, duration, EasingTypes.In), + i => i.ScaleTo(new Vector2(1, 0.9f), duration, EasingTypes.In) ); } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index e27cf666c0..87f8e32abd 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -229,7 +229,9 @@ namespace osu.Game.Screens.Menu buttonAreaBackground.ScaleTo(Vector2.One, 500, EasingTypes.Out); buttonArea.FadeOut(300); - osuLogo.Delay(150).ScaleTo(1, 800, EasingTypes.OutExpo).MoveTo(Vector2.Zero, 800, EasingTypes.OutExpo); + osuLogo.Delay(150) + .ScaleTo(1, 800, EasingTypes.OutExpo) + .MoveTo(Vector2.Zero, 800, EasingTypes.OutExpo); foreach (Button b in buttonsTopLevel) b.State = ButtonState.Contracted; diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 4b7c2a0e00..fdacccd913 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -91,7 +91,8 @@ namespace osu.Game.Screens.Menu private void flash(Drawable d, double beatLength, bool kiai, TrackAmplitudes amplitudes) { d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time) - .Then().FadeOut(beatLength, EasingTypes.In); + .Then() + .FadeOut(beatLength, EasingTypes.In); } } } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index db2bffa079..c5d4cbb9b1 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -239,21 +239,30 @@ namespace osu.Game.Screens.Menu if (IsHovered) this.Delay(early_activation).Schedule(() => sampleBeat.Play()); - logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, EasingTypes.Out) - .Then().ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + logoBeatContainer + .ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, EasingTypes.Out) + .Then() + .ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); ripple.ClearTransforms(); - - ripple.ScaleTo(logoAmplitudeContainer.Scale).ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, EasingTypes.OutQuint); - ripple.FadeTo(0.15f * amplitudeAdjust).FadeOut(beatLength, EasingTypes.OutQuint); + ripple + .ScaleTo(logoAmplitudeContainer.Scale) + .ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, EasingTypes.OutQuint) + .FadeTo(0.15f * amplitudeAdjust).FadeOut(beatLength, EasingTypes.OutQuint); if (effectPoint.KiaiMode && flashLayer.Alpha < 0.4f) { flashLayer.ClearTransforms(); - visualizer.ClearTransforms(); + flashLayer + .FadeTo(0.2f * amplitudeAdjust, early_activation, EasingTypes.Out) + .Then() + .FadeOut(beatLength); - flashLayer.FadeTo(0.2f * amplitudeAdjust, early_activation, EasingTypes.Out).Then().FadeOut(beatLength); - visualizer.FadeTo(0.9f * amplitudeAdjust, early_activation, EasingTypes.Out).Then().FadeTo(0.5f, beatLength); + visualizer.ClearTransforms(); + visualizer + .FadeTo(0.9f * amplitudeAdjust, early_activation, EasingTypes.Out) + .Then() + .FadeTo(0.5f, beatLength); } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index aafe459800..6ccc80beb3 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -272,8 +272,11 @@ namespace osu.Game.Screens.Play dimLevel.ValueChanged += newDim => Background?.FadeTo(1 - (float)newDim, 800); - Content.ScaleTo(0.7f).ScaleTo(1, 750, EasingTypes.OutQuint); - Content.Delay(250).FadeIn(250); + Content + .ScaleTo(0.7f) + .ScaleTo(1, 750, EasingTypes.OutQuint) + .Delay(250) + .FadeIn(250); this.Delay(750).Schedule(() => { diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 34e9cd186f..7b29cab027 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -67,16 +67,23 @@ namespace osu.Game.Screens.Ranking modeChangeButtons.FadeOut(); currentPage.FadeOut(); - circleOuterBackground.FadeIn(transition_time, EasingTypes.OutQuint).ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleOuterBackground + .FadeIn(transition_time, EasingTypes.OutQuint) + .ScaleTo(1, transition_time, EasingTypes.OutQuint); using (BeginDelayedSequence(transition_time * 0.25f, true)) { - circleOuter.FadeIn(transition_time, EasingTypes.OutQuint).ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleOuter + .FadeIn(transition_time, EasingTypes.OutQuint) + .ScaleTo(1, transition_time, EasingTypes.OutQuint); using (BeginDelayedSequence(transition_time * 0.3f, true)) { backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint); - circleInner.FadeIn(transition_time, EasingTypes.OutQuint).ScaleTo(1, transition_time, EasingTypes.OutQuint); + + circleInner + .FadeIn(transition_time, EasingTypes.OutQuint) + .ScaleTo(1, transition_time, EasingTypes.OutQuint); using (BeginDelayedSequence(transition_time * 0.4f, true)) { From 87bcd526f3637ff4dbe5d395df1cab92cfee7da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 17 Jul 2017 16:51:21 +0300 Subject: [PATCH 011/132] Get rid of raw AddDelay calls within osu.Game --- osu-framework | 2 +- .../Tests/TestCaseNotificationManager.cs | 5 +-- .../Tests/TestCaseTaikoPlayfield.cs | 8 +++-- .../Objects/Drawables/DrawableSliderTick.cs | 14 ++++---- .../Graphics/UserInterface/DialogButton.cs | 3 +- .../UserInterface/Volume/VolumeControl.cs | 3 +- osu.Game/OsuGame.cs | 3 +- osu.Game/Overlays/DialogOverlay.cs | 3 +- .../Notifications/ProgressNotification.cs | 5 +-- .../Rulesets/Judgements/DrawableJudgement.cs | 6 ++-- osu.Game/Screens/Menu/Disclaimer.cs | 17 ++++----- .../Screens/Play/HUD/StandardHealthDisplay.cs | 6 ++-- osu.Game/Screens/Play/PauseContainer.cs | 6 +--- osu.Game/Screens/Play/PlayerLoader.cs | 21 +++-------- osu.Game/Screens/Ranking/ResultsPage.cs | 3 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 6 ++-- osu.Game/Screens/ScreenWhiteBox.cs | 13 +++---- .../Select/Leaderboards/Leaderboard.cs | 4 +-- .../Select/Leaderboards/LeaderboardScore.cs | 35 ++++++++++--------- 19 files changed, 67 insertions(+), 96 deletions(-) diff --git a/osu-framework b/osu-framework index a3ed5b642f..8463ba949b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit a3ed5b642fcce039483801ca01fdbbf9117cec15 +Subproject commit 8463ba949b0a4a54c9aca157b2b24a8b0277608a diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 837545b114..849df1263e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -56,10 +56,7 @@ namespace osu.Desktop.VisualTests.Tests } if (remaining > 0) - { - AddDelay(80); - Schedule(() => sendBarrage(remaining - 1)); - } + Scheduler.AddDelayed(() => sendBarrage(remaining - 1), 80); } protected override void Update() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 434689641f..8ca129eb91 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -67,6 +67,8 @@ namespace osu.Desktop.VisualTests.Tests private void changePlayfieldSize(int step) { + double delay = 0; + // Add new hits switch (step) { @@ -84,7 +86,7 @@ namespace osu.Desktop.VisualTests.Tests break; case 5: addSwell(1000); - playfieldContainer.AddDelay(scroll_time - 100); + delay = scroll_time - 100; break; } @@ -92,10 +94,10 @@ namespace osu.Desktop.VisualTests.Tests switch (step) { default: - playfieldContainer.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); + playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); break; case 6: - playfieldContainer.ResizeTo(new Vector2(1, TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT), 500); + playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT), 500); break; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 92c7ff6f2a..f2631cf01c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -62,14 +62,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { var animIn = Math.Min(150, sliderTick.StartTime - FadeInTime); - this.ScaleTo(0.5f); - this.ScaleTo(1.2f, animIn); - this.FadeIn(animIn); - - AddDelay(animIn); - this.ScaleTo(1, 150, EasingTypes.Out); - - AddDelay(-animIn); + this.Animate( + d => d.FadeIn(animIn), + d => d.ScaleTo(0.5f).ScaleTo(1.2f, animIn) + ).Then( + d => d.ScaleTo(1, 150, EasingTypes.Out) + ); } protected override void UpdateCurrentState(ArmedState state) diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 67202c9e0d..460f4cea41 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -99,8 +99,7 @@ namespace osu.Game.Graphics.UserInterface colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In); flash(); - AddDelay(click_duration); - Schedule(delegate { + this.Delay(click_duration).Schedule(delegate { colourContainer.ResizeTo(new Vector2(0.8f, 1f)); spriteText.Spacing = Vector2.Zero; glowContainer.FadeOut(); diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index 8c5347bd23..fa192b0825 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -106,8 +106,7 @@ namespace osu.Game.Graphics.UserInterface.Volume private void schedulePopOut() { popOutDelegate?.Cancel(); - AddDelay(1000); - popOutDelegate = Schedule(Hide); + this.Delay(1000).Schedule(Hide, out popOutDelegate); } } } \ No newline at end of file diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e45f030fd1..0ab63c972f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -119,8 +119,7 @@ namespace osu.Game if (!menu.IsCurrentScreen) { menu.MakeCurrent(); - AddDelay(500); - scoreLoad = Schedule(() => LoadScore(s)); + this.Delay(500).Schedule(() => LoadScore(s), out scoreLoad); return; } diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index c558ac5933..b384e110f9 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -35,8 +35,7 @@ namespace osu.Game.Overlays if (v != Visibility.Hidden) return; //handle the dialog being dismissed. - dialog.AddDelay(PopupDialog.EXIT_DURATION); - dialog.Expire(); + dialog.Delay(PopupDialog.EXIT_DURATION).Expire(); if (dialog == currentDialog) State = Visibility.Hidden; diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 098088191f..bd7b8bf844 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -78,10 +78,7 @@ namespace osu.Game.Overlays.Notifications { case ProgressNotificationState.Completed: NotificationContent.MoveToY(-DrawSize.Y / 2, 200, EasingTypes.OutQuint); - this.FadeTo(0.01f, 200); //don't completely fade out or our scheduled task won't run. - - AddDelay(100); - Schedule(Completed); + this.FadeOut(200).Finally(d => Completed()); break; } } diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 5d471cb700..ac8a8e2005 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -75,15 +75,13 @@ namespace osu.Game.Rulesets.Judgements this.MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); this.RotateTo(40, 800, EasingTypes.InQuint); - AddDelay(600); - this.FadeOut(200); + this.Delay(600).FadeOut(200); break; case HitResult.Hit: this.ScaleTo(0.9f); this.ScaleTo(1, 500, EasingTypes.OutElastic); - AddDelay(100); - this.FadeOut(400); + this.Delay(100).FadeOut(400); break; } diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 908b64a3aa..6a176898a2 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -98,18 +98,13 @@ namespace osu.Game.Screens.Menu { base.OnEntering(last); - Content.FadeInFromZero(500); + icon.Delay(1500).FadeColour(iconColour, 200); - icon.AddDelay(1500); - icon.FadeColour(iconColour, 200); - - AddDelay(6000, true); - - Content.FadeOut(250); - - AddDelay(250); - - Schedule(() => Push(intro)); + Content + .FadeInFromZero(500) + .Then(5500) + .FadeOut(250) + .Finally(d => Push(intro)); } } } diff --git a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index 229c05859f..b4b3bd885e 100644 --- a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -97,9 +97,9 @@ namespace osu.Game.Screens.Play.HUD if (judgement.Result == HitResult.Miss) return; - fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint); - fill.AddDelay(glow_fade_delay); - fill.FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint); + fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint) + .Delay(glow_fade_delay) + .FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint); } protected override void SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, EasingTypes.OutQuint); diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index 6683ba8fd5..eed5cd1c20 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -56,11 +56,7 @@ namespace osu.Game.Screens.Play AddInternal(pauseOverlay = new PauseOverlay { - OnResume = delegate - { - AddDelay(400); - Schedule(Resume); - }, + OnResume = () => this.Delay(400).Schedule(Resume), OnRetry = () => OnRetry(), OnQuit = () => OnQuit(), }); diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 50287ebe7d..9045067bd9 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -77,9 +77,7 @@ namespace osu.Game.Screens.Play Beatmap = player.Beatmap, }); - AddDelay(400); - - Schedule(pushWhenLoaded); + this.Delay(400).Schedule(pushWhenLoaded); } private void contentIn() @@ -104,16 +102,9 @@ namespace osu.Game.Screens.Play contentIn(); - AddDelay(500, true); - - logo.MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo); - AddDelay(250, true); - - info.FadeIn(500); - - AddDelay(1400, true); - - Schedule(pushWhenLoaded); + logo.Delay(500).MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo); + info.Delay(750).FadeIn(500); + this.Delay(2150).Schedule(pushWhenLoaded); } private void pushWhenLoaded() @@ -123,9 +114,7 @@ namespace osu.Game.Screens.Play contentOut(); - AddDelay(250); - - Schedule(() => + this.Delay(250).Schedule(() => { if (!IsCurrentScreen) return; diff --git a/osu.Game/Screens/Ranking/ResultsPage.cs b/osu.Game/Screens/Ranking/ResultsPage.cs index b88e993886..7f381ebf99 100644 --- a/osu.Game/Screens/Ranking/ResultsPage.cs +++ b/osu.Game/Screens/Ranking/ResultsPage.cs @@ -33,8 +33,7 @@ namespace osu.Game.Screens.Ranking protected override void LoadComplete() { base.LoadComplete(); - fill.AddDelay(400); - fill.FadeInFromZero(600); + fill.Delay(400).FadeInFromZero(600); } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 4e3458e522..09db835144 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -178,9 +178,9 @@ namespace osu.Game.Screens.Ranking int delay = 0; foreach (var s in statisticsContainer.Children) { - s.FadeOut(); - s.AddDelay(delay += 200); - s.FadeIn(300 + delay, EasingTypes.Out); + s.FadeOut() + .Then(delay += 200) + .FadeIn(300 + delay, EasingTypes.Out); } }); } diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index 2ec721f0c0..7eac2407e9 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -44,13 +44,14 @@ namespace osu.Game.Screens boxContainer.ScaleTo(0.2f); boxContainer.RotateTo(-20); - Content.AddDelay(300, true); + using (Content.BeginDelayedSequence(300, true)) + { + boxContainer.ScaleTo(1, transition_time, EasingTypes.OutElastic); + boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); - boxContainer.ScaleTo(1, transition_time, EasingTypes.OutElastic); - boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); - - textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo); - Content.FadeIn(transition_time, EasingTypes.OutExpo); + textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo); + Content.FadeIn(transition_time, EasingTypes.OutExpo); + } } protected override bool OnExiting(Screen next) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 4a00ef71a0..91bc55f143 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -63,8 +63,8 @@ namespace osu.Game.Screens.Select.Leaderboards }; scrollFlow.Add(ls); - ls.AddDelay(i++ * 50, true); - ls.Show(); + using (BeginDelayedSequence(i++ * 50, true)) + ls.Show(); } scrollContainer.ScrollTo(0f, false); diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 3867d4e379..b0e234e5a2 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -64,23 +64,26 @@ namespace osu.Game.Screens.Select.Leaderboards this.FadeIn(200); content.MoveToY(0, 800, EasingTypes.OutQuint); - AddDelay(100, true); - avatar.FadeIn(300, EasingTypes.OutQuint); - nameLabel.FadeIn(350, EasingTypes.OutQuint); - - avatar.MoveToX(0, 300, EasingTypes.OutQuint); - nameLabel.MoveToX(0, 350, EasingTypes.OutQuint); - - AddDelay(250, true); - scoreLabel.FadeIn(200); - scoreRank.FadeIn(200); - - AddDelay(50, true); - var drawables = new Drawable[] { flagBadgeContainer, maxCombo, accuracy, modsContainer, }; - - for (int i = 0; i < drawables.Length; i++) + using (BeginDelayedSequence(100, true)) { - drawables[i].FadeIn(100 + i * 50); + avatar.FadeIn(300, EasingTypes.OutQuint); + nameLabel.FadeIn(350, EasingTypes.OutQuint); + + avatar.MoveToX(0, 300, EasingTypes.OutQuint); + nameLabel.MoveToX(0, 350, EasingTypes.OutQuint); + + using (BeginDelayedSequence(250, true)) + { + scoreLabel.FadeIn(200); + scoreRank.FadeIn(200); + + using (BeginDelayedSequence(50, true)) + { + var drawables = new Drawable[] { flagBadgeContainer, maxCombo, accuracy, modsContainer, }; + for (int i = 0; i < drawables.Length; i++) + drawables[i].FadeIn(100 + i * 50); + } + } } break; From 546efc0181f7d1984b96f13317123691b38e1510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 17 Jul 2017 17:05:24 +0300 Subject: [PATCH 012/132] Get rid of AddDelay & ResetDelay in osu.Game.Rulesets.Osu --- .../Connections/FollowPointRenderer.cs | 3 +-- .../Objects/Drawables/DrawableOsuHitObject.cs | 1 - .../Objects/Drawables/DrawableSlider.cs | 14 ++++++------ .../Objects/Drawables/DrawableSliderTick.cs | 11 +++++----- .../Objects/Drawables/DrawableSpinner.cs | 22 +++++++++---------- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 7 +++--- 6 files changed, 27 insertions(+), 31 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index be901a5748..42c148b525 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -98,8 +98,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections fp.MoveTo(pointEndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); - fp.AddDelay(fadeOutTime - fadeInTime); - fp.FadeOut(DrawableOsuHitObject.TIME_FADEIN); + fp.Delay(fadeOutTime - fadeInTime).FadeOut(DrawableOsuHitObject.TIME_FADEIN); } fp.Expire(true); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 1bc6070c33..e09b6bd997 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -26,7 +26,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected sealed override void UpdateState(ArmedState state) { Flush(); - ResetDelay(true); using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true)) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 0d2b200c76..d5583b0d9d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -158,14 +158,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { ball.FadeIn(); - AddDelay(slider.Duration, true); + using (BeginDelayedSequence(slider.Duration, true)) + { + body.FadeOut(160); + ball.FadeOut(160); - body.FadeOut(160); - ball.FadeOut(160); - - this.FadeOut(800); - - Expire(); + this.FadeOut(800) + .Expire(); + } } public Drawable ProxiedLayer => initialCircle.ApproachCircle; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index f2631cf01c..4220299a25 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -75,16 +75,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables switch (state) { case ArmedState.Idle: - AddDelay(FadeOutTime - sliderTick.StartTime); - this.FadeOut(); + this.Delay(FadeOutTime - sliderTick.StartTime).FadeOut(); break; case ArmedState.Miss: - this.FadeOut(160); - this.FadeColour(Color4.Red, 80); + this.FadeOut(160) + .FadeColour(Color4.Red, 80); break; case ArmedState.Hit: - this.FadeOut(120, EasingTypes.OutQuint); - this.ScaleTo(Scale * 1.5f, 120, EasingTypes.OutQuint); + this.FadeOut(120, EasingTypes.OutQuint) + .ScaleTo(Scale * 1.5f, 120, EasingTypes.OutQuint); break; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index d7fe0e32bf..208705b723 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -189,30 +189,28 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables disc.RotateTo(-720); symbol.RotateTo(-720); - mainContainer.ScaleTo(0); - mainContainer.ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, EasingTypes.OutQuint); - - mainContainer.AddDelay(TIME_PREEMPT - 150); - mainContainer.ScaleTo(1, 500, EasingTypes.OutQuint); + mainContainer + .ScaleTo(0) + .ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, EasingTypes.OutQuint) + .Then() + .ScaleTo(1, 500, EasingTypes.OutQuint); } protected override void UpdateCurrentState(ArmedState state) { - AddDelay(spinner.Duration, true); - - this.FadeOut(160); + var sequence = this.Delay(spinner.Duration).FadeOut(160); switch (state) { case ArmedState.Hit: - this.ScaleTo(Scale * 1.2f, 320, EasingTypes.Out); - Expire(); + sequence.ScaleTo(Scale * 1.2f, 320, EasingTypes.Out); break; case ArmedState.Miss: - this.ScaleTo(Scale * 0.8f, 320, EasingTypes.In); - Expire(); + sequence.ScaleTo(Scale * 0.8f, 320, EasingTypes.In); break; } + + sequence.Expire(); } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index d0f953ea1f..68bf1cbcdb 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -128,9 +128,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces if (Complete && updateCompleteTick()) { background.Flush(false, nameof(Alpha)); - background.FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo); - background.AddDelay(60); - background.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint); + background + .FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo) + .Then() + .FadeTo(tracking_alpha, 250, EasingTypes.OutQuint); } this.RotateTo(currentRotation / 2, validAndTracking ? 500 : 1500, EasingTypes.OutExpo); From 440878945e03c5f089e5ae07eb194bbe551c78c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 17 Jul 2017 18:16:15 +0300 Subject: [PATCH 013/132] Remove remaining usages of AddDelay --- osu-framework | 2 +- .../Objects/Drawables/DrawableSpinner.cs | 2 +- .../Objects/Drawables/DrawableBarLine.cs | 3 +- .../Objects/Drawables/DrawableHit.cs | 57 +++++++++---------- .../Objects/Drawables/DrawableSwell.cs | 19 +++---- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 18 +++--- 6 files changed, 47 insertions(+), 54 deletions(-) diff --git a/osu-framework b/osu-framework index 8463ba949b..2410eba0d4 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 8463ba949b0a4a54c9aca157b2b24a8b0277608a +Subproject commit 2410eba0d4b0cdcfe8b7e0636d490a258ddebc6c diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 208705b723..c7d838e517 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -210,7 +210,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables break; } - sequence.Expire(); + Expire(); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index 3b5ecf244d..7507ee600e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -64,8 +64,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void LoadComplete() { base.LoadComplete(); - AddDelay(BarLine.StartTime - Time.Current); - this.FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000); + this.Delay(BarLine.StartTime - Time.Current).FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000); } private void updateScrollPosition(double time) => this.MoveToX((float)((BarLine.StartTime - time) / BarLine.ScrollTime)); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 2e8f9d945b..b9d67d8d6a 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -65,45 +65,42 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void UpdateState(ArmedState state) { - AddDelay(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true); - var circlePiece = MainPiece as CirclePiece; - circlePiece?.FlashBox.Flush(); - switch (State) + using (BeginDelayedSequence(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true)) { - case ArmedState.Idle: - AddDelay(HitObject.HitWindowMiss); - break; - case ArmedState.Miss: - this.FadeOut(100); - break; - case ArmedState.Hit: - this.FadeOut(600); + switch (State) + { + case ArmedState.Idle: + this.Delay(HitObject.HitWindowMiss).Expire(); + break; + case ArmedState.Miss: + this.FadeOut(100) + .Expire(); + break; + case ArmedState.Hit: + var flash = circlePiece?.FlashBox; + if (flash != null) + { + flash.FadeTo(0.9f); + flash.FadeOut(300); + } - var flash = circlePiece?.FlashBox; - if (flash != null) - { - flash.FadeTo(0.9f); - flash.FadeOut(300); - } + const float gravity_time = 300; + const float gravity_travel_height = 200; + Content.ScaleTo(0.8f, gravity_time * 2, EasingTypes.OutQuad); - this.FadeOut(800); + this.FadeOut(800) + .MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out) + .Then() + .MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In); - const float gravity_time = 300; - const float gravity_travel_height = 200; - - Content.ScaleTo(0.8f, gravity_time * 2, EasingTypes.OutQuad); - - this.MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out); - AddDelay(gravity_time, true); - this.MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In); - break; + Expire(); + break; + } } - - Expire(); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 363dcae883..521d225abe 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -181,26 +181,21 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void UpdateState(ArmedState state) { const float preempt = 100; - - AddDelay(HitObject.StartTime - Time.Current - preempt, true); - - targetRing.ScaleTo(target_ring_scale, preempt * 4, EasingTypes.OutQuint); - - AddDelay(preempt, true); - - AddDelay(Judgement.TimeOffset + HitObject.Duration, true); - const float out_transition_time = 300; + double untilStartTime = HitObject.StartTime - Time.Current; + double untilJudgement = untilStartTime + Judgement.TimeOffset + HitObject.Duration; + + targetRing.Delay(untilStartTime - preempt).ScaleTo(target_ring_scale, preempt * 4, EasingTypes.OutQuint); + this.Delay(untilJudgement).FadeOut(out_transition_time, EasingTypes.Out); + switch (state) { case ArmedState.Hit: - bodyContainer.ScaleTo(1.4f, out_transition_time); + bodyContainer.Delay(untilJudgement).ScaleTo(1.4f, out_transition_time); break; } - this.FadeOut(out_transition_time, EasingTypes.Out); - Expire(); } diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 737f5d344e..a413d77d16 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -149,15 +149,17 @@ namespace osu.Game.Rulesets.Taiko.UI const float down_time = 40; const float up_time = 1000; - back.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); - back.AddDelay(down_time); - back.ScaleTo(1, up_time, EasingTypes.OutQuint); + back.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint) + .Then() + .ScaleTo(1, up_time, EasingTypes.OutQuint); - target.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); - target.FadeTo(Math.Min(target.Alpha + alpha_amount, 1), down_time, EasingTypes.OutQuint); - target.AddDelay(down_time); - target.ScaleTo(1, up_time, EasingTypes.OutQuint); - target.FadeOut(up_time, EasingTypes.OutQuint); + target.Animate( + t => t.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint), + t => t.FadeTo(Math.Min(target.Alpha + alpha_amount, 1), down_time, EasingTypes.OutQuint) + ).Then( + t => t.ScaleTo(1, up_time, EasingTypes.OutQuint), + t => t.FadeOut(up_time, EasingTypes.OutQuint) + ); } return false; From 689866f5dd4ae6a494112296f024e414ca41cd7e Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Jul 2017 20:25:57 +0200 Subject: [PATCH 014/132] minor improvements --- osu.Game/OsuGame.cs | 2 +- osu.Game/Overlays/Profile/ProfileHeader.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 6bec2cb184..13f49b75e6 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -175,7 +175,7 @@ namespace osu.Game LoadComponentAsync(direct = new DirectOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(social = new SocialOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add); - LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -1 }, mainContent.Add); + LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -2 }, mainContent.Add); LoadComponentAsync(settings = new SettingsOverlay { Depth = -1 }, overlayContent.Add); LoadComponentAsync(musicController = new MusicController { diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 17493d5078..d1c3a2178e 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -29,6 +29,7 @@ namespace osu.Game.Overlays.Profile private readonly SpriteText levelText; private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; private readonly Box colourBar; + private readonly DrawableFlag countryFlag; private const float cover_height = 350; private const float info_height = 150; @@ -123,7 +124,7 @@ namespace osu.Game.Overlays.Profile Origin = Anchor.BottomLeft, Y = -48 }, - new DrawableFlag(user.Country?.FlagName ?? "__") + countryFlag = new DrawableFlag(user.Country?.FlagName ?? "__") { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, @@ -350,6 +351,7 @@ namespace osu.Game.Overlays.Profile { infoTextLeft.AddText("from "); infoTextLeft.AddText(user.Country.FullName, boldItalic); + countryFlag.FlagName = user.Country.FlagName; } infoTextLeft.NewParagraph(); @@ -390,7 +392,7 @@ namespace osu.Game.Overlays.Profile scoreText.Add(createScoreText("Ranked Score")); scoreNumberText.Add(createScoreNumberText(user.Statistics.RankedScore.ToString(@"#,0"))); scoreText.Add(createScoreText("Accuracy")); - scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy}%")); + scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy.ToString("0.##")}%")); scoreText.Add(createScoreText("Play Count")); scoreNumberText.Add(createScoreNumberText(user.Statistics.PlayCount.ToString(@"#,0"))); scoreText.Add(createScoreText("Total Score")); From b9eb7a8445e6534a3d3e6c5c5c9c3d6d9f28d92c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Jul 2017 20:26:55 +0200 Subject: [PATCH 015/132] make chat message users open UserProfileOverlay --- osu.Game/Overlays/Chat/ChatLine.cs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 3aaca7593c..c59a589fba 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -8,6 +8,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; namespace osu.Game.Overlays.Chat { @@ -68,6 +69,8 @@ namespace osu.Game.Overlays.Chat private const float message_padding = 200; private const float text_size = 20; + private UserProfileOverlay profileOverlay; + public ChatLine(Message message) { Message = message; @@ -94,15 +97,20 @@ namespace osu.Game.Overlays.Chat TextSize = text_size * 0.75f, Alpha = 0.4f, }, - new OsuSpriteText + new ClickableContainer { - Font = @"Exo2.0-BoldItalic", - Text = $@"{Message.Sender.Username}:", - Colour = getUsernameColour(Message), - TextSize = text_size, + AutoSizeAxes = Axes.Both, Origin = Anchor.TopRight, Anchor = Anchor.TopRight, - } + Child = new OsuSpriteText + { + Font = @"Exo2.0-BoldItalic", + Text = $@"{Message.Sender.Username}:", + Colour = getUsernameColour(Message), + TextSize = text_size, + }, + Action = () => profileOverlay?.ShowUser(Message.Sender), + }, } }, new Container @@ -123,5 +131,11 @@ namespace osu.Game.Overlays.Chat } }; } + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(UserProfileOverlay profileOverlay) + { + this.profileOverlay = profileOverlay; + } } } From edd4e622cf09ec0ddf162fdb2a747bf790b8c4a2 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Jul 2017 20:31:10 +0200 Subject: [PATCH 016/132] add hyper links to twitter, website and skype --- osu.Game/Overlays/Profile/ProfileHeader.cs | 44 ++++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index d1c3a2178e..60ba8a5fd6 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -12,16 +12,19 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; +using System.Diagnostics; namespace osu.Game.Overlays.Profile { public class ProfileHeader : Container { - private readonly OsuTextFlowContainer infoTextLeft, infoTextRight; + private readonly OsuTextFlowContainer infoTextLeft; + private readonly LinkFlowContainer infoTextRight; private readonly FillFlowContainer scoreText, scoreNumberText; private readonly Container coverContainer, chartContainer, supporterTag; @@ -159,7 +162,7 @@ namespace osu.Game.Overlays.Profile ParagraphSpacing = 0.8f, LineSpacing = 0.2f }, - infoTextRight = new OsuTextFlowContainer(t => + infoTextRight = new LinkFlowContainer(t => { t.TextSize = 14; t.Font = @"Exo2.0-RegularItalic"; @@ -380,9 +383,9 @@ namespace osu.Game.Overlays.Profile tryAddInfoRightLine(FontAwesome.fa_suitcase, user.Occupation); infoTextRight.NewParagraph(); if (!string.IsNullOrEmpty(user.Twitter)) - tryAddInfoRightLine(FontAwesome.fa_twitter, "@" + user.Twitter); - tryAddInfoRightLine(FontAwesome.fa_globe, user.Website); - tryAddInfoRightLine(FontAwesome.fa_skype, user.Skype); + tryAddInfoRightLine(FontAwesome.fa_twitter, "@" + user.Twitter, @"http://twitter.com/" + user.Twitter); + tryAddInfoRightLine(FontAwesome.fa_globe, user.Website, user.Website); + tryAddInfoRightLine(FontAwesome.fa_skype, user.Skype, @"skype:" + user.Skype + @"?chat"); if (user.Statistics != null) { @@ -435,12 +438,12 @@ namespace osu.Game.Overlays.Profile Text = text }; - private void tryAddInfoRightLine(FontAwesome icon, string str) + private void tryAddInfoRightLine(FontAwesome icon, string str, string url = null) { if (string.IsNullOrEmpty(str)) return; infoTextRight.AddIcon(icon); - infoTextRight.AddText(" " + str); + infoTextRight.AddLink(" " + str, url); infoTextRight.NewLine(); } @@ -481,5 +484,32 @@ namespace osu.Game.Overlays.Profile badge.Texture = textures.Get($"Grades/{grade}"); } } + + private class LinkFlowContainer : OsuTextFlowContainer + { + public override bool HandleInput => true; + + public LinkFlowContainer(Action defaultCreationParameters = null) : base(defaultCreationParameters) + { + } + + protected override SpriteText CreateSpriteText() => new SpriteLink(); + + public void AddLink(string text, string url) => AddText(text, link => ((SpriteLink)link).Url = url); + + private class SpriteLink : SpriteText + { + public override bool HandleInput => Url != null; + + public string Url; + + protected override bool OnClick(InputState state) + { + Process.Start(Url); + return true; + } + } + + } } } From 80dc8887694a76b93b40739a85d274720ecd8b39 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Jul 2017 21:11:54 +0200 Subject: [PATCH 017/132] address CI concerns --- osu.Game/Overlays/Profile/ProfileHeader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 60ba8a5fd6..c218275c27 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -18,6 +18,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; using System.Diagnostics; +using System.Globalization; namespace osu.Game.Overlays.Profile { @@ -395,7 +396,7 @@ namespace osu.Game.Overlays.Profile scoreText.Add(createScoreText("Ranked Score")); scoreNumberText.Add(createScoreNumberText(user.Statistics.RankedScore.ToString(@"#,0"))); scoreText.Add(createScoreText("Accuracy")); - scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy.ToString("0.##")}%")); + scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy.ToString("0.##", CultureInfo.CurrentCulture)}%")); scoreText.Add(createScoreText("Play Count")); scoreNumberText.Add(createScoreNumberText(user.Statistics.PlayCount.ToString(@"#,0"))); scoreText.Add(createScoreText("Total Score")); From 9c70d03a336d3dacb8998fd38beb66e226fab6d0 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Jul 2017 21:12:50 +0200 Subject: [PATCH 018/132] replace SpriteText with OsuSpriteText --- osu.Game/Overlays/Profile/ProfileHeader.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index c218275c27..4abe991205 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -498,7 +498,7 @@ namespace osu.Game.Overlays.Profile public void AddLink(string text, string url) => AddText(text, link => ((SpriteLink)link).Url = url); - private class SpriteLink : SpriteText + private class SpriteLink : OsuSpriteText { public override bool HandleInput => Url != null; @@ -510,7 +510,6 @@ namespace osu.Game.Overlays.Profile return true; } } - } } } From ae58e181784d1d8a40cd8245376f64472c206e6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jul 2017 10:41:52 +0900 Subject: [PATCH 019/132] Reorder code based on depth (and avoid possible conflicts) --- osu.Game/OsuGame.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 13f49b75e6..4e99a44a07 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -175,11 +175,11 @@ namespace osu.Game LoadComponentAsync(direct = new DirectOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(social = new SocialOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add); - LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -2 }, mainContent.Add); LoadComponentAsync(settings = new SettingsOverlay { Depth = -1 }, overlayContent.Add); + LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -2 }, mainContent.Add); LoadComponentAsync(musicController = new MusicController { - Depth = -2, + Depth = -3, Position = new Vector2(0, Toolbar.HEIGHT), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -187,14 +187,14 @@ namespace osu.Game LoadComponentAsync(notificationManager = new NotificationManager { - Depth = -2, + Depth = -3, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, overlayContent.Add); LoadComponentAsync(dialogOverlay = new DialogOverlay { - Depth = -4, + Depth = -5, }, overlayContent.Add); Logger.NewEntry += entry => @@ -221,7 +221,7 @@ namespace osu.Game LoadComponentAsync(Toolbar = new Toolbar { - Depth = -3, + Depth = -4, OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); }, }, overlayContent.Add); From 4229f933fe155e57f8da2346391c9264dee3db87 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jul 2017 10:51:11 +0900 Subject: [PATCH 020/132] Rename link class, add hover colour --- osu.Game/Overlays/Profile/ProfileHeader.cs | 26 +++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 4abe991205..b3bf2386c7 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -494,21 +494,41 @@ namespace osu.Game.Overlays.Profile { } - protected override SpriteText CreateSpriteText() => new SpriteLink(); + protected override SpriteText CreateSpriteText() => new LinkText(); - public void AddLink(string text, string url) => AddText(text, link => ((SpriteLink)link).Url = url); + public void AddLink(string text, string url) => AddText(text, link => ((LinkText)link).Url = url); - private class SpriteLink : OsuSpriteText + private class LinkText : OsuSpriteText { public override bool HandleInput => Url != null; public string Url; + private Color4 hoverColour; + + protected override bool OnHover(InputState state) + { + FadeColour(hoverColour, 500, EasingTypes.OutQuint); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + FadeColour(Color4.White, 500, EasingTypes.OutQuint); + base.OnHoverLost(state); + } + protected override bool OnClick(InputState state) { Process.Start(Url); return true; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + hoverColour = colours.Yellow; + } } } } From ed793328f1fe386d6b537a28b348e3a92993771a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 18 Jul 2017 15:20:00 +0300 Subject: [PATCH 021/132] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index b932ddd4fe..adf23f8395 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit b932ddd4fe5cf38dd3e96760741c98eed92a3e36 +Subproject commit adf23f83954461d912f3ef0c2170a031d436a55d From b40c897dbd7d224bef22642d9db202b7e4f4dbd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 18 Jul 2017 15:28:56 +0300 Subject: [PATCH 022/132] Fix osu logo shockwave playing when transition is aborted This is a very nice use-case scenario for TransformSequence.OnComplete --- osu.Game/Screens/Menu/ButtonSystem.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 87f8e32abd..7ff514203e 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -250,15 +250,13 @@ namespace osu.Game.Screens.Menu case MenuState.TopLevel: buttonAreaBackground.ScaleTo(Vector2.One, 200, EasingTypes.Out); - osuLogo.ClearTransforms(); osuLogo.MoveTo(buttonFlow.DrawPosition, 200, EasingTypes.In); - osuLogo.ScaleTo(0.5f, 200, EasingTypes.In); - - buttonArea.FadeIn(300); + var sequence = osuLogo.ScaleTo(0.5f, 200, EasingTypes.In); if (fromInitial && osuLogo.Scale.X > 0.5f) - using (osuLogo.BeginDelayedSequence(200, true)) - osuLogo.Impact(); + sequence.OnComplete(o => o.Impact()); + + buttonArea.FadeIn(300); Scheduler.AddDelayed(() => toolbar?.Show(), 150); From 3ba119c115ab895f607b8657228dfb8078220a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 18 Jul 2017 17:09:53 +0300 Subject: [PATCH 023/132] Ensure toolbar disappears when osu logo transition is cancelled --- osu.Game/Screens/Menu/ButtonSystem.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 7ff514203e..cd0d51b15e 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -224,12 +224,11 @@ namespace osu.Game.Screens.Menu { case MenuState.Exit: case MenuState.Initial: - toolbar?.Hide(); - buttonAreaBackground.ScaleTo(Vector2.One, 500, EasingTypes.Out); buttonArea.FadeOut(300); osuLogo.Delay(150) + .Schedule(() => toolbar?.Hide()) .ScaleTo(1, 800, EasingTypes.OutExpo) .MoveTo(Vector2.Zero, 800, EasingTypes.OutExpo); @@ -250,16 +249,19 @@ namespace osu.Game.Screens.Menu case MenuState.TopLevel: buttonAreaBackground.ScaleTo(Vector2.One, 200, EasingTypes.Out); - osuLogo.MoveTo(buttonFlow.DrawPosition, 200, EasingTypes.In); - var sequence = osuLogo.ScaleTo(0.5f, 200, EasingTypes.In); + var sequence = osuLogo + .ScaleTo(0.5f, 200, EasingTypes.In) + .MoveTo(buttonFlow.DrawPosition, 200, EasingTypes.In); if (fromInitial && osuLogo.Scale.X > 0.5f) - sequence.OnComplete(o => o.Impact()); + sequence.OnComplete(o => + { + o.Impact(); + toolbar?.Show(); + }); buttonArea.FadeIn(300); - Scheduler.AddDelayed(() => toolbar?.Show(), 150); - foreach (Button b in buttonsTopLevel) b.State = ButtonState.Expanded; From 2eccb3822a1d26ab04bb85af15cb2b211e4fe0e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jul 2017 11:07:52 +0900 Subject: [PATCH 024/132] Make link text not suck --- osu.Game/Overlays/Profile/ProfileHeader.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index b3bf2386c7..7888b87ac4 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -379,13 +379,21 @@ namespace osu.Game.Overlays.Profile infoTextLeft.AddText(string.Join(", ", user.PlayStyle), boldItalic); } + string websiteWithoutProtcol = user.Website; + if (!string.IsNullOrEmpty(websiteWithoutProtcol)) + { + int protocolIndex = websiteWithoutProtcol.IndexOf("//", StringComparison.Ordinal); + if (protocolIndex >= 0) + websiteWithoutProtcol = websiteWithoutProtcol.Substring(protocolIndex + 2); + } + tryAddInfoRightLine(FontAwesome.fa_map_marker, user.Location); tryAddInfoRightLine(FontAwesome.fa_heart_o, user.Intrerests); tryAddInfoRightLine(FontAwesome.fa_suitcase, user.Occupation); infoTextRight.NewParagraph(); if (!string.IsNullOrEmpty(user.Twitter)) - tryAddInfoRightLine(FontAwesome.fa_twitter, "@" + user.Twitter, @"http://twitter.com/" + user.Twitter); - tryAddInfoRightLine(FontAwesome.fa_globe, user.Website, user.Website); + tryAddInfoRightLine(FontAwesome.fa_twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}"); + tryAddInfoRightLine(FontAwesome.fa_globe, websiteWithoutProtcol, user.Website); tryAddInfoRightLine(FontAwesome.fa_skype, user.Skype, @"skype:" + user.Skype + @"?chat"); if (user.Statistics != null) From 2c5019ff7c3f5becc059f1b81107d2c0dd7456f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Jul 2017 18:22:46 +0900 Subject: [PATCH 025/132] Forward action in saner way --- osu.Game/Overlays/Chat/ChatLine.cs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 1756c640b0..c08e62428b 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; @@ -11,6 +12,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics.Effects; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Allocation; +using osu.Game.Users; namespace osu.Game.Overlays.Chat { @@ -62,7 +64,8 @@ namespace osu.Game.Overlays.Chat private const float message_padding = 200; private const float text_size = 20; - private UserProfileOverlay profileOverlay; + private Action loadProfile; + private Color4 customUsernameColour; public ChatLine(Message message) @@ -76,9 +79,10 @@ namespace osu.Game.Overlays.Chat } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, UserProfileOverlay profile) { customUsernameColour = colours.ChatBlue; + loadProfile = u => profile?.ShowUser(u); } protected override void LoadComplete() @@ -88,8 +92,6 @@ namespace osu.Game.Overlays.Chat bool hasBackground = !string.IsNullOrEmpty(Message.Sender.Colour); Drawable username = new OsuSpriteText { - Origin = Anchor.TopRight, - Anchor = Anchor.TopRight, Font = @"Exo2.0-BoldItalic", Text = $@"{Message.Sender.Username}" + (hasBackground ? "" : ":"), Colour = hasBackground ? customUsernameColour : username_colours[Message.UserId % username_colours.Length], @@ -133,7 +135,7 @@ namespace osu.Game.Overlays.Chat new Container { Size = new Vector2(message_padding, text_size), - Children = new[] + Children = new Drawable[] { new OsuSpriteText { @@ -150,8 +152,8 @@ namespace osu.Game.Overlays.Chat AutoSizeAxes = Axes.Both, Origin = Anchor.TopRight, Anchor = Anchor.TopRight, - Child = username - Action = () => profileOverlay?.ShowUser(Message.Sender), + Child = username, + Action = () => loadProfile(Message.Sender), }, } }, @@ -173,11 +175,5 @@ namespace osu.Game.Overlays.Chat } }; } - - [BackgroundDependencyLoader(permitNulls: true)] - private void load(UserProfileOverlay profileOverlay) - { - this.profileOverlay = profileOverlay; - } } } From d75e439f94c95b076e98c387c9c92ab13efee4b1 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Jul 2017 01:27:27 +0930 Subject: [PATCH 026/132] Fix Player crashing due to null BeatmapInfo (now unused). --- osu.Game/Screens/Play/Player.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7bd310e168..4b04b3b2ea 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,8 +35,6 @@ namespace osu.Game.Screens.Play internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && HitRenderer.ProvidingUserCursor; - public BeatmapInfo BeatmapInfo; - public Action RestartRequested; internal override bool AllowBeatmapRulesetChange => false; @@ -85,7 +83,7 @@ namespace osu.Game.Screens.Play { if (!Beatmap.Value.WithStoryboard) // we need to ensure the storyboard is loaded. - Beatmap.Value = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true); + Beatmap.Value = beatmaps.GetWorkingBeatmap(Beatmap.Value.BeatmapInfo, withStoryboard: true); if (Beatmap.Value.Beatmap == null) throw new InvalidOperationException("Beatmap was not loaded"); From b016103894ab3872815326942f9f8e2532a45023 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 20 Jul 2017 01:03:00 +0200 Subject: [PATCH 027/132] add link to user page --- osu.Game/Overlays/Profile/ProfileHeader.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 7888b87ac4..a636bd5a21 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -19,6 +19,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Users; using System.Diagnostics; using System.Globalization; +using osu.Framework.Graphics.Cursor; namespace osu.Game.Overlays.Profile { @@ -119,9 +120,10 @@ namespace osu.Game.Overlays.Profile } } }, - new OsuSpriteText + new LinkFlowContainer.LinkText { Text = user.Username, + Url = $@"https://osu.ppy.sh/users/{user.Id}", TextSize = 30, Font = @"Exo2.0-RegularItalic", Anchor = Anchor.BottomLeft, @@ -506,7 +508,7 @@ namespace osu.Game.Overlays.Profile public void AddLink(string text, string url) => AddText(text, link => ((LinkText)link).Url = url); - private class LinkText : OsuSpriteText + public class LinkText : OsuSpriteText { public override bool HandleInput => Url != null; From e0fb2563b590620d094a4daa98930a32c5b000f9 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 20 Jul 2017 01:08:26 +0200 Subject: [PATCH 028/132] remove using --- osu.Game/Overlays/Profile/ProfileHeader.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index a636bd5a21..21bfd5afd6 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -19,7 +19,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Users; using System.Diagnostics; using System.Globalization; -using osu.Framework.Graphics.Cursor; namespace osu.Game.Overlays.Profile { From fd518e2294823091f36a4f7dab3e567f492ae322 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Thu, 20 Jul 2017 01:57:46 +0200 Subject: [PATCH 029/132] Don't start a beatmap's track until the intro is done playing --- osu.Game/Screens/Menu/Intro.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 4ab157db05..aeb5282666 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -121,7 +121,9 @@ namespace osu.Game.Screens.Menu Scheduler.AddDelayed(delegate { - track.Start(); + // Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Manu. + if (menuMusic) + track.Start(); LoadComponentAsync(mainMenu = new MainMenu()); From d69470f2ae24619e343bfbe37e421504d76755dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 09:22:39 +0900 Subject: [PATCH 030/132] Fix TestWorkingBeatmap broken by attempting to load storyboard --- osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 9 ++++++--- osu.Game/Database/DatabaseWorkingBeatmap.cs | 6 +++--- osu.Game/Screens/Play/Player.cs | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs index b45574b761..580e062aaf 100644 --- a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs @@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Beatmaps public class TestWorkingBeatmap : WorkingBeatmap { public TestWorkingBeatmap(Beatmap beatmap) - : base(beatmap.BeatmapInfo) + : base(beatmap.BeatmapInfo, true) { this.beatmap = beatmap; } diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 0e8d8a9546..0362d06c66 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -22,14 +22,17 @@ namespace osu.Game.Beatmaps public readonly Bindable> Mods = new Bindable>(new Mod[] { }); - public readonly bool WithStoryboard; + /// + /// Denotes whether extras like storyboards have been loaded for this . + /// + public bool FullyLoaded { get; protected set; } - protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool withStoryboard = false) + protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool fullyLoaded = false) { BeatmapInfo = beatmapInfo; BeatmapSetInfo = beatmapInfo.BeatmapSet; Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata; - WithStoryboard = withStoryboard; + FullyLoaded = fullyLoaded; Mods.ValueChanged += mods => applyRateAdjustments(); } diff --git a/osu.Game/Database/DatabaseWorkingBeatmap.cs b/osu.Game/Database/DatabaseWorkingBeatmap.cs index 2acae9c340..01a8509c3e 100644 --- a/osu.Game/Database/DatabaseWorkingBeatmap.cs +++ b/osu.Game/Database/DatabaseWorkingBeatmap.cs @@ -14,8 +14,8 @@ namespace osu.Game.Database { private readonly BeatmapDatabase database; - public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool withStoryboard = false) - : base(beatmapInfo, withStoryboard) + public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool fullyLoaded = false) + : base(beatmapInfo, fullyLoaded) { this.database = database; } @@ -37,7 +37,7 @@ namespace osu.Game.Database beatmap = decoder.Decode(stream); } - if (beatmap == null || !WithStoryboard || BeatmapSetInfo.StoryboardFile == null) + if (beatmap == null || !FullyLoaded || BeatmapSetInfo.StoryboardFile == null) return beatmap; using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile))) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4b04b3b2ea..40f24a77c9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -81,8 +81,8 @@ namespace osu.Game.Screens.Play try { - if (!Beatmap.Value.WithStoryboard) - // we need to ensure the storyboard is loaded. + if (!Beatmap.Value.FullyLoaded) + // we need to ensure extras like storyboards are loaded. Beatmap.Value = beatmaps.GetWorkingBeatmap(Beatmap.Value.BeatmapInfo, withStoryboard: true); if (Beatmap.Value.Beatmap == null) From 8d727b898f36cdc081fb27e2fe89b8dd09f80b45 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 09:23:11 +0900 Subject: [PATCH 031/132] Don't rely on BeatmapSetInfo being present --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index d28a84217b..ea012f45e4 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -189,7 +189,7 @@ namespace osu.Game.Screens.Select private void carouselBeatmapsLoaded() { - if (Beatmap.Value != null && !Beatmap.Value.BeatmapSetInfo.DeletePending) + if (Beatmap.Value != null && Beatmap.Value.BeatmapSetInfo?.DeletePending != false) carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false); else carousel.SelectNext(); From d6968ca09cf0d8137034768266da2ee5a6b7ff05 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 11:01:50 +0900 Subject: [PATCH 032/132] Remove FullyLoaded logic Always parse storyboards for now. Let's not optimise this until it is necessary. It was leading to weird threading problems due to the load call in Player's async load method. --- osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 8 +------- osu.Game/Database/BeatmapDatabase.cs | 2 +- osu.Game/Database/DatabaseWorkingBeatmap.cs | 6 +++--- osu.Game/Screens/Play/Player.cs | 6 +----- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs index 580e062aaf..b45574b761 100644 --- a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs @@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Beatmaps public class TestWorkingBeatmap : WorkingBeatmap { public TestWorkingBeatmap(Beatmap beatmap) - : base(beatmap.BeatmapInfo, true) + : base(beatmap.BeatmapInfo) { this.beatmap = beatmap; } diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 0362d06c66..4dd624c14e 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -22,17 +22,11 @@ namespace osu.Game.Beatmaps public readonly Bindable> Mods = new Bindable>(new Mod[] { }); - /// - /// Denotes whether extras like storyboards have been loaded for this . - /// - public bool FullyLoaded { get; protected set; } - - protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool fullyLoaded = false) + protected WorkingBeatmap(BeatmapInfo beatmapInfo) { BeatmapInfo = beatmapInfo; BeatmapSetInfo = beatmapInfo.BeatmapSet; Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata; - FullyLoaded = fullyLoaded; Mods.ValueChanged += mods => applyRateAdjustments(); } diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index b31b71a728..84a7096da4 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -291,7 +291,7 @@ namespace osu.Game.Database if (beatmapInfo.Metadata == null) beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; - WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo, withStoryboard); + WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo); previous?.TransferTo(working); diff --git a/osu.Game/Database/DatabaseWorkingBeatmap.cs b/osu.Game/Database/DatabaseWorkingBeatmap.cs index 01a8509c3e..25944faa42 100644 --- a/osu.Game/Database/DatabaseWorkingBeatmap.cs +++ b/osu.Game/Database/DatabaseWorkingBeatmap.cs @@ -14,8 +14,8 @@ namespace osu.Game.Database { private readonly BeatmapDatabase database; - public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool fullyLoaded = false) - : base(beatmapInfo, fullyLoaded) + public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo) + : base(beatmapInfo) { this.database = database; } @@ -37,7 +37,7 @@ namespace osu.Game.Database beatmap = decoder.Decode(stream); } - if (beatmap == null || !FullyLoaded || BeatmapSetInfo.StoryboardFile == null) + if (beatmap == null || BeatmapSetInfo.StoryboardFile == null) return beatmap; using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile))) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 40f24a77c9..1711ee027a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Play private bool loadedSuccessfully => HitRenderer?.Objects.Any() == true; [BackgroundDependencyLoader(permitNulls: true)] - private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu) + private void load(AudioManager audio, OsuConfigManager config, OsuGame osu) { dimLevel = config.GetBindable(OsuSetting.DimLevel); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); @@ -81,10 +81,6 @@ namespace osu.Game.Screens.Play try { - if (!Beatmap.Value.FullyLoaded) - // we need to ensure extras like storyboards are loaded. - Beatmap.Value = beatmaps.GetWorkingBeatmap(Beatmap.Value.BeatmapInfo, withStoryboard: true); - if (Beatmap.Value.Beatmap == null) throw new InvalidOperationException("Beatmap was not loaded"); From 15eb6954da6d41f0f451a9528af8e4be887f966e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 11:50:31 +0900 Subject: [PATCH 033/132] Fix hitting down and enter at song select causing a hard-crash Carousel was not aware of the disabled beatmap change state. Also it was being set too late (in an async load) so wasn't useful. It's now pre-emptively set in PlaySongSelect before loading Player. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 4 ++++ osu.Game/Screens/Select/PlaySongSelect.cs | 1 + osu.Game/Screens/Select/SongSelect.cs | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index e135fefc6d..90b9808da5 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -25,6 +25,8 @@ namespace osu.Game.Screens.Select { public BeatmapInfo SelectedBeatmap => selectedPanel?.Beatmap; + public override bool HandleInput => AllowSelection; + public Action BeatmapsChanged; public IEnumerable Beatmaps @@ -228,6 +230,8 @@ namespace osu.Game.Screens.Select private ScheduledDelegate filterTask; + public bool AllowSelection = true; + public void Filter(FilterCriteria newCriteria = null, bool debounce = true) { if (newCriteria != null) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 51f570e901..e393caf931 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -105,6 +105,7 @@ namespace osu.Game.Screens.Select if (player != null) return; Beatmap.Value.Track.Looping = false; + Beatmap.Disabled = true; LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player)); } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index ea012f45e4..0d0b15d91e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -110,7 +110,7 @@ namespace osu.Game.Screens.Select Origin = Anchor.CentreRight, SelectionChanged = carouselSelectionChanged, BeatmapsChanged = carouselBeatmapsLoaded, - StartRequested = carouselRaisedStart + StartRequested = carouselRaisedStart, }); Add(FilterControl = new FilterControl { @@ -185,6 +185,9 @@ namespace osu.Game.Screens.Select carousel.Beatmaps = database.GetAllWithChildren(b => !b.DeletePending); Beatmap.ValueChanged += beatmap_ValueChanged; + + Beatmap.DisabledChanged += disabled => carousel.AllowSelection = !disabled; + carousel.AllowSelection = !Beatmap.Disabled; } private void carouselBeatmapsLoaded() From c13098118478568718f64d72df1b32a76d213392 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 14:05:42 +0900 Subject: [PATCH 034/132] Fix WorkingBeatmap being loaded twice when using MusicController at SongSelect --- osu.Game/Screens/Select/SongSelect.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index ea012f45e4..4f6f1a5c76 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -221,11 +221,16 @@ namespace osu.Game.Screens.Select { Action performLoad = delegate { - bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID; + // We may be arriving here due to another component changing the bindable Beatmap. + // In these cases, the other component has already loaded the beatmap, so we don't need to do so again. + if (!beatmap.Equals(Beatmap.Value.BeatmapInfo)) + { + bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID; - Beatmap.Value = database.GetWorkingBeatmap(beatmap, Beatmap); + Beatmap.Value = database.GetWorkingBeatmap(beatmap, Beatmap); + ensurePlayingSelected(preview); + } - ensurePlayingSelected(preview); changeBackground(Beatmap.Value); }; From a59557f03926159ba379e8a77df19cdf892a9894 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 15:12:20 +0900 Subject: [PATCH 035/132] Fix selection not being reset correct when changing between rulesets Carousels filtered to results with no maps visible were not being handled correctly in a few different ways. This covers all those scenarios. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index e135fefc6d..d2984ec2ae 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -133,7 +133,7 @@ namespace osu.Game.Screens.Select public void SelectNext(int direction = 1, bool skipDifficulties = true) { - if (groups.Count == 0) + if (groups.Count == 0 || groups.All(g => g.State == BeatmapGroupState.Hidden)) { selectedGroup = null; selectedPanel = null; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index ea012f45e4..15bdc08eea 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -229,6 +229,13 @@ namespace osu.Game.Screens.Select changeBackground(Beatmap.Value); }; + selectionChangedDebounce?.Cancel(); + + if (beatmap?.Equals(beatmapNoDebounce) == true) + return; + + beatmapNoDebounce = beatmap; + if (beatmap == null) { if (!Beatmap.IsDefault) @@ -236,18 +243,11 @@ namespace osu.Game.Screens.Select } else { - selectionChangedDebounce?.Cancel(); - - if (beatmap.Equals(beatmapNoDebounce)) - return; - if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); else sampleChangeBeatmap.Play(); - beatmapNoDebounce = beatmap; - if (beatmap == Beatmap.Value.BeatmapInfo) performLoad(); else From 61c665f239b3ca57364954ae7e2213205838371a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 15:16:07 +0900 Subject: [PATCH 036/132] Add required null check --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 4f6f1a5c76..e3e588c000 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -223,7 +223,7 @@ namespace osu.Game.Screens.Select { // We may be arriving here due to another component changing the bindable Beatmap. // In these cases, the other component has already loaded the beatmap, so we don't need to do so again. - if (!beatmap.Equals(Beatmap.Value.BeatmapInfo)) + if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true) { bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID; From 4f102561827c17d98d7fc4a27a40e401f2a217cc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 15:34:44 +0900 Subject: [PATCH 037/132] Remove unnecessary count check --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index d2984ec2ae..b5855fe0e0 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -133,7 +133,7 @@ namespace osu.Game.Screens.Select public void SelectNext(int direction = 1, bool skipDifficulties = true) { - if (groups.Count == 0 || groups.All(g => g.State == BeatmapGroupState.Hidden)) + if (groups.All(g => g.State == BeatmapGroupState.Hidden)) { selectedGroup = null; selectedPanel = null; From 67b95926c4b79ac727009f22d23b970cfb5ef142 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 16:45:44 +0900 Subject: [PATCH 038/132] Remove usage of SetExclusive Also immediately disposes WorkingBeatmaps on ValueChanged. --- osu-framework | 2 +- osu.Game/OsuGameBase.cs | 11 +++++++++++ osu.Game/Overlays/Music/PlaylistOverlay.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/osu-framework b/osu-framework index 6b44a9f807..a7edf9bb3b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 6b44a9f807fadcb3b3f044780d7e27d62ffe80ac +Subproject commit a7edf9bb3bae6908f316ba0ee9dacdbbb66e8c19 diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 939c4a4915..99b015dd79 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -133,9 +133,20 @@ namespace osu.Game Token = LocalConfig.Get(OsuSetting.Token) }); + Beatmap.ValueChanged += b => + { + // this disposal is done to stop the audio track. + // it may not be exactly what we want for cases beatmaps are reused, as it will + // trigger a fresh load of contained resources. + lastBeatmap?.Dispose(); + lastBeatmap = b; + }; + API.Register(this); } + private WorkingBeatmap lastBeatmap; + public void APIStateChanged(APIAccess api, APIState state) { switch (state) diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 87c0afebf7..e936fa6209 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Music Task.Run(() => { var track = beatmapBacking.Value.Track; - trackManager.SetExclusive(track); + trackManager.AddItem(track); track.Start(); }).ContinueWith(task => Schedule(task.ThrowIfFaulted), TaskContinuationOptions.OnlyOnFaulted); } diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index aeb5282666..0998a4e64c 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Menu Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); track = Beatmap.Value.Track; - trackManager.SetExclusive(track); + trackManager.AddItem(track); welcome = audio.Sample.Get(@"welcome"); seeya = audio.Sample.Get(@"seeya"); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 40f24a77c9..ea163bca3a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -120,7 +120,7 @@ namespace osu.Game.Screens.Play if (track != null) { - audio.Track.SetExclusive(track); + audio.Track.AddItem(track); adjustableSourceClock = track; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index ea012f45e4..7e50ab6e2b 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -358,7 +358,7 @@ namespace osu.Game.Screens.Select { Track track = Beatmap.Value.Track; - trackManager.SetExclusive(track); + trackManager.AddItem(track); if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime); track.Start(); From 3bdd4d7d02aa19162e941bbada7632878a6a7dc8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 17:46:23 +0900 Subject: [PATCH 039/132] Centralise TrackManager.AddItem logic to avoid duplicate adds --- osu.Game/OsuGameBase.cs | 15 +++++++++++---- osu.Game/Overlays/Music/PlaylistOverlay.cs | 13 +------------ osu.Game/Screens/Menu/Intro.cs | 3 --- osu.Game/Screens/Play/Player.cs | 3 --- osu.Game/Screens/Select/SongSelect.cs | 11 +++++------ 5 files changed, 17 insertions(+), 28 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 99b015dd79..7a2d91d733 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -135,10 +135,17 @@ namespace osu.Game Beatmap.ValueChanged += b => { - // this disposal is done to stop the audio track. - // it may not be exactly what we want for cases beatmaps are reused, as it will - // trigger a fresh load of contained resources. - lastBeatmap?.Dispose(); + // compare to last baetmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo) + if (lastBeatmap?.Track != b.Track) + { + // this disposal is done to stop the audio track. + // it may not be exactly what we want for cases beatmaps are reused, as it will + // trigger a fresh load of contained resources. + lastBeatmap?.Dispose(); + + Audio.Track.AddItem(b.Track); + } + lastBeatmap = b; }; diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index e936fa6209..1e4c3c5ff6 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -3,9 +3,7 @@ using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using osu.Framework.Allocation; -using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -15,7 +13,6 @@ using osu.Game.Database; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; -using osu.Framework.Extensions; using osu.Framework.Input; using osu.Framework.Graphics.Shapes; @@ -30,7 +27,6 @@ namespace osu.Game.Overlays.Music private FilterControl filter; private PlaylistList list; - private TrackManager trackManager; private BeatmapDatabase beatmaps; private readonly Bindable beatmapBacking = new Bindable(); @@ -43,7 +39,6 @@ namespace osu.Game.Overlays.Music { this.inputManager = inputManager; this.beatmaps = beatmaps; - trackManager = game.Audio.Track; Children = new Drawable[] { @@ -154,13 +149,7 @@ namespace osu.Game.Overlays.Music private void playSpecified(BeatmapInfo info) { beatmapBacking.Value = beatmaps.GetWorkingBeatmap(info, beatmapBacking); - - Task.Run(() => - { - var track = beatmapBacking.Value.Track; - trackManager.AddItem(track); - track.Start(); - }).ContinueWith(task => Schedule(task.ThrowIfFaulted), TaskContinuationOptions.OnlyOnFaulted); + beatmapBacking.Value.Track.Start(); } } diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 0998a4e64c..6e42a1bae9 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -72,8 +72,6 @@ namespace osu.Game.Screens.Menu menuVoice = config.GetBindable(OsuSetting.MenuVoice); menuMusic = config.GetBindable(OsuSetting.MenuMusic); - var trackManager = audio.Track; - BeatmapSetInfo setInfo = null; if (!menuMusic) @@ -106,7 +104,6 @@ namespace osu.Game.Screens.Menu Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); track = Beatmap.Value.Track; - trackManager.AddItem(track); welcome = audio.Sample.Get(@"welcome"); seeya = audio.Sample.Get(@"seeya"); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index ea163bca3a..4bbb47d419 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -119,10 +119,7 @@ namespace osu.Game.Screens.Play Track track = Beatmap.Value.Track; if (track != null) - { - audio.Track.AddItem(track); adjustableSourceClock = track; - } adjustableSourceClock = (IAdjustableClock)track ?? new StopwatchClock(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 7e50ab6e2b..40cf586c06 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -32,7 +32,6 @@ namespace osu.Game.Screens.Select protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(); private readonly BeatmapCarousel carousel; - private TrackManager trackManager; private DialogOverlay dialogOverlay; private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245); @@ -174,7 +173,6 @@ namespace osu.Game.Screens.Select database.BeatmapSetAdded += onBeatmapSetAdded; database.BeatmapSetRemoved += onBeatmapSetRemoved; - trackManager = audio.Track; dialogOverlay = dialog; sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty"); @@ -358,10 +356,11 @@ namespace osu.Game.Screens.Select { Track track = Beatmap.Value.Track; - trackManager.AddItem(track); - - if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime); - track.Start(); + if (!track.IsRunning) + { + if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime); + track.Start(); + } } private void removeBeatmapSet(BeatmapSetInfo beatmapSet) From 577740d32985fec1c3d44c37d6d16cc420723a59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 18:07:51 +0900 Subject: [PATCH 040/132] Fix footer button light fading incorrectly Logic was reliant on HoverLost coming before Hover events, which has since changed. Was also able to tidy this code up a bit in the process. --- osu.Game/Screens/Select/Footer.cs | 39 +++++++++++++------------------ 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index ddb808c5e4..33252f78f8 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; @@ -31,7 +32,7 @@ namespace osu.Game.Screens.Select public Action OnBack; public Action OnStart; - private readonly FillFlowContainer buttons; + private readonly FillFlowContainer buttons; public OsuLogo StartButton; @@ -43,29 +44,21 @@ namespace osu.Game.Screens.Select /// Higher depth to be put on the left, and lower to be put on the right. /// Notice this is different to ! /// - public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, float depth = 0) + public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, float depth = 0) => buttons.Add(new FooterButton { - var button = new FooterButton - { - Text = text, - Height = play_song_select_button_height, - Width = play_song_select_button_width, - Depth = depth, - SelectedColour = colour, - DeselectedColour = colour.Opacity(0.5f), - Hotkey = hotkey, - }; + Text = text, + Height = play_song_select_button_height, + Width = play_song_select_button_width, + Depth = depth, + SelectedColour = colour, + DeselectedColour = colour.Opacity(0.5f), + Hotkey = hotkey, + Hovered = updateModeLight, + HoverLost = updateModeLight, + Action = action, + }); - button.Hovered = () => updateModeLight(button); - button.HoverLost = () => updateModeLight(); - button.Action = action; - buttons.Add(button); - } - - private void updateModeLight(FooterButton button = null) - { - modeLight.FadeColour(button?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, EasingTypes.OutQuint); - } + private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, EasingTypes.OutQuint); public Footer() { @@ -111,7 +104,7 @@ namespace osu.Game.Screens.Select Spacing = new Vector2(padding, 0), Children = new Drawable[] { - buttons = new FillFlowContainer + buttons = new FillFlowContainer { Direction = FillDirection.Horizontal, Spacing = new Vector2(0.2f, 0), From 6e0b7b81f8de1ae95b6d78ddde7afc665c232bb6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 19:10:20 +0900 Subject: [PATCH 041/132] Switch to correct ruleset when changing beatmap This is only really noticeable when using the MusicController to change tracks while at song select. --- osu.Game/Screens/Select/SongSelect.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 15bdc08eea..4ecbd91b11 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -243,6 +243,8 @@ namespace osu.Game.Screens.Select } else { + ruleset.Value = beatmap.Ruleset; + if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); else From b25188895b168bcaa1eb19494559c388eab9fd2d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jul 2017 19:32:17 +0900 Subject: [PATCH 042/132] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index a7edf9bb3b..2d2e2fe698 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit a7edf9bb3bae6908f316ba0ee9dacdbbb66e8c19 +Subproject commit 2d2e2fe698ab32d80d5e856f52c8c398ceb35540 From 22f3e97241e88310c4a9a760088bfd6a77380bf8 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Thu, 20 Jul 2017 17:15:39 +0200 Subject: [PATCH 043/132] Small optimization to the main menu intro seeking. --- osu.Game/Screens/Menu/MainMenu.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index df9b304a47..def9c13c10 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -94,9 +94,7 @@ namespace osu.Game.Screens.Menu { if (!track.IsRunning) { - track.Seek(metadata.PreviewTime); - if (metadata.PreviewTime == -1) - track.Seek(track.Length * 0.4f); + track.Seek(metadata.PreviewTime != -1 ? metadata.PreviewTime : 0.4f * track.Length); track.Start(); } } From fb2f1224b315a77adce9b2270f33a636601965e9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Jul 2017 05:58:58 +0900 Subject: [PATCH 044/132] Fix carousel filter debounce causing a race condition Clicking a ruleset button on toolbar would schedule a delayed filter of carousel, which could in turn trigger a beatmap change after pushing a Player. This resolves that by forcing any pending operations to complete. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 4 ++++ osu.Game/Screens/Select/SongSelect.cs | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 0dc5d8074d..96069d8d18 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -232,6 +232,8 @@ namespace osu.Game.Screens.Select public bool AllowSelection = true; + public bool PendingFilter => filterTask?.Completed == false; + public void Filter(FilterCriteria newCriteria = null, bool debounce = true) { if (newCriteria != null) @@ -263,6 +265,8 @@ namespace osu.Game.Screens.Select }; filterTask?.Cancel(); + filterTask = null; + if (debounce) filterTask = Scheduler.AddDelayed(perform, 250); else diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9e1d230124..59bbb3b3e9 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -198,13 +198,16 @@ namespace osu.Game.Screens.Select private void carouselRaisedStart() { - var pendingSelection = selectionChangedDebounce; - selectionChangedDebounce = null; + if (carousel.PendingFilter) + // if we have a pending filter operation, we want to run it now. + // it could change selection (ie. if the ruleset has been changed). + carousel.Filter(null, false); - if (pendingSelection?.Completed == false) + if (selectionChangedDebounce?.Completed == false) { - pendingSelection.RunTask(); - pendingSelection.Cancel(); // cancel the already scheduled task. + selectionChangedDebounce.RunTask(); + selectionChangedDebounce.Cancel(); // cancel the already scheduled task. + selectionChangedDebounce = null; } OnSelected(); From b4dddc98eeedb09a232f36eb84015d06e3684bd0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Jul 2017 06:15:44 +0900 Subject: [PATCH 045/132] Fix selection changing on entering song select Conditional was backwards, easy fix. --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9e1d230124..90057cf638 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -190,7 +190,7 @@ namespace osu.Game.Screens.Select private void carouselBeatmapsLoaded() { - if (Beatmap.Value != null && Beatmap.Value.BeatmapSetInfo?.DeletePending != false) + if (Beatmap.Value.BeatmapSetInfo?.DeletePending == false) carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false); else carousel.SelectNext(); From f7b64a458a33fa862fe63b7763acf213f840bddf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Jul 2017 10:08:39 +0900 Subject: [PATCH 046/132] Fix incorrect end time calculation in SongProgressGraph --- osu.Game/Screens/Play/SongProgressGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 9251ca33a4..541065e532 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Play return; var firstHit = objects.First().StartTime; - var lastHit = (objects.Last() as IHasEndTime)?.EndTime ?? 0; + var lastHit = objects.Max(o => (o as IHasEndTime)?.EndTime ?? o.StartTime); if (lastHit == 0) lastHit = objects.Last().StartTime; From 12b6b80d5cd2a85dcca2d714d5b11685e828955d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Jul 2017 17:20:52 +0900 Subject: [PATCH 047/132] Make method to flush filter requests --- osu.Game/Screens/Select/BeatmapCarousel.cs | 6 +++++- osu.Game/Screens/Select/SongSelect.cs | 7 +++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 96069d8d18..b696d637e6 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -232,7 +232,11 @@ namespace osu.Game.Screens.Select public bool AllowSelection = true; - public bool PendingFilter => filterTask?.Completed == false; + public void FlushPendingFilters() + { + if (filterTask?.Completed == false) + Filter(null, false); + } public void Filter(FilterCriteria newCriteria = null, bool debounce = true) { diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 59bbb3b3e9..2b2ba83043 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -198,10 +198,9 @@ namespace osu.Game.Screens.Select private void carouselRaisedStart() { - if (carousel.PendingFilter) - // if we have a pending filter operation, we want to run it now. - // it could change selection (ie. if the ruleset has been changed). - carousel.Filter(null, false); + // if we have a pending filter operation, we want to run it now. + // it could change selection (ie. if the ruleset has been changed). + carousel.FlushPendingFilters(); if (selectionChangedDebounce?.Completed == false) { From 388fcfb295084a5efd47becabb9380f4f3b808c7 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 21 Jul 2017 13:13:53 +0300 Subject: [PATCH 048/132] Make BeatmapCarousel inherit from OsuScrollContainer --- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index b696d637e6..231d2de5de 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -18,10 +18,11 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Threading; using osu.Framework.Configuration; +using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Select { - internal class BeatmapCarousel : ScrollContainer + internal class BeatmapCarousel : OsuScrollContainer { public BeatmapInfo SelectedBeatmap => selectedPanel?.Beatmap; From 270ab5c9870c635d22edc3231f1e6fae02d09f28 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 21 Jul 2017 13:37:22 +0300 Subject: [PATCH 049/132] Allow ChatOverlay resize only if it dragged by the tabs area only --- osu.Game/Overlays/ChatOverlay.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 1f9f7e57ca..04988bf789 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -52,6 +52,7 @@ namespace osu.Game.Overlays private readonly ChatTabControl channelTabs; private readonly Container chatContainer; + private readonly Container tabsArea; private readonly Box chatBackground; private readonly Box tabBackground; @@ -144,7 +145,7 @@ namespace osu.Game.Overlays loading = new LoadingAnimation(), } }, - new Container + tabsArea = new Container { Name = @"tabs area", RelativeSizeAxes = Axes.X, @@ -191,9 +192,12 @@ namespace osu.Game.Overlays } private double startDragChatHeight; + private bool canBeDragged; protected override bool OnDragStart(InputState state) { + canBeDragged = tabsArea.IsHovered; + if (!channelTabs.IsHovered) return base.OnDragStart(state); @@ -203,10 +207,21 @@ namespace osu.Game.Overlays protected override bool OnDrag(InputState state) { - Trace.Assert(state.Mouse.PositionMouseDown != null); + if (canBeDragged) + { + Trace.Assert(state.Mouse.PositionMouseDown != null); - chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; - return base.OnDrag(state); + chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; + return base.OnDrag(state); + } + + return true; + } + + protected override bool OnDragEnd(InputState state) + { + canBeDragged = false; + return base.OnDragEnd(state); } public void APIStateChanged(APIAccess api, APIState state) From 66f816692f61030d23e38f98a491cd39ea0b9f8a Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 21 Jul 2017 13:40:09 +0300 Subject: [PATCH 050/132] Better boolean naming --- osu.Game/Overlays/ChatOverlay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 04988bf789..47920cc234 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -192,11 +192,11 @@ namespace osu.Game.Overlays } private double startDragChatHeight; - private bool canBeDragged; + private bool canBeResized; protected override bool OnDragStart(InputState state) { - canBeDragged = tabsArea.IsHovered; + canBeResized = tabsArea.IsHovered; if (!channelTabs.IsHovered) return base.OnDragStart(state); @@ -207,7 +207,7 @@ namespace osu.Game.Overlays protected override bool OnDrag(InputState state) { - if (canBeDragged) + if (canBeResized) { Trace.Assert(state.Mouse.PositionMouseDown != null); @@ -220,7 +220,7 @@ namespace osu.Game.Overlays protected override bool OnDragEnd(InputState state) { - canBeDragged = false; + canBeResized = false; return base.OnDragEnd(state); } From a7dc8a892b66eeb29f3dd9a7fe50b7a5f028fbf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 21 Jul 2017 17:24:09 +0200 Subject: [PATCH 051/132] Update framework --- osu-framework | 2 +- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs | 2 +- osu.Game/Graphics/UserInterface/RollingCounter.cs | 2 +- osu.Game/Overlays/MedalOverlay.cs | 2 +- osu.Game/Overlays/Music/PlaylistItem.cs | 2 +- osu.Game/Overlays/OnScreenDisplay.cs | 2 +- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- osu.Game/Screens/Play/HUD/ComboCounter.cs | 2 +- osu.Game/Screens/Play/HUD/ModDisplay.cs | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/osu-framework b/osu-framework index 8204403880..d09246eeb0 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 82044038805e640ae4602be2fe4772bf09d23e94 +Subproject commit d09246eeb0e7e30bc31cc017af3847ee09b4df08 diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index e09b6bd997..ca1b44e1c7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected sealed override void UpdateState(ArmedState state) { - Flush(); + FinishTransforms(); 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 68bf1cbcdb..4c5aa36640 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(false, nameof(Alpha)); + background.FinishTransforms(false, nameof(Alpha)); background .FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo) .Then() diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index b9d67d8d6a..1d614b4adb 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void UpdateState(ArmedState state) { var circlePiece = MainPiece as CirclePiece; - circlePiece?.FlashBox.Flush(); + circlePiece?.FlashBox.FinishTransforms(); using (BeginDelayedSequence(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true)) { diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index bc7b49ab6a..1ca25491e9 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, nameof(DisplayedCount)); + FinishTransforms(false, nameof(DisplayedCount)); DisplayedCount = Current; } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index c3825e32b8..a8974866a7 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -247,7 +247,7 @@ namespace osu.Game.Overlays { // if we haven't yet, play out the animation fully drawableMedal.State = DisplayState.Full; - Flush(true); + FinishTransforms(true); return; } diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 2b658e0c54..128dddbce5 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Music if (value == selected) return; selected = value; - Flush(true); + FinishTransforms(true); foreach (SpriteText s in titleSprites) s.FadeColour(Selected ? hoverColour : Color4.White, fade_duration); } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index e6a55800ef..65bef22295 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -260,7 +260,7 @@ namespace osu.Game.Overlays }; updateGlow(); - Flush(true); + FinishTransforms(true); } } } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 21bfd5afd6..aa57816701 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -517,13 +517,13 @@ namespace osu.Game.Overlays.Profile protected override bool OnHover(InputState state) { - FadeColour(hoverColour, 500, EasingTypes.OutQuint); + this.FadeColour(hoverColour, 500, EasingTypes.OutQuint); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - FadeColour(Color4.White, 500, EasingTypes.OutQuint); + this.FadeColour(Color4.White, 500, EasingTypes.OutQuint); base.OnHoverLost(state); } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 7e2c0305a9..ac5ea04ecc 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Backgrounds if (background != null) { newDepth = background.Depth + 1; - background.Flush(); + background.FinishTransforms(); background.FadeOut(250); background.Expire(); } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index cd0d51b15e..65ba555630 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -216,7 +216,7 @@ namespace osu.Game.Screens.Menu bool fromInitial = lastState == MenuState.Initial; if (state == MenuState.TopLevel) - buttonArea.Flush(true); + buttonArea.FinishTransforms(true); using (buttonArea.BeginDelayedSequence(fromInitial ? 150 : 0, true)) { diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index 1bfc7599f7..f37b8fc434 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -169,7 +169,7 @@ namespace osu.Game.Screens.Play.HUD if (!rolling) { - Flush(false, nameof(DisplayedCount)); + FinishTransforms(false, nameof(DisplayedCount)); IsRolling = false; DisplayedCount = prev; diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index f8235e5bcf..e72310f1fe 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Play.HUD else unrankedText.Hide(); - iconsContainer.Flush(); + iconsContainer.FinishTransforms(); iconsContainer.FadeInFromZero(fade_duration, EasingTypes.OutQuint); expand(); using (iconsContainer.BeginDelayedSequence(1200)) From 0f2bcb2904a0e753c47e3c5e246c00f17f9fd6f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 21 Jul 2017 18:23:01 +0200 Subject: [PATCH 052/132] Update framework --- osu-framework | 2 +- .../Objects/Drawables/Pieces/SliderBouncer.cs | 2 +- osu.Game/Graphics/UserInterface/LoadingAnimation.cs | 2 +- osu.Game/Overlays/MedalOverlay.cs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu-framework b/osu-framework index d09246eeb0..69000e416b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit d09246eeb0e7e30bc31cc017af3847ee09b4df08 +Subproject commit 69000e416b7f29a1eaf0aaa7e60f452edb843948 diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs index a15812054f..10d14b5485 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces protected override void LoadComplete() { base.LoadComplete(); - icon.Spin(1000); + icon.Spin(1000, RotationDirection.Clockwise); } public void UpdateProgress(double progress, int repeat) diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs index 5e293eff03..4f348ebb56 100644 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface { base.LoadComplete(); - spinner.Spin(2000); + spinner.Spin(2000, RotationDirection.Clockwise); } private const float transition_duration = 500; diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index a8974866a7..6e9ad3fafe 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -199,8 +199,8 @@ namespace osu.Game.Overlays getSample.Play(); - innerSpin.Spin(20000); - outerSpin.Spin(40000); + innerSpin.Spin(20000, RotationDirection.Clockwise); + outerSpin.Spin(40000, RotationDirection.Clockwise); using (BeginDelayedSequence(200, true)) { From e469a114a6f9ef256c656056883a0111f958948e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 21 Jul 2017 19:03:43 +0200 Subject: [PATCH 053/132] Update dependency caching according to framework --- osu-framework | 2 +- osu.Game/OsuGame.cs | 21 +++++++++++++-------- osu.Game/OsuGameBase.cs | 21 +++++++++++++-------- osu.Game/Screens/Tournament/Drawings.cs | 5 ++++- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/osu-framework b/osu-framework index 2d2e2fe698..a914c8e62b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 2d2e2fe698ab32d80d5e856f52c8c398ceb35540 +Subproject commit a914c8e62b000c2a796116ecd1cb5e1922ac715f diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4e99a44a07..f59bd10dc5 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -80,6 +80,11 @@ namespace osu.Game public void ToggleDirect() => direct.ToggleVisibility(); + private DependencyContainer dependencies; + + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + [BackgroundDependencyLoader] private void load(FrameworkConfigManager frameworkConfig) { @@ -97,7 +102,7 @@ namespace osu.Game Task.Run(() => BeatmapDatabase.Import(paths.ToArray())); } - Dependencies.Cache(this); + dependencies.Cache(this); configRuleset = LocalConfig.GetBindable(OsuSetting.Ruleset); Ruleset.Value = RulesetDatabase.GetRuleset(configRuleset.Value); @@ -207,13 +212,13 @@ namespace osu.Game }); }; - Dependencies.Cache(settings); - Dependencies.Cache(social); - Dependencies.Cache(chat); - Dependencies.Cache(userProfile); - Dependencies.Cache(musicController); - Dependencies.Cache(notificationManager); - Dependencies.Cache(dialogOverlay); + dependencies.Cache(settings); + dependencies.Cache(social); + dependencies.Cache(chat); + dependencies.Cache(userProfile); + dependencies.Cache(musicController); + dependencies.Cache(notificationManager); + dependencies.Cache(dialogOverlay); // ensure both overlays aren't presented at the same time chat.StateChanged += (container, state) => social.State = state == Visibility.Visible ? Visibility.Hidden : social.State; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 7a2d91d733..27ad4f20f9 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -81,21 +81,26 @@ namespace osu.Game Name = @"osu!lazer"; } + private DependencyContainer dependencies; + + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + [BackgroundDependencyLoader] private void load() { - Dependencies.Cache(this); - Dependencies.Cache(LocalConfig); + dependencies.Cache(this); + dependencies.Cache(LocalConfig); SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); - Dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection)); - Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host)); - Dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase)); - Dependencies.Cache(new OsuColour()); + dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection)); + dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host)); + dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase)); + dependencies.Cache(new OsuColour()); //this completely overrides the framework default. will need to change once we make a proper FontStore. - Dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 100 }, true); + dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 100 }, true); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont")); @@ -127,7 +132,7 @@ namespace osu.Game OszArchiveReader.Register(); - Dependencies.Cache(API = new APIAccess + dependencies.Cache(API = new APIAccess { Username = LocalConfig.Get(OsuSetting.Username), Token = LocalConfig.Get(OsuSetting.Token) diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 246fa17e85..78b0940b67 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -47,7 +47,10 @@ namespace osu.Game.Screens.Tournament public ITeamList TeamList; - protected override DependencyContainer CreateLocalDependencies(DependencyContainer parent) => new DependencyContainer(parent); + private DependencyContainer dependencies; + + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); [BackgroundDependencyLoader] private void load(TextureStore textures, Storage storage, DependencyContainer dependencies) From 7549d3a2c4b6e1eeb4fa21f80a8f67e9d1c44dab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 22 Jul 2017 17:18:20 +0900 Subject: [PATCH 054/132] Allow ChatLines to exist without UserProfileOverlay Fixes testcases failing when logged in. --- osu.Game/Overlays/Chat/ChatLine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index c08e62428b..809e771840 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding { Left = padding, Right = padding }; } - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(OsuColour colours, UserProfileOverlay profile) { customUsernameColour = colours.ChatBlue; From 4755529d430a9ec6f131a488dc9ef5d598bb31bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 22 Jul 2017 10:48:15 +0200 Subject: [PATCH 055/132] Minor refactor of TestCaseBeatSyncedContainer --- osu-framework | 2 +- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/osu-framework b/osu-framework index 69000e416b..80850a0949 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 69000e416b7f29a1eaf0aaa7e60f452edb843948 +Subproject commit 80850a09494e5f2df3e41c37a1e17af55ff3dce4 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 5e9b976c8a..50d1df9964 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -177,9 +177,7 @@ namespace osu.Desktop.VisualTests.Tests beatsPerMinute.Value = 60000 / timingPoint.BeatLength; adjustedBeatLength.Value = timingPoint.BeatLength; - flashLayer.ClearTransforms(); - flashLayer.FadeTo(1); - flashLayer.FadeTo(0, timingPoint.BeatLength); + flashLayer.FadeOutFromOne(timingPoint.BeatLength); } } From a4dfe3f1fae915f4a2bb32638323063a747508d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 22 Jul 2017 11:06:07 +0200 Subject: [PATCH 056/132] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index a914c8e62b..94e887669a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit a914c8e62b000c2a796116ecd1cb5e1922ac715f +Subproject commit 94e887669ab4d1784d568c564400c60ff5b865df From dae0f61b2b5f354674eae382a4ce11040a093471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 22 Jul 2017 11:09:13 +0200 Subject: [PATCH 057/132] Don't obtain DependencyContainer via DI --- osu.Game/Screens/Tournament/Drawings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 78b0940b67..7cd81a924d 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Tournament dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); [BackgroundDependencyLoader] - private void load(TextureStore textures, Storage storage, DependencyContainer dependencies) + private void load(TextureStore textures, Storage storage) { this.storage = storage; From 598b3f051e5bfd22c6bb8478af25ed238f5a43a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 22 Jul 2017 11:15:31 +0200 Subject: [PATCH 058/132] Address CI concerns and update framework --- osu-framework | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 1 - .../Objects/Drawables/Pieces/SpinnerDisc.cs | 1 - osu.Game/Graphics/UserInterface/RollingCounter.cs | 5 +---- osu.Game/Graphics/UserInterface/StarCounter.cs | 2 +- osu.Game/Screens/Play/HUD/ComboCounter.cs | 1 - osu.Game/Screens/Tournament/ScrollingTeamContainer.cs | 1 - 7 files changed, 3 insertions(+), 10 deletions(-) diff --git a/osu-framework b/osu-framework index 80850a0949..4298dcc170 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 80850a09494e5f2df3e41c37a1e17af55ff3dce4 +Subproject commit 4298dcc170f800a6fbe0d3afa3f713df22a95d31 diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 0d79bb7109..e74ad69d23 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -16,7 +16,6 @@ using System.Linq; using System.Collections.Generic; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Input; -using osu.Framework.Graphics.Transforms; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Timing; using osu.Framework.Configuration; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 4c5aa36640..98b243b375 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -4,7 +4,6 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; using OpenTK; diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 1ca25491e9..cb657825de 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -5,12 +5,10 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics.Sprites; using System; using System.Collections.Generic; using OpenTK.Graphics; -using osu.Framework.MathUtils; namespace osu.Game.Graphics.UserInterface { @@ -170,8 +168,7 @@ namespace osu.Game.Graphics.UserInterface /// implement the rollover animation). /// /// Count value before modification. - /// Expected count value after modification- - /// + /// Expected count value after modification. protected virtual void TransformCount(T currentValue, T newValue) { double rollingTotalDuration = diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index 41ecb56db4..c4f98dcbb7 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -122,7 +122,7 @@ namespace osu.Game.Graphics.UserInterface if (value <= i) return minStarScale; - return i + 1 <= value ? 1.0f : (float)Interpolation.ValueAt(value, minStarScale, 1.0f, i, i + 1); + return i + 1 <= value ? 1.0f : Interpolation.ValueAt(value, minStarScale, 1.0f, i, i + 1); } private void transformCount(float newValue) diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index f37b8fc434..c6b1bbcf31 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -5,7 +5,6 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Play.HUD diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 65ea195da6..8920ca2be8 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; using osu.Framework.Threading; using OpenTK; using OpenTK.Graphics; From 7e895f66e016b8c3711856b79c1e5d3ce9c1ef3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 22 Jul 2017 11:09:13 +0200 Subject: [PATCH 059/132] Don't obtain DependencyContainer via DI --- osu.Game/Screens/Tournament/Drawings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 78b0940b67..7cd81a924d 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Tournament dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); [BackgroundDependencyLoader] - private void load(TextureStore textures, Storage storage, DependencyContainer dependencies) + private void load(TextureStore textures, Storage storage) { this.storage = storage; From 96675965d87dfc50ee083065ed6852e1d63c5944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 22 Jul 2017 12:16:46 +0200 Subject: [PATCH 060/132] Fix broken test case --- osu-framework | 2 +- .../Beatmaps/IO/ImportBeatmapTest.cs | 37 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/osu-framework b/osu-framework index 94e887669a..921175c209 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 94e887669ab4d1784d568c564400c60ff5b865df +Subproject commit 921175c209840ba0787338be9e4aada6e95be7a5 diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index e467df0c53..24970b8dab 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -12,6 +12,7 @@ using osu.Framework.Desktop.Platform; using osu.Framework.Platform; using osu.Game.Database; using osu.Game.IPC; +using osu.Framework.Allocation; namespace osu.Game.Tests.Beatmaps.IO { @@ -26,15 +27,15 @@ namespace osu.Game.Tests.Beatmaps.IO //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new HeadlessGameHost()) { - loadOsu(host); + var osu = loadOsu(host); var temp = prepareTempCopy(osz_path); Assert.IsTrue(File.Exists(temp)); - host.Dependencies.Get().Import(temp); + osu.Dependencies.Get().Import(temp); - ensureLoaded(host); + ensureLoaded(osu); Assert.IsFalse(File.Exists(temp)); } @@ -49,7 +50,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(host.IsPrimaryInstance); Assert.IsTrue(!client.IsPrimaryInstance); - loadOsu(host); + var osu = loadOsu(host); var temp = prepareTempCopy(osz_path); @@ -59,7 +60,7 @@ namespace osu.Game.Tests.Beatmaps.IO if (!importer.ImportAsync(temp).Wait(10000)) Assert.Fail(@"IPC took too long to send"); - ensureLoaded(host); + ensureLoaded(osu); Assert.IsFalse(File.Exists(temp)); } @@ -71,16 +72,16 @@ namespace osu.Game.Tests.Beatmaps.IO //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new HeadlessGameHost()) { - loadOsu(host); + var osu = loadOsu(host); var temp = prepareTempCopy(osz_path); Assert.IsTrue(File.Exists(temp), "Temporary file copy never substantiated"); using (File.OpenRead(temp)) - host.Dependencies.Get().Import(temp); + osu.Dependencies.Get().Import(temp); - ensureLoaded(host); + ensureLoaded(osu); File.Delete(temp); @@ -103,19 +104,19 @@ namespace osu.Game.Tests.Beatmaps.IO Thread.Sleep(1); //reset beatmap database (sqlite and storage backing) - host.Dependencies.Get().Reset(); - host.Dependencies.Get().Reset(); + osu.Dependencies.Get().Reset(); + osu.Dependencies.Get().Reset(); return osu; } - private void ensureLoaded(GameHost host, int timeout = 60000) + private void ensureLoaded(OsuGameBase osu, int timeout = 60000) { IEnumerable resultSets = null; Action waitAction = () => { - while (!(resultSets = host.Dependencies.Get() + while (!(resultSets = osu.Dependencies.Get() .Query().Where(s => s.OnlineBeatmapSetID == 241526)).Any()) Thread.Sleep(50); }; @@ -132,7 +133,7 @@ namespace osu.Game.Tests.Beatmaps.IO //if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. waitAction = () => { - while ((resultBeatmaps = host.Dependencies.Get() + while ((resultBeatmaps = osu.Dependencies.Get() .GetAllWithChildren(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) Thread.Sleep(50); }; @@ -140,7 +141,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), @"Beatmaps did not import to the database in allocated time"); - var set = host.Dependencies.Get().GetChildren(resultSets.First()); + var set = osu.Dependencies.Get().GetChildren(resultSets.First()); Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(), $@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count})."); @@ -150,16 +151,16 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count > 0); - var beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; + var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); } } From c08cb43b9c6be83dd8c921bdc68f10b481a79210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 22 Jul 2017 13:49:41 +0200 Subject: [PATCH 061/132] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 921175c209..8fde46d214 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 921175c209840ba0787338be9e4aada6e95be7a5 +Subproject commit 8fde46d214e4ababb46100d2e4488ca26a9d43a3 From e68675f970103ba18c75dfee3cb80c4874f7cde8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 22 Jul 2017 20:50:25 +0200 Subject: [PATCH 062/132] Rename EasingTypes to Easing --- osu-framework | 2 +- .../Tests/TestCaseContextMenu.cs | 8 ++-- .../Tests/TestCaseKeyCounter.cs | 2 +- .../Tests/TestCaseScrollingHitObjects.cs | 2 +- osu.Game.Rulesets.Mania/UI/Column.cs | 8 ++-- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 6 +-- .../Connections/FollowPointRenderer.cs | 4 +- .../Objects/Drawables/DrawableHitCircle.cs | 2 +- .../Objects/Drawables/DrawableOsuJudgement.cs | 2 +- .../Objects/Drawables/DrawableSliderTick.cs | 6 +-- .../Objects/Drawables/DrawableSpinner.cs | 14 +++---- .../Objects/Drawables/Pieces/SliderBall.cs | 4 +- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 6 +-- .../Replays/OsuAutoGenerator.cs | 8 ++-- .../Objects/Drawables/DrawableDrumRollTick.cs | 2 +- .../Objects/Drawables/DrawableHit.cs | 6 +-- .../Objects/Drawables/DrawableSwell.cs | 10 ++--- .../Objects/Drawables/Pieces/CirclePiece.cs | 4 +- osu.Game.Rulesets.Taiko/UI/HitExplosion.cs | 2 +- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 12 +++--- .../UI/KiaiHitExplosion.cs | 2 +- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 2 +- osu.Game/Beatmaps/Drawables/Panel.cs | 2 +- .../Graphics/Containers/ParallaxContainer.cs | 4 +- osu.Game/Graphics/Cursor/GameplayCursor.cs | 4 +- osu.Game/Graphics/Cursor/MenuCursor.cs | 22 +++++------ .../Graphics/Cursor/OsuTooltipContainer.cs | 10 ++--- osu.Game/Graphics/IHasAccentColour.cs | 2 +- osu.Game/Graphics/UserInterface/Bar.cs | 2 +- .../UserInterface/BreadcrumbControl.cs | 10 ++--- .../Graphics/UserInterface/DialogButton.cs | 14 +++---- osu.Game/Graphics/UserInterface/IconButton.cs | 10 ++--- osu.Game/Graphics/UserInterface/LineGraph.cs | 2 +- .../UserInterface/LoadingAnimation.cs | 4 +- osu.Game/Graphics/UserInterface/Nub.cs | 10 ++--- osu.Game/Graphics/UserInterface/OsuButton.cs | 4 +- .../Graphics/UserInterface/OsuContextMenu.cs | 6 +-- .../UserInterface/OsuContextMenuItem.cs | 8 ++-- osu.Game/Graphics/UserInterface/OsuMenu.cs | 6 +-- .../UserInterface/OsuPasswordTextBox.cs | 4 +- .../Graphics/UserInterface/OsuSliderBar.cs | 2 +- .../Graphics/UserInterface/OsuTabControl.cs | 8 ++-- .../UserInterface/OsuTabControlCheckbox.cs | 8 ++-- .../Graphics/UserInterface/RollingCounter.cs | 2 +- .../Graphics/UserInterface/ScoreCounter.cs | 2 +- .../Graphics/UserInterface/StarCounter.cs | 2 +- .../Graphics/UserInterface/TwoLayerButton.cs | 18 ++++----- .../UserInterface/Volume/VolumeMeter.cs | 2 +- osu.Game/OsuGame.cs | 4 +- osu.Game/Overlays/Chat/ChannelListItem.cs | 2 +- .../Overlays/Chat/ChannelSelectionOverlay.cs | 10 ++--- osu.Game/Overlays/Chat/ChatTabControl.cs | 22 +++++------ osu.Game/Overlays/ChatOverlay.cs | 16 ++++---- osu.Game/Overlays/Dialog/PopupDialog.cs | 10 ++--- osu.Game/Overlays/DialogOverlay.cs | 4 +- osu.Game/Overlays/Direct/DirectGridPanel.cs | 4 +- osu.Game/Overlays/Direct/DirectListPanel.cs | 10 ++--- osu.Game/Overlays/Direct/DirectPanel.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 2 +- osu.Game/Overlays/LoginOverlay.cs | 4 +- osu.Game/Overlays/MedalOverlay.cs | 6 +-- .../Overlays/MedalSplash/DrawableMedal.cs | 10 ++--- osu.Game/Overlays/Mods/ModButton.cs | 6 +-- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 20 +++++----- osu.Game/Overlays/Music/PlaylistList.cs | 2 +- osu.Game/Overlays/Music/PlaylistOverlay.cs | 6 +-- osu.Game/Overlays/MusicController.cs | 20 +++++----- osu.Game/Overlays/NotificationManager.cs | 6 +-- .../Overlays/Notifications/Notification.cs | 4 +- .../Notifications/NotificationSection.cs | 2 +- .../Notifications/ProgressNotification.cs | 4 +- osu.Game/Overlays/OnScreenDisplay.cs | 16 ++++---- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 +- osu.Game/Overlays/Profile/RankChart.cs | 4 +- .../Sections/General/LoginSettings.cs | 2 +- .../Sections/Graphics/LayoutSettings.cs | 4 +- osu.Game/Overlays/Settings/Sidebar.cs | 4 +- osu.Game/Overlays/SettingsOverlay.cs | 8 ++-- osu.Game/Overlays/Toolbar/Toolbar.cs | 14 +++---- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 2 +- .../Overlays/Toolbar/ToolbarModeSelector.cs | 2 +- osu.Game/Overlays/UserProfileOverlay.cs | 4 +- osu.Game/Overlays/WaveOverlayContainer.cs | 16 ++++---- .../Rulesets/Judgements/DrawableJudgement.cs | 10 ++--- osu.Game/Screens/BackgroundScreen.cs | 12 +++--- .../Backgrounds/BackgroundScreenBeatmap.cs | 2 +- .../Backgrounds/BackgroundScreenDefault.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 38 +++++++++---------- osu.Game/Screens/Menu/ButtonSystem.cs | 14 +++---- osu.Game/Screens/Menu/Intro.cs | 4 +- osu.Game/Screens/Menu/MainMenu.cs | 12 +++--- osu.Game/Screens/Menu/MenuSideFlashes.cs | 2 +- osu.Game/Screens/Menu/OsuLogo.cs | 26 ++++++------- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 2 +- osu.Game/Screens/Multiplayer/RoomInspector.cs | 2 +- osu.Game/Screens/Play/HUD/ComboCounter.cs | 4 +- .../Screens/Play/HUD/ComboResultCounter.cs | 2 +- osu.Game/Screens/Play/HUD/ModDisplay.cs | 8 ++-- .../Screens/Play/HUD/StandardHealthDisplay.cs | 6 +-- osu.Game/Screens/Play/HotkeyRetryOverlay.cs | 4 +- osu.Game/Screens/Play/MenuOverlay.cs | 4 +- osu.Game/Screens/Play/Player.cs | 10 ++--- osu.Game/Screens/Play/PlayerLoader.cs | 8 ++-- .../Play/ReplaySettings/ReplayGroup.cs | 6 +-- osu.Game/Screens/Play/SkipButton.cs | 26 ++++++------- osu.Game/Screens/Play/SongProgress.cs | 6 +-- osu.Game/Screens/Ranking/ResultModeButton.cs | 4 +- osu.Game/Screens/Ranking/Results.cs | 22 +++++------ osu.Game/Screens/Ranking/ResultsPageScore.cs | 6 +-- osu.Game/Screens/ScreenWhiteBox.cs | 20 +++++----- osu.Game/Screens/Select/BeatmapCarousel.cs | 10 ++--- osu.Game/Screens/Select/BeatmapDetails.cs | 10 ++--- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 8 ++-- osu.Game/Screens/Select/Footer.cs | 2 +- osu.Game/Screens/Select/FooterButton.cs | 14 +++---- .../Select/Leaderboards/LeaderboardScore.cs | 14 +++---- .../Select/Options/BeatmapOptionsButton.cs | 6 +-- .../Select/Options/BeatmapOptionsOverlay.cs | 16 ++++---- osu.Game/Screens/Select/SongSelect.cs | 4 +- .../Tournament/ScrollingTeamContainer.cs | 2 +- osu.Game/Users/UserPanel.cs | 14 +++---- 121 files changed, 450 insertions(+), 450 deletions(-) diff --git a/osu-framework b/osu-framework index 8fde46d214..eda38950b5 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 8fde46d214e4ababb46100d2e4488ca26a9d43a3 +Subproject commit eda38950b57fe0693e1faa6ad8e55f2da9665f91 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index bf8f9bf7f4..0b4e8a5799 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -88,10 +88,10 @@ namespace osu.Desktop.VisualTests.Tests { new OsuContextMenuItem(@"Simple option"), new OsuContextMenuItem(@"Simple very very long option"), - new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted) { Action = () => this.ResizeWidthTo(Width * 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted) { Action = () => this.ResizeHeightTo(Height * 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive) { Action = () => this.ResizeWidthTo(Width / 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive) { Action = () => this.ResizeHeightTo(Height / 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted) { Action = () => this.ResizeWidthTo(Width * 2, 100, Easing.OutQuint) }, + new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted) { Action = () => this.ResizeHeightTo(Height * 2, 100, Easing.OutQuint) }, + new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive) { Action = () => this.ResizeWidthTo(Width / 2, 100, Easing.OutQuint) }, + new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive) { Action = () => this.ResizeHeightTo(Height / 2, 100, Easing.OutQuint) }, }; } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 87a40a76ca..f65dbe7a64 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -96,7 +96,7 @@ namespace osu.Desktop.VisualTests.Tests { SelectionBox.ScaleTo( new Vector2(value, 1), - 300, EasingTypes.OutQuint); + 300, Easing.OutQuint); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index eed2fa95c1..43f30a96b0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -196,7 +196,7 @@ namespace osu.Desktop.VisualTests.Tests protected override void LoadComplete() { base.LoadComplete(); - this.FadeInFromZero(250, EasingTypes.OutQuint); + this.FadeInFromZero(250, Easing.OutQuint); } protected override void Update() diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 12b6f61a12..a4d292ec45 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -206,8 +206,8 @@ namespace osu.Game.Rulesets.Mania.UI if (args.Key == Key) { - background.FadeTo(background.Alpha + 0.2f, 50, EasingTypes.OutQuint); - keyIcon.ScaleTo(1.4f, 50, EasingTypes.OutQuint); + background.FadeTo(background.Alpha + 0.2f, 50, Easing.OutQuint); + keyIcon.ScaleTo(1.4f, 50, Easing.OutQuint); } return false; @@ -217,8 +217,8 @@ namespace osu.Game.Rulesets.Mania.UI { if (args.Key == Key) { - background.FadeTo(0.2f, 800, EasingTypes.OutQuart); - keyIcon.ScaleTo(1f, 400, EasingTypes.OutQuart); + background.FadeTo(0.2f, 800, Easing.OutQuart); + keyIcon.ScaleTo(1f, 400, Easing.OutQuart); } return false; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index e74ad69d23..03b6e18856 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -220,10 +220,10 @@ namespace osu.Game.Rulesets.Mania.UI switch (args.Key) { case Key.Minus: - transformVisibleTimeRangeTo(visibleTimeRange + time_span_step, 200, EasingTypes.OutQuint); + transformVisibleTimeRangeTo(visibleTimeRange + time_span_step, 200, Easing.OutQuint); break; case Key.Plus: - transformVisibleTimeRangeTo(visibleTimeRange - time_span_step, 200, EasingTypes.OutQuint); + transformVisibleTimeRangeTo(visibleTimeRange - time_span_step, 200, Easing.OutQuint); break; } } @@ -231,7 +231,7 @@ namespace osu.Game.Rulesets.Mania.UI return false; } - private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, EasingTypes easing = EasingTypes.None) + private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, Easing easing = Easing.None) { this.TransformTo(nameof(visibleTimeRange), newTimeRange, duration, easing); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index 42c148b525..2396e5d129 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -94,9 +94,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections using (fp.BeginAbsoluteSequence(fadeInTime)) { fp.FadeIn(DrawableOsuHitObject.TIME_FADEIN); - fp.ScaleTo(1, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); + fp.ScaleTo(1, DrawableOsuHitObject.TIME_FADEIN, Easing.Out); - fp.MoveTo(pointEndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); + fp.MoveTo(pointEndPosition, DrawableOsuHitObject.TIME_FADEIN, Easing.Out); fp.Delay(fadeOutTime - fadeInTime).FadeOut(DrawableOsuHitObject.TIME_FADEIN); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index a890a0cdb4..f68a7a765b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -143,7 +143,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables number.FadeOut(); this.FadeOut(800) - .ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad); + .ScaleTo(Scale * 1.5f, 400, Easing.OutQuad); } Expire(); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs index eaa0bb7d27..892d106b02 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void LoadComplete() { if (Judgement.Result != HitResult.Miss) - JudgementText.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint); + JudgementText.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint); base.LoadComplete(); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 4220299a25..2a50b23047 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables d => d.FadeIn(animIn), d => d.ScaleTo(0.5f).ScaleTo(1.2f, animIn) ).Then( - d => d.ScaleTo(1, 150, EasingTypes.Out) + d => d.ScaleTo(1, 150, Easing.Out) ); } @@ -82,8 +82,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables .FadeColour(Color4.Red, 80); break; case ArmedState.Hit: - this.FadeOut(120, EasingTypes.OutQuint) - .ScaleTo(Scale * 1.5f, 120, EasingTypes.OutQuint); + this.FadeOut(120, Easing.OutQuint) + .ScaleTo(Scale * 1.5f, 120, Easing.OutQuint); break; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index c7d838e517..2aae1bb24e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -174,9 +174,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables ticks.Rotation = disc.Rotation; float relativeCircleScale = spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight; - disc.ScaleTo(relativeCircleScale + (1 - relativeCircleScale) * Progress, 200, EasingTypes.OutQuint); + disc.ScaleTo(relativeCircleScale + (1 - relativeCircleScale) * Progress, 200, Easing.OutQuint); - symbol.RotateTo(disc.Rotation / 2, 500, EasingTypes.OutQuint); + symbol.RotateTo(disc.Rotation / 2, 500, Easing.OutQuint); } protected override void UpdatePreemptState() @@ -184,16 +184,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables base.UpdatePreemptState(); circleContainer.ScaleTo(spinner.Scale * 0.3f); - circleContainer.ScaleTo(spinner.Scale, TIME_PREEMPT / 1.4f, EasingTypes.OutQuint); + circleContainer.ScaleTo(spinner.Scale, TIME_PREEMPT / 1.4f, Easing.OutQuint); disc.RotateTo(-720); symbol.RotateTo(-720); mainContainer .ScaleTo(0) - .ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, EasingTypes.OutQuint) + .ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, Easing.OutQuint) .Then() - .ScaleTo(1, 500, EasingTypes.OutQuint); + .ScaleTo(1, 500, Easing.OutQuint); } protected override void UpdateCurrentState(ArmedState state) @@ -203,10 +203,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables switch (state) { case ArmedState.Hit: - sequence.ScaleTo(Scale * 1.2f, 320, EasingTypes.Out); + sequence.ScaleTo(Scale * 1.2f, 320, Easing.Out); break; case ArmedState.Miss: - sequence.ScaleTo(Scale * 0.8f, 320, EasingTypes.In); + sequence.ScaleTo(Scale * 0.8f, 320, Easing.In); break; } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 9a114aa72c..dbfd9b291b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -106,8 +106,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces tracking = value; - follow.ScaleTo(tracking ? 2.8f : 1, 300, EasingTypes.OutQuint); - follow.FadeTo(tracking ? 0.2f : 0, 300, EasingTypes.OutQuint); + follow.ScaleTo(tracking ? 2.8f : 1, 300, Easing.OutQuint); + follow.FadeTo(tracking ? 0.2f : 0, 300, Easing.OutQuint); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 98b243b375..cd808abe9d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -128,12 +128,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { background.FinishTransforms(false, nameof(Alpha)); background - .FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo) + .FadeTo(tracking_alpha + 0.2f, 60, Easing.OutExpo) .Then() - .FadeTo(tracking_alpha, 250, EasingTypes.OutQuint); + .FadeTo(tracking_alpha, 250, Easing.OutQuint); } - this.RotateTo(currentRotation / 2, validAndTracking ? 500 : 1500, EasingTypes.OutExpo); + this.RotateTo(currentRotation / 2, validAndTracking ? 500 : 1500, Easing.OutExpo); } } } diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs index 5ede3f56f5..b92f1bc60a 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Replays /// /// What easing to use when moving between hitobjects /// - private EasingTypes preferredEasing => DelayedMovements ? EasingTypes.InOutCubic : EasingTypes.Out; + private Easing preferredEasing => DelayedMovements ? Easing.InOutCubic : Easing.Out; #endregion @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Osu.Replays { // Default values for circles/sliders Vector2 startPosition = h.StackedPosition; - EasingTypes easing = preferredEasing; + Easing easing = preferredEasing; float spinnerDirection = -1; // The startPosition for the slider should not be its .Position, but the point on the circle whose tangent crosses the current cursor position @@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.Replays if (spinCentreOffset.Length > SPIN_RADIUS) { // If moving in from the outside, don't ease out (default eases out). This means auto will "start" spinning immediately after moving into position. - easing = EasingTypes.In; + easing = Easing.In; } } @@ -190,7 +190,7 @@ namespace osu.Game.Rulesets.Osu.Replays } } - private void moveToHitObject(double targetTime, Vector2 targetPos, double hitObjectRadius, EasingTypes easing) + private void moveToHitObject(double targetTime, Vector2 targetPos, double hitObjectRadius, Easing easing) { ReplayFrame lastFrame = Frames[Frames.Count - 1]; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index 56a747467e..b64bc64d9b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables switch (state) { case ArmedState.Hit: - Content.ScaleTo(0, 100, EasingTypes.OutQuint); + Content.ScaleTo(0, 100, Easing.OutQuint); break; } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 1d614b4adb..0d5c8d2a25 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -90,12 +90,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables const float gravity_time = 300; const float gravity_travel_height = 200; - Content.ScaleTo(0.8f, gravity_time * 2, EasingTypes.OutQuad); + Content.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad); this.FadeOut(800) - .MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out) + .MoveToY(-gravity_travel_height, gravity_time, Easing.Out) .Then() - .MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In); + .MoveToY(gravity_travel_height * 2, gravity_time * 2, Easing.In); Expire(); break; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 521d225abe..a565f92fac 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -150,11 +150,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables expandingRing .FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50) .Then() - .FadeTo(completion / 8, 2000, EasingTypes.OutQuint); + .FadeTo(completion / 8, 2000, Easing.OutQuint); - symbol.RotateTo((float)(completion * HitObject.Duration / 8), 4000, EasingTypes.OutQuint); + symbol.RotateTo((float)(completion * HitObject.Duration / 8), 4000, Easing.OutQuint); - expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, EasingTypes.OutQuint); + expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, Easing.OutQuint); if (userHits == HitObject.RequiredHits) { @@ -186,8 +186,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables double untilStartTime = HitObject.StartTime - Time.Current; double untilJudgement = untilStartTime + Judgement.TimeOffset + HitObject.Duration; - targetRing.Delay(untilStartTime - preempt).ScaleTo(target_ring_scale, preempt * 4, EasingTypes.OutQuint); - this.Delay(untilJudgement).FadeOut(out_transition_time, EasingTypes.Out); + targetRing.Delay(untilStartTime - preempt).ScaleTo(target_ring_scale, preempt * 4, Easing.OutQuint); + this.Delay(untilJudgement).FadeOut(out_transition_time, Easing.Out); switch (state) { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index a4cd026e4c..698939e278 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -167,9 +167,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces double duration = timingPoint.BeatLength * 2; background - .FadeEdgeEffectTo(1, pre_beat_transition_time, EasingTypes.OutQuint) + .FadeEdgeEffectTo(1, pre_beat_transition_time, Easing.OutQuint) .Then() - .FadeEdgeEffectTo(edge_alpha_kiai, duration, EasingTypes.OutQuint); + .FadeEdgeEffectTo(edge_alpha_kiai, duration, Easing.OutQuint); } } } \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs index 8766f7b9f5..c372ac1809 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs @@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Taiko.UI { base.LoadComplete(); - this.ScaleTo(3f, 1000, EasingTypes.OutQuint); + this.ScaleTo(3f, 1000, Easing.OutQuint); this.FadeOut(500); Expire(); diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index a413d77d16..60881f3c24 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -149,16 +149,16 @@ namespace osu.Game.Rulesets.Taiko.UI const float down_time = 40; const float up_time = 1000; - back.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint) + back.ScaleTo(target.Scale.X - scale_amount, down_time, Easing.OutQuint) .Then() - .ScaleTo(1, up_time, EasingTypes.OutQuint); + .ScaleTo(1, up_time, Easing.OutQuint); target.Animate( - t => t.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint), - t => t.FadeTo(Math.Min(target.Alpha + alpha_amount, 1), down_time, EasingTypes.OutQuint) + t => t.ScaleTo(target.Scale.X - scale_amount, down_time, Easing.OutQuint), + t => t.FadeTo(Math.Min(target.Alpha + alpha_amount, 1), down_time, Easing.OutQuint) ).Then( - t => t.ScaleTo(1, up_time, EasingTypes.OutQuint), - t => t.FadeOut(up_time, EasingTypes.OutQuint) + t => t.ScaleTo(1, up_time, Easing.OutQuint), + t => t.FadeOut(up_time, Easing.OutQuint) ); } diff --git a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs index 346f435e5d..524490fac3 100644 --- a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Taiko.UI { base.LoadComplete(); - this.ScaleTo(new Vector2(1, 3f), 500, EasingTypes.OutQuint); + this.ScaleTo(new Vector2(1, 3f), 500, Easing.OutQuint); this.FadeOut(250); Expire(); diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index b59dbac722..5b263e4798 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps.Drawables new PanelBackground(beatmap) { RelativeSizeAxes = Axes.Both, - OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), } ) { diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index 10eeba53e0..d07be88392 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps.Drawables } if (state == PanelSelectedState.Hidden) - this.FadeOut(300, EasingTypes.OutQuint); + this.FadeOut(300, Easing.OutQuint); else this.FadeIn(250); } diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 19475b00c9..ec9d30f244 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -42,7 +42,7 @@ namespace osu.Game.Graphics.Containers { if (!parallaxEnabled) { - content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, EasingTypes.OutQuint); + content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, Easing.OutQuint); content.Scale = new Vector2(1 + ParallaxAmount); } }; @@ -57,7 +57,7 @@ namespace osu.Game.Graphics.Containers if (parallaxEnabled) { Vector2 offset = input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2; - content.MoveTo(offset * ParallaxAmount, firstUpdate ? 0 : 1000, EasingTypes.OutQuint); + content.MoveTo(offset * ParallaxAmount, firstUpdate ? 0 : 1000, Easing.OutQuint); content.Scale = new Vector2(1 + ParallaxAmount); } diff --git a/osu.Game/Graphics/Cursor/GameplayCursor.cs b/osu.Game/Graphics/Cursor/GameplayCursor.cs index da3975f606..e74222f136 100644 --- a/osu.Game/Graphics/Cursor/GameplayCursor.cs +++ b/osu.Game/Graphics/Cursor/GameplayCursor.cs @@ -29,14 +29,14 @@ namespace osu.Game.Graphics.Cursor protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { ActiveCursor.Scale = new Vector2(1); - ActiveCursor.ScaleTo(1.2f, 100, EasingTypes.OutQuad); + ActiveCursor.ScaleTo(1.2f, 100, Easing.OutQuad); return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { if (!state.Mouse.HasMainButtonPressed) - ActiveCursor.ScaleTo(1, 200, EasingTypes.OutQuad); + ActiveCursor.ScaleTo(1, 200, Easing.OutQuad); return base.OnMouseUp(state, args); } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 82ae424ab0..9658cfdb09 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.Cursor if (diff > 180) diff -= 360; degrees = ActiveCursor.Rotation + diff; - ActiveCursor.RotateTo(degrees, 600, EasingTypes.OutQuint); + ActiveCursor.RotateTo(degrees, 600, Easing.OutQuint); } return base.OnMouseMove(state); @@ -49,10 +49,10 @@ namespace osu.Game.Graphics.Cursor protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { ActiveCursor.Scale = new Vector2(1); - ActiveCursor.ScaleTo(0.90f, 800, EasingTypes.OutQuint); + ActiveCursor.ScaleTo(0.90f, 800, Easing.OutQuint); ((Cursor)ActiveCursor).AdditiveLayer.Alpha = 0; - ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, EasingTypes.OutQuint); + ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); return base.OnMouseDown(state, args); } @@ -62,9 +62,9 @@ namespace osu.Game.Graphics.Cursor { dragging = false; - ((Cursor)ActiveCursor).AdditiveLayer.FadeOut(500, EasingTypes.OutQuint); - ActiveCursor.RotateTo(0, 600 * (1 + Math.Abs(ActiveCursor.Rotation / 720)), EasingTypes.OutElasticHalf); - ActiveCursor.ScaleTo(1, 500, EasingTypes.OutElastic); + ((Cursor)ActiveCursor).AdditiveLayer.FadeOut(500, Easing.OutQuint); + ActiveCursor.RotateTo(0, 600 * (1 + Math.Abs(ActiveCursor.Rotation / 720)), Easing.OutElasticHalf); + ActiveCursor.ScaleTo(1, 500, Easing.OutElastic); } return base.OnMouseUp(state, args); @@ -72,21 +72,21 @@ namespace osu.Game.Graphics.Cursor protected override bool OnClick(InputState state) { - ((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne(500, EasingTypes.OutQuint); + ((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); return base.OnClick(state); } protected override void PopIn() { - ActiveCursor.FadeTo(1, 250, EasingTypes.OutQuint); - ActiveCursor.ScaleTo(1, 400, EasingTypes.OutQuint); + ActiveCursor.FadeTo(1, 250, Easing.OutQuint); + ActiveCursor.ScaleTo(1, 400, Easing.OutQuint); } protected override void PopOut() { - ActiveCursor.FadeTo(0, 900, EasingTypes.OutQuint); - ActiveCursor.ScaleTo(0, 500, EasingTypes.In); + ActiveCursor.FadeTo(0, 900, Easing.OutQuint); + ActiveCursor.ScaleTo(0, 500, Easing.In); } public class Cursor : Container diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index d3d01a5bc8..e9d84b28a3 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -37,7 +37,7 @@ namespace osu.Game.Graphics.Cursor if (IsPresent) { AutoSizeDuration = 250; - background.FlashColour(OsuColour.Gray(0.4f), 1000, EasingTypes.OutQuint); + background.FlashColour(OsuColour.Gray(0.4f), 1000, Easing.OutQuint); } else AutoSizeDuration = 0; @@ -48,7 +48,7 @@ namespace osu.Game.Graphics.Cursor public OsuTooltip() { - AutoSizeEasing = EasingTypes.OutQuint; + AutoSizeEasing = Easing.OutQuint; CornerRadius = 5; Masking = true; @@ -83,10 +83,10 @@ namespace osu.Game.Graphics.Cursor protected override void PopIn() { instantMovement |= !IsPresent; - this.FadeIn(500, EasingTypes.OutQuint); + this.FadeIn(500, Easing.OutQuint); } - protected override void PopOut() => this.Delay(150).FadeOut(500, EasingTypes.OutQuint); + protected override void PopOut() => this.Delay(150).FadeOut(500, Easing.OutQuint); public override void Move(Vector2 pos) { @@ -97,7 +97,7 @@ namespace osu.Game.Graphics.Cursor } else { - this.MoveTo(pos, 200, EasingTypes.OutQuint); + this.MoveTo(pos, 200, Easing.OutQuint); } } } diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index 0edd2c3ac4..ac2117c517 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -26,7 +26,7 @@ namespace osu.Game.Graphics /// The new accent colour. /// The tween duration. /// The tween easing. - public static TransformSequence 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, Easing easing = Easing.None) where T : IHasAccentColour => accentedDrawable.TransformTo(nameof(accentedDrawable.AccentColour), newColour, duration, easing); } diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 1da73a60a2..20df553142 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -17,7 +17,7 @@ namespace osu.Game.Graphics.UserInterface private const int resize_duration = 250; - private const EasingTypes easing = EasingTypes.InOutCubic; + private const Easing easing = Easing.InOutCubic; private float length; /// diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index e69f9e3f42..f61192a1a6 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -28,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface var tabIndex = TabContainer.IndexOf(TabMap[tab]); t.State = tIndex < tabIndex ? Visibility.Hidden : Visibility.Visible; - t.Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, EasingTypes.OutQuint); + t.Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, Easing.OutQuint); } }; } @@ -54,13 +54,13 @@ namespace osu.Game.Graphics.UserInterface if (State == Visibility.Visible) { - this.FadeIn(transition_duration, EasingTypes.OutQuint); - this.ScaleTo(new Vector2(1f), transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, Easing.OutQuint); + this.ScaleTo(new Vector2(1f), transition_duration, Easing.OutQuint); } else { - this.FadeOut(transition_duration, EasingTypes.OutQuint); - this.ScaleTo(new Vector2(0.8f, 1f), transition_duration, EasingTypes.OutQuint); + this.FadeOut(transition_duration, Easing.OutQuint); + this.ScaleTo(new Vector2(0.8f, 1f), transition_duration, Easing.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 460f4cea41..4e688999dc 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -96,7 +96,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnClick(Framework.Input.InputState state) { didClick = true; - colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In); + colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, Easing.In); flash(); this.Delay(click_duration).Schedule(delegate { @@ -110,10 +110,10 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(Framework.Input.InputState state) { - spriteText.TransformSpacingTo(hoverSpacing, hover_duration, EasingTypes.OutElastic); + spriteText.TransformSpacingTo(hoverSpacing, hover_duration, Easing.OutElastic); - colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic); - glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out); + colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, Easing.OutElastic); + glowContainer.FadeIn(glow_fade_duration, Easing.Out); base.OnHover(state); return true; } @@ -122,9 +122,9 @@ namespace osu.Game.Graphics.UserInterface { if (!didClick) { - colourContainer.ResizeTo(new Vector2(0.8f, 1f), hover_duration, EasingTypes.OutElastic); - spriteText.TransformSpacingTo(Vector2.Zero, hover_duration, EasingTypes.OutElastic); - glowContainer.FadeOut(glow_fade_duration, EasingTypes.Out); + colourContainer.ResizeTo(new Vector2(0.8f, 1f), hover_duration, Easing.OutElastic); + spriteText.TransformSpacingTo(Vector2.Zero, hover_duration, Easing.OutElastic); + glowContainer.FadeOut(glow_fade_duration, Easing.Out); } didClick = false; diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index 84904c10db..1598ace9df 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -84,31 +84,31 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(InputState state) { - hover.FadeIn(500, EasingTypes.OutQuint); + hover.FadeIn(500, Easing.OutQuint); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - hover.FadeOut(500, EasingTypes.OutQuint); + hover.FadeOut(500, Easing.OutQuint); base.OnHoverLost(state); } protected override bool OnClick(InputState state) { - hover.FlashColour(flashColour, 800, EasingTypes.OutQuint); + hover.FlashColour(flashColour, 800, Easing.OutQuint); return base.OnClick(state); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - content.ScaleTo(0.75f, 2000, EasingTypes.OutQuint); + content.ScaleTo(0.75f, 2000, Easing.OutQuint); return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - content.ScaleTo(1, 1000, EasingTypes.OutElastic); + content.ScaleTo(1, 1000, Easing.OutElastic); return base.OnMouseUp(state, args); } } diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index cd8ba96dc8..aa9256e576 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -49,7 +49,7 @@ namespace osu.Game.Graphics.UserInterface values = value.ToArray(); applyPath(); maskingContainer.Width = 0; - maskingContainer.ResizeWidthTo(1, transform_duration, EasingTypes.OutQuint); + maskingContainer.ResizeWidthTo(1, transform_duration, Easing.OutQuint); } } diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs index 4f348ebb56..56ee47a7e6 100644 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs @@ -39,8 +39,8 @@ namespace osu.Game.Graphics.UserInterface private const float transition_duration = 500; - protected override void PopIn() => this.FadeIn(transition_duration * 5, EasingTypes.OutQuint); + protected override void PopIn() => this.FadeIn(transition_duration * 5, Easing.OutQuint); - protected override void PopOut() => this.FadeOut(transition_duration, EasingTypes.OutQuint); + protected override void PopOut() => this.FadeOut(transition_duration, Easing.OutQuint); } } diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 298badcb77..f7df6cd4f4 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -43,9 +43,9 @@ namespace osu.Game.Graphics.UserInterface Current.ValueChanged += newValue => { if (newValue) - fill.FadeIn(200, EasingTypes.OutQuint); + fill.FadeIn(200, Easing.OutQuint); else - fill.FadeTo(0.01f, 200, EasingTypes.OutQuint); //todo: remove once we figure why containers aren't drawing at all times + fill.FadeTo(0.01f, 200, Easing.OutQuint); //todo: remove once we figure why containers aren't drawing at all times }; } @@ -80,8 +80,8 @@ namespace osu.Game.Graphics.UserInterface if (value) { - this.FadeColour(GlowingAccentColour, 500, EasingTypes.OutQuint); - FadeEdgeEffectTo(1, 500, EasingTypes.OutQuint); + this.FadeColour(GlowingAccentColour, 500, Easing.OutQuint); + FadeEdgeEffectTo(1, 500, Easing.OutQuint); } else { @@ -95,7 +95,7 @@ namespace osu.Game.Graphics.UserInterface { set { - this.ResizeTo(new Vector2(value ? EXPANDED_SIZE : COLLAPSED_SIZE, 12), 500, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(value ? EXPANDED_SIZE : COLLAPSED_SIZE, 12), 500, Easing.OutQuint); } } diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 18156f8e76..ecbf51f8b9 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -91,13 +91,13 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - Content.ScaleTo(0.9f, 4000, EasingTypes.OutQuint); + Content.ScaleTo(0.9f, 4000, Easing.OutQuint); return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - Content.ScaleTo(1, 1000, EasingTypes.OutElastic); + Content.ScaleTo(1, 1000, Easing.OutElastic); return base.OnMouseUp(state, args); } } diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs index 66c214f6a3..d4882cce1e 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs @@ -39,13 +39,13 @@ namespace osu.Game.Graphics.UserInterface Background.Colour = colours.ContextMenuGray; } - protected override void AnimateOpen() => this.FadeIn(fade_duration, EasingTypes.OutQuint); - protected override void AnimateClose() => this.FadeOut(fade_duration, EasingTypes.OutQuint); + protected override void AnimateOpen() => this.FadeIn(fade_duration, Easing.OutQuint); + protected override void AnimateClose() => this.FadeOut(fade_duration, Easing.OutQuint); protected override void UpdateContentHeight() { var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight; - this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, Easing.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs index 5d12dadf5f..196e905bdc 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs @@ -93,15 +93,15 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(InputState state) { sampleHover.Play(); - textBold.FadeIn(transition_length, EasingTypes.OutQuint); - text.FadeOut(transition_length, EasingTypes.OutQuint); + textBold.FadeIn(transition_length, Easing.OutQuint); + text.FadeOut(transition_length, Easing.OutQuint); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - textBold.FadeOut(transition_length, EasingTypes.OutQuint); - text.FadeIn(transition_length, EasingTypes.OutQuint); + textBold.FadeOut(transition_length, Easing.OutQuint); + text.FadeIn(transition_length, Easing.OutQuint); base.OnHoverLost(state); } diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 2bcf0a467c..e597bc44b5 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -19,14 +19,14 @@ namespace osu.Game.Graphics.UserInterface ItemsContainer.Padding = new MarginPadding(5); } - protected override void AnimateOpen() => this.FadeIn(300, EasingTypes.OutQuint); + protected override void AnimateOpen() => this.FadeIn(300, Easing.OutQuint); - protected override void AnimateClose() => this.FadeOut(300, EasingTypes.OutQuint); + protected override void AnimateClose() => this.FadeOut(300, Easing.OutQuint); protected override void UpdateContentHeight() { var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight; - this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, Easing.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index dc52fd0f62..b7ca25b95a 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -47,8 +47,8 @@ namespace osu.Game.Graphics.UserInterface protected override void LoadComplete() { base.LoadComplete(); - circle.FadeIn(500, EasingTypes.OutQuint); - circle.ResizeTo(new Vector2(0.8f), 500, EasingTypes.OutQuint); + circle.FadeIn(500, Easing.OutQuint); + circle.ResizeTo(new Vector2(0.8f), 500, Easing.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 673a23afac..3dd3596c30 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -166,7 +166,7 @@ namespace osu.Game.Graphics.UserInterface protected override void UpdateValue(float value) { - Nub.MoveToX(RangePadding + UsableWidth * value, 250, EasingTypes.OutQuint); + Nub.MoveToX(RangePadding + UsableWidth * value, 250, Easing.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 602aee3c58..8c16c048ea 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -77,14 +77,14 @@ namespace osu.Game.Graphics.UserInterface private void fadeActive() { - box.FadeIn(transition_length, EasingTypes.OutQuint); - Text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); + box.FadeIn(transition_length, Easing.OutQuint); + Text.FadeColour(Color4.White, transition_length, Easing.OutQuint); } private void fadeInactive() { - box.FadeOut(transition_length, EasingTypes.OutQuint); - Text.FadeColour(AccentColour, transition_length, EasingTypes.OutQuint); + box.FadeOut(transition_length, Easing.OutQuint); + Text.FadeColour(AccentColour, transition_length, Easing.OutQuint); } protected override bool OnHover(InputState state) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index 940d9b4943..57a87dc74b 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -49,14 +49,14 @@ namespace osu.Game.Graphics.UserInterface private void fadeIn() { - box.FadeIn(transition_length, EasingTypes.OutQuint); - text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); + box.FadeIn(transition_length, Easing.OutQuint); + text.FadeColour(Color4.White, transition_length, Easing.OutQuint); } private void fadeOut() { - box.FadeOut(transition_length, EasingTypes.OutQuint); - text.FadeColour(AccentColour, transition_length, EasingTypes.OutQuint); + box.FadeOut(transition_length, Easing.OutQuint); + text.FadeColour(AccentColour, transition_length, Easing.OutQuint); } protected override bool OnHover(InputState state) diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index cb657825de..ce8d190dc0 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -36,7 +36,7 @@ namespace osu.Game.Graphics.UserInterface /// /// Easing for the counter rollover animation. /// - protected virtual EasingTypes RollingEasing => EasingTypes.OutQuint; + protected virtual Easing RollingEasing => Easing.OutQuint; private T displayedCount; diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index a1fa48e3cd..ee4fc912f3 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -8,7 +8,7 @@ namespace osu.Game.Graphics.UserInterface public class ScoreCounter : RollingCounter { protected override double RollingDuration => 1000; - protected override EasingTypes RollingEasing => EasingTypes.Out; + protected override Easing RollingEasing => Easing.Out; public bool UseCommaSeparator; diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index c4f98dcbb7..6c5204fed4 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -24,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface private double animationDelay => 80; private double scalingDuration => 1000; - private EasingTypes scalingEasing => EasingTypes.OutElasticHalf; + private Easing scalingEasing => Easing.OutElasticHalf; private float minStarScale => 0.4f; private double fadingDuration => 100; diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index b763cd7971..f290f4fadd 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -173,20 +173,20 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(InputState state) { - this.ResizeTo(SIZE_EXTENDED, transform_time, EasingTypes.OutElastic); - IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic); + this.ResizeTo(SIZE_EXTENDED, transform_time, Easing.OutElastic); + IconLayer.FadeColour(HoverColour, transform_time, Easing.OutElastic); - bouncingIcon.ScaleTo(1.1f, transform_time, EasingTypes.OutElastic); + bouncingIcon.ScaleTo(1.1f, transform_time, Easing.OutElastic); return true; } protected override void OnHoverLost(InputState state) { - this.ResizeTo(SIZE_RETRACTED, transform_time, EasingTypes.OutElastic); - IconLayer.FadeColour(TextLayer.Colour, transform_time, EasingTypes.OutElastic); + this.ResizeTo(SIZE_RETRACTED, transform_time, Easing.OutElastic); + IconLayer.FadeColour(TextLayer.Colour, transform_time, Easing.OutElastic); - bouncingIcon.ScaleTo(1, transform_time, EasingTypes.OutElastic); + bouncingIcon.ScaleTo(1, transform_time, Easing.OutElastic); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -205,7 +205,7 @@ namespace osu.Game.Graphics.UserInterface Add(flash); flash.Alpha = 1; - flash.FadeOut(500, EasingTypes.OutQuint); + flash.FadeOut(500, Easing.OutQuint); flash.Expire(); return base.OnClick(state); @@ -245,9 +245,9 @@ namespace osu.Game.Graphics.UserInterface if (beatIndex < 0) return; - icon.ScaleTo(1 - 0.1f * amplitudeAdjust, beat_in_time, EasingTypes.Out) + icon.ScaleTo(1 - 0.1f * amplitudeAdjust, beat_in_time, Easing.Out) .Then() - .ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + .ScaleTo(1, beatLength * 2, Easing.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs index 57eea71086..41fa60bec2 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs @@ -82,6 +82,6 @@ namespace osu.Game.Graphics.UserInterface.Volume return true; } - private void updateFill() => meterFill.ScaleTo(new Vector2(1, (float)Volume), 300, EasingTypes.OutQuint); + private void updateFill() => meterFill.ScaleTo(new Vector2(1, (float)Volume), 300, Easing.OutQuint); } } \ No newline at end of file diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 881ee891c1..2cfd1f8214 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -234,10 +234,10 @@ namespace osu.Game switch (settings.State) { case Visibility.Hidden: - intro.MoveToX(0, SettingsOverlay.TRANSITION_LENGTH, EasingTypes.OutQuint); + intro.MoveToX(0, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); break; case Visibility.Visible: - intro.MoveToX(SettingsOverlay.SIDEBAR_WIDTH / 2, SettingsOverlay.TRANSITION_LENGTH, EasingTypes.OutQuint); + intro.MoveToX(SettingsOverlay.SIDEBAR_WIDTH / 2, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); break; } }; diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 7b11ba2de0..791377187b 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -156,7 +156,7 @@ namespace osu.Game.Overlays.Chat protected override bool OnHover(InputState state) { if (!channel.Joined.Value) - name.FadeColour(hoverColour, 50, EasingTypes.OutQuint); + name.FadeColour(hoverColour, 50, Easing.OutQuint); return base.OnHover(state); } diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 380275475b..368d3cc5ef 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Chat AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, LayoutDuration = 200, - LayoutEasing = EasingTypes.OutQuint, + LayoutEasing = Easing.OutQuint, Spacing = new Vector2(0f, 20f), Padding = new MarginPadding { Vertical = 20, Left = WIDTH_PADDING }, }, @@ -160,8 +160,8 @@ namespace osu.Game.Overlays.Chat { if (Alpha == 0) this.MoveToY(DrawHeight); - this.FadeIn(transition_duration, EasingTypes.OutQuint); - this.MoveToY(0, transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, Easing.OutQuint); + this.MoveToY(0, transition_duration, Easing.OutQuint); search.HoldFocus = true; base.PopIn(); @@ -169,8 +169,8 @@ namespace osu.Game.Overlays.Chat protected override void PopOut() { - this.FadeOut(transition_duration, EasingTypes.InSine); - this.MoveToY(DrawHeight, transition_duration, EasingTypes.InSine); + this.FadeOut(transition_duration, Easing.InSine); + this.MoveToY(DrawHeight, transition_duration, Easing.InSine); search.HoldFocus = false; base.PopOut(); diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index cb85bdb0c9..c3c930eba0 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -86,30 +86,30 @@ namespace osu.Game.Overlays.Chat private void fadeActive() { - this.ResizeTo(new Vector2(Width, 1.1f), transition_length, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(Width, 1.1f), transition_length, Easing.OutQuint); - box.FadeColour(backgroundActive, transition_length, EasingTypes.OutQuint); - highlightBox.FadeIn(transition_length, EasingTypes.OutQuint); + box.FadeColour(backgroundActive, transition_length, Easing.OutQuint); + highlightBox.FadeIn(transition_length, Easing.OutQuint); - text.FadeOut(transition_length, EasingTypes.OutQuint); - textBold.FadeIn(transition_length, EasingTypes.OutQuint); + text.FadeOut(transition_length, Easing.OutQuint); + textBold.FadeIn(transition_length, Easing.OutQuint); } private void fadeInactive() { - this.ResizeTo(new Vector2(Width, 1), transition_length, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(Width, 1), transition_length, Easing.OutQuint); - box.FadeColour(backgroundInactive, transition_length, EasingTypes.OutQuint); - highlightBox.FadeOut(transition_length, EasingTypes.OutQuint); + box.FadeColour(backgroundInactive, transition_length, Easing.OutQuint); + highlightBox.FadeOut(transition_length, Easing.OutQuint); - text.FadeIn(transition_length, EasingTypes.OutQuint); - textBold.FadeOut(transition_length, EasingTypes.OutQuint); + text.FadeIn(transition_length, Easing.OutQuint); + textBold.FadeOut(transition_length, Easing.OutQuint); } protected override bool OnHover(InputState state) { if (!Active) - box.FadeColour(backgroundHover, transition_length, EasingTypes.OutQuint); + box.FadeColour(backgroundHover, transition_length, Easing.OutQuint); return true; } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index fd1e78e801..53d926fb4f 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -177,8 +177,8 @@ namespace osu.Game.Overlays inputTextBox.HoldFocus = false; if (1f - chatHeight.Value < channel_selection_min_height) { - chatContainer.ResizeHeightTo(1f - channel_selection_min_height, 800, EasingTypes.OutQuint); - channelSelectionContainer.ResizeHeightTo(channel_selection_min_height, 800, EasingTypes.OutQuint); + chatContainer.ResizeHeightTo(1f - channel_selection_min_height, 800, Easing.OutQuint); + channelSelectionContainer.ResizeHeightTo(channel_selection_min_height, 800, Easing.OutQuint); channelSelection.Show(); chatHeight.Value = 1f - channel_selection_min_height; } @@ -235,8 +235,8 @@ namespace osu.Game.Overlays protected override void PopIn() { - this.MoveToY(0, transition_length, EasingTypes.OutQuint); - this.FadeIn(transition_length, EasingTypes.OutQuint); + this.MoveToY(0, transition_length, Easing.OutQuint); + this.FadeIn(transition_length, Easing.OutQuint); inputTextBox.HoldFocus = true; base.PopIn(); @@ -244,8 +244,8 @@ namespace osu.Game.Overlays protected override void PopOut() { - this.MoveToY(Height, transition_length, EasingTypes.InSine); - this.FadeOut(transition_length, EasingTypes.InSine); + this.MoveToY(Height, transition_length, Easing.InSine); + this.FadeOut(transition_length, Easing.InSine); inputTextBox.HoldFocus = false; base.PopOut(); @@ -328,7 +328,7 @@ namespace osu.Game.Overlays var loaded = loadedChannels.Find(d => d.Channel == value); if (loaded == null) { - currentChannelContainer.FadeOut(500, EasingTypes.OutQuint); + currentChannelContainer.FadeOut(500, Easing.OutQuint); loading.Show(); loaded = new DrawableChannel(currentChannel); @@ -340,7 +340,7 @@ namespace osu.Game.Overlays currentChannelContainer.Clear(false); currentChannelContainer.Add(loaded); - currentChannelContainer.FadeIn(500, EasingTypes.OutQuint); + currentChannelContainer.FadeIn(500, Easing.OutQuint); }); } else diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 39338ba3e1..97aae2f49c 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -115,17 +115,17 @@ namespace osu.Game.Overlays.Dialog ring.ResizeTo(ringMinifiedSize); } - content.FadeIn(ENTER_DURATION, EasingTypes.OutQuint); - ring.ResizeTo(ringSize, ENTER_DURATION, EasingTypes.OutQuint); - buttonsContainer.TransformSpacingTo(Vector2.Zero, ENTER_DURATION, EasingTypes.OutQuint); - buttonsContainer.MoveToY(0, ENTER_DURATION, EasingTypes.OutQuint); + content.FadeIn(ENTER_DURATION, Easing.OutQuint); + ring.ResizeTo(ringSize, ENTER_DURATION, Easing.OutQuint); + buttonsContainer.TransformSpacingTo(Vector2.Zero, ENTER_DURATION, Easing.OutQuint); + buttonsContainer.MoveToY(0, ENTER_DURATION, Easing.OutQuint); } protected override void PopOut() { base.PopOut(); - content.FadeOut(EXIT_DURATION, EasingTypes.InSine); + content.FadeOut(EXIT_DURATION, Easing.InSine); } public PopupDialog() diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index b384e110f9..012e93f10d 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -44,13 +44,13 @@ namespace osu.Game.Overlays protected override void PopIn() { base.PopIn(); - this.FadeIn(PopupDialog.ENTER_DURATION, EasingTypes.OutQuint); + this.FadeIn(PopupDialog.ENTER_DURATION, Easing.OutQuint); } protected override void PopOut() { base.PopOut(); - this.FadeOut(PopupDialog.EXIT_DURATION, EasingTypes.InSine); + this.FadeOut(PopupDialog.EXIT_DURATION, Easing.InSine); } public DialogOverlay() diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index cc7d57e04b..b7631d5794 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -41,9 +41,9 @@ namespace osu.Game.Overlays.Direct { base.LoadComplete(); - this.FadeInFromZero(200, EasingTypes.Out); + this.FadeInFromZero(200, Easing.Out); bottomPanel.LayoutDuration = 200; - bottomPanel.LayoutEasing = EasingTypes.Out; + bottomPanel.LayoutEasing = Easing.Out; bottomPanel.Origin = Anchor.BottomLeft; } diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 1b36798639..8319270b8e 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Direct { base.LoadComplete(); - this.FadeInFromZero(200, EasingTypes.Out); + this.FadeInFromZero(200, Easing.Out); } [BackgroundDependencyLoader] @@ -171,25 +171,25 @@ namespace osu.Game.Overlays.Direct protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - icon.ScaleTo(0.9f, 1000, EasingTypes.Out); + icon.ScaleTo(0.9f, 1000, Easing.Out); return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - icon.ScaleTo(1f, 500, EasingTypes.OutElastic); + icon.ScaleTo(1f, 500, Easing.OutElastic); return base.OnMouseUp(state, args); } protected override bool OnHover(InputState state) { - icon.ScaleTo(1.1f, 500, EasingTypes.OutElastic); + icon.ScaleTo(1.1f, 500, Easing.OutElastic); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - icon.ScaleTo(1f, 500, EasingTypes.OutElastic); + icon.ScaleTo(1f, 500, Easing.OutElastic); } } } diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 4fc9a922a8..09b634de81 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Direct Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), }) { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 5fa90ab1d6..f10d542830 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -169,7 +169,7 @@ namespace osu.Game.Overlays private void updateResultCounts() { - resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, EasingTypes.OutQuint); + resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, Easing.OutQuint); if (ResultAmounts == null) return; resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " + diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index 0f53fb2d5c..95e0fef9aa 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -40,7 +40,7 @@ namespace osu.Game.Overlays AutoSizeAxes = Axes.Y, Masking = true, AutoSizeDuration = transition_time, - AutoSizeEasing = EasingTypes.OutQuint, + AutoSizeEasing = Easing.OutQuint, Children = new Drawable[] { settingsSection = new LoginSettings @@ -67,7 +67,7 @@ namespace osu.Game.Overlays base.PopIn(); settingsSection.Bounding = true; - this.FadeIn(transition_time, EasingTypes.OutQuint); + this.FadeIn(transition_time, Easing.OutQuint); InputManager.ChangeFocus(settingsSection); } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 6e9ad3fafe..064f42ecaf 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -205,7 +205,7 @@ namespace osu.Game.Overlays using (BeginDelayedSequence(200, true)) { disc.FadeIn(initial_duration) - .ScaleTo(1f, initial_duration * 2, EasingTypes.OutElastic); + .ScaleTo(1f, initial_duration * 2, Easing.OutElastic); particleContainer.FadeIn(initial_duration); outerSpin.FadeTo(0.1f, initial_duration * 2); @@ -213,8 +213,8 @@ namespace osu.Game.Overlays using (BeginDelayedSequence(initial_duration + 200, true)) { backgroundStrip.FadeIn(step_duration); - leftStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint); - rightStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint); + leftStrip.ResizeWidthTo(1f, step_duration, Easing.OutQuint); + rightStrip.ResizeWidthTo(1f, step_duration, Easing.OutQuint); this.Animate().Schedule(() => { diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 89e991f5ef..56b26e7176 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -149,15 +149,15 @@ namespace osu.Game.Overlays.MedalSplash case DisplayState.Icon: medalContainer .FadeIn(duration) - .ScaleTo(1, duration, EasingTypes.OutElastic); + .ScaleTo(1, duration, Easing.OutElastic); break; case DisplayState.MedalUnlocked: medalContainer .FadeTo(1) .ScaleTo(1); - this.ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); - this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo); + this.ScaleTo(scale_when_unlocked, duration, Easing.OutExpo); + this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, Easing.OutExpo); unlocked.FadeInFromZero(duration); break; case DisplayState.Full: @@ -165,8 +165,8 @@ namespace osu.Game.Overlays.MedalSplash .FadeTo(1) .ScaleTo(1); - this.ScaleTo(scale_when_full, duration, EasingTypes.OutExpo); - this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo); + this.ScaleTo(scale_when_full, duration, Easing.OutExpo); + this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, Easing.OutExpo); name.FadeInFromZero(duration + 100); description.FadeInFromZero(duration * 2); break; diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index bea0aae57e..3ca4a204a5 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Mods public string TooltipText => (SelectedMod?.Description ?? Mods.FirstOrDefault()?.Description) ?? string.Empty; - private const EasingTypes mod_switch_easing = EasingTypes.InOutSine; + private const Easing mod_switch_easing = Easing.InOutSine; private const double mod_switch_duration = 120; // A selected index of -1 means not selected. @@ -67,8 +67,8 @@ namespace osu.Game.Overlays.Mods if (beforeSelected != Selected) { - iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic); - iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic); + iconsContainer.RotateTo(Selected ? 5f : 0f, 300, Easing.OutElastic); + iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, Easing.OutElastic); } if (modBefore != modAfter) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index ca74189c86..703deea382 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -66,14 +66,14 @@ namespace osu.Game.Overlays.Mods { base.PopOut(); - rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, APPEAR_DURATION, EasingTypes.InSine); - rankedMultiplerContainer.FadeOut(APPEAR_DURATION, EasingTypes.InSine); + rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, APPEAR_DURATION, Easing.InSine); + rankedMultiplerContainer.FadeOut(APPEAR_DURATION, Easing.InSine); foreach (ModSection section in modSectionsContainer.Children) { - section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), APPEAR_DURATION, EasingTypes.InSine); - section.ButtonsContainer.MoveToX(100f, APPEAR_DURATION, EasingTypes.InSine); - section.ButtonsContainer.FadeOut(APPEAR_DURATION, EasingTypes.InSine); + section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), APPEAR_DURATION, Easing.InSine); + section.ButtonsContainer.MoveToX(100f, APPEAR_DURATION, Easing.InSine); + section.ButtonsContainer.FadeOut(APPEAR_DURATION, Easing.InSine); } } @@ -81,14 +81,14 @@ namespace osu.Game.Overlays.Mods { base.PopIn(); - rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, EasingTypes.OutQuint); - rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, EasingTypes.OutQuint); + rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, Easing.OutQuint); + rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, Easing.OutQuint); foreach (ModSection section in modSectionsContainer.Children) { - section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, EasingTypes.OutQuint); - section.ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint); - section.ButtonsContainer.FadeIn(button_duration, EasingTypes.OutQuint); + section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, Easing.OutQuint); + section.ButtonsContainer.MoveToX(0, button_duration, Easing.OutQuint); + section.ButtonsContainer.FadeIn(button_duration, Easing.OutQuint); } } diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index ca46bdea95..a0198fe435 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -90,7 +90,7 @@ namespace osu.Game.Overlays.Music public ItemSearchContainer() { LayoutDuration = 200; - LayoutEasing = EasingTypes.OutQuint; + LayoutEasing = Easing.OutQuint; } } } diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index d6a69c1a80..75503067c8 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -101,15 +101,15 @@ namespace osu.Game.Overlays.Music filter.Search.HoldFocus = true; Schedule(() => inputManager.ChangeFocus(filter.Search)); - this.ResizeTo(new Vector2(1, playlist_height), transition_duration, EasingTypes.OutQuint); - this.FadeIn(transition_duration, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(1, playlist_height), transition_duration, Easing.OutQuint); + this.FadeIn(transition_duration, Easing.OutQuint); } protected override void PopOut() { filter.Search.HoldFocus = false; - this.ResizeTo(new Vector2(1, 0), transition_duration, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(1, 0), transition_duration, Easing.OutQuint); this.FadeOut(transition_duration); } diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 9d726b3952..b435c505c9 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -82,7 +82,7 @@ namespace osu.Game.Overlays protected override bool OnDragEnd(InputState state) { - dragContainer.MoveTo(Vector2.Zero, 800, EasingTypes.OutElastic); + dragContainer.MoveTo(Vector2.Zero, 800, Easing.OutElastic); return base.OnDragEnd(state); } @@ -204,7 +204,7 @@ namespace osu.Game.Overlays beatmapBacking.BindTo(game.Beatmap); - playlist.StateChanged += (c, s) => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, EasingTypes.OutQuint); + playlist.StateChanged += (c, s) => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } protected override void LoadComplete() @@ -345,13 +345,13 @@ namespace osu.Game.Overlays { case TransformDirection.Next: d.Position = new Vector2(400, 0); - d.MoveToX(0, 500, EasingTypes.OutCubic); - currentBackground.MoveToX(-400, 500, EasingTypes.OutCubic); + d.MoveToX(0, 500, Easing.OutCubic); + currentBackground.MoveToX(-400, 500, Easing.OutCubic); break; case TransformDirection.Prev: d.Position = new Vector2(-400, 0); - d.MoveToX(0, 500, EasingTypes.OutCubic); - currentBackground.MoveToX(400, 500, EasingTypes.OutCubic); + d.MoveToX(0, 500, Easing.OutCubic); + currentBackground.MoveToX(400, 500, Easing.OutCubic); break; } currentBackground.Expire(); @@ -368,16 +368,16 @@ namespace osu.Game.Overlays { base.PopIn(); - this.FadeIn(transition_length, EasingTypes.OutQuint); - dragContainer.ScaleTo(1, transition_length, EasingTypes.OutElastic); + this.FadeIn(transition_length, Easing.OutQuint); + dragContainer.ScaleTo(1, transition_length, Easing.OutElastic); } protected override void PopOut() { base.PopOut(); - this.FadeOut(transition_length, EasingTypes.OutQuint); - dragContainer.ScaleTo(0.9f, transition_length, EasingTypes.OutQuint); + this.FadeOut(transition_length, Easing.OutQuint); + dragContainer.ScaleTo(0.9f, transition_length, Easing.OutQuint); } private enum TransformDirection diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index f83aeb1275..ad0236ae1f 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -89,8 +89,8 @@ namespace osu.Game.Overlays { base.PopIn(); - scrollContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); - this.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); + scrollContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); + this.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); this.FadeTo(1, TRANSITION_LENGTH / 2); } @@ -105,7 +105,7 @@ namespace osu.Game.Overlays markAllRead(); - this.MoveToX(width, TRANSITION_LENGTH, EasingTypes.OutQuint); + this.MoveToX(width, TRANSITION_LENGTH, Easing.OutQuint); this.FadeTo(0, TRANSITION_LENGTH / 2); } } diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 4337989a13..a590507f41 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -137,7 +137,7 @@ namespace osu.Game.Overlays.Notifications base.LoadComplete(); this.FadeInFromZero(200); NotificationContent.MoveToX(DrawSize.X); - NotificationContent.MoveToX(0, 500, EasingTypes.OutQuint); + NotificationContent.MoveToX(0, 500, Easing.OutQuint); } private bool wasClosed; @@ -213,7 +213,7 @@ namespace osu.Game.Overlays.Notifications { const float length = 1000; pulsateLayer.Loop(length / 2, - p => p.FadeTo(0.4f, length, EasingTypes.In).Then().FadeTo(1, length, EasingTypes.Out) + p => p.FadeTo(0.4f, length, Easing.In).Then().FadeTo(1, length, Easing.Out) ); } } diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 831b09e7e9..efd3b39ee2 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -114,7 +114,7 @@ namespace osu.Game.Overlays.Notifications AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, LayoutDuration = 150, - LayoutEasing = EasingTypes.OutQuart, + LayoutEasing = Easing.OutQuart, Spacing = new Vector2(3), } }); diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index bd7b8bf844..98aac3a02d 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Notifications switch (state) { case ProgressNotificationState.Completed: - NotificationContent.MoveToY(-DrawSize.Y / 2, 200, EasingTypes.OutQuint); + NotificationContent.MoveToY(-DrawSize.Y / 2, 200, Easing.OutQuint); this.FadeOut(200).Finally(d => Completed()); break; } @@ -181,7 +181,7 @@ namespace osu.Game.Overlays.Notifications if (progress == value) return; progress = value; - box.ResizeTo(new Vector2(progress, 1), 100, EasingTypes.OutQuad); + box.ResizeTo(new Vector2(progress, 1), 100, Easing.OutQuad); } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 65bef22295..746b6dd50f 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -155,11 +155,11 @@ namespace osu.Game.Overlays textLine3.Text = shortcut.ToUpper(); box.Animate( - b => b.FadeIn(500, EasingTypes.OutQuint), - b => b.ResizeHeightTo(height, 500, EasingTypes.OutQuint) + b => b.FadeIn(500, Easing.OutQuint), + b => b.ResizeHeightTo(height, 500, Easing.OutQuint) ).Then( - b => b.FadeOutFromOne(1500, EasingTypes.InQuint), - b => b.ResizeHeightTo(height_contracted, 1500, EasingTypes.InQuint) + b => b.FadeOutFromOne(1500, Easing.InQuint), + b => b.ResizeHeightTo(height_contracted, 1500, Easing.InQuint) ); int optionCount = 0; @@ -231,13 +231,13 @@ namespace osu.Game.Overlays { if (glowing) { - fill.FadeColour(glowingColour, transition_speed, EasingTypes.OutQuint); - FadeEdgeEffectTo(glow_strength, transition_speed, EasingTypes.OutQuint); + fill.FadeColour(glowingColour, transition_speed, Easing.OutQuint); + FadeEdgeEffectTo(glow_strength, transition_speed, Easing.OutQuint); } else { - FadeEdgeEffectTo(0, transition_speed, EasingTypes.OutQuint); - fill.FadeColour(idleColour, transition_speed, EasingTypes.OutQuint); + FadeEdgeEffectTo(0, transition_speed, Easing.OutQuint); + fill.FadeColour(idleColour, transition_speed, Easing.OutQuint); } } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index aa57816701..d42ebc3384 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -517,13 +517,13 @@ namespace osu.Game.Overlays.Profile protected override bool OnHover(InputState state) { - this.FadeColour(hoverColour, 500, EasingTypes.OutQuint); + this.FadeColour(hoverColour, 500, Easing.OutQuint); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - this.FadeColour(Color4.White, 500, EasingTypes.OutQuint); + this.FadeColour(Color4.White, 500, Easing.OutQuint); base.OnHoverLost(state); } diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index dfd2219e1f..416bcedfea 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -138,7 +138,7 @@ namespace osu.Game.Overlays.Profile public void ResetBall() { - ball.MoveTo(new Vector2(1, GetYPosition(Values.Last())), ballShown ? transform_duration : 0, EasingTypes.OutQuint); + ball.MoveTo(new Vector2(1, GetYPosition(Values.Last())), ballShown ? transform_duration : 0, Easing.OutQuint); ball.Show(); BallRelease(); ballShown = true; @@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Profile float y = GetYPosition(values[i]); if (Math.Abs(y * DrawHeight - position.Y) <= 8f) { - ball.MoveTo(new Vector2(index / (float)(count - 1), y), transform_duration, EasingTypes.OutQuint); + ball.MoveTo(new Vector2(index / (float)(count - 1), y), transform_duration, Easing.OutQuint); BallMove(i); } } diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index bbecdff29a..6268a9753a 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -291,7 +291,7 @@ namespace osu.Game.Overlays.Settings.Sections.General { set { - statusIcon.FadeColour(value, 500, EasingTypes.OutQuint); + statusIcon.FadeColour(value, 500, Easing.OutQuint); } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 5f8900449a..c4ce742153 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, AutoSizeDuration = transition_duration, - AutoSizeEasing = EasingTypes.OutQuint, + AutoSizeEasing = Easing.OutQuint, Masking = true, Children = new Drawable[] @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None; if (!isVisible) - letterboxSettings.ResizeHeightTo(0, transition_duration, EasingTypes.OutQuint); + letterboxSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); }; letterboxing.TriggerChange(); } diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index f5ab3b301b..6eafc65d12 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -94,10 +94,10 @@ namespace osu.Game.Overlays.Settings switch (state) { default: - this.ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, Easing.OutQuint); break; case ExpandedState.Expanded: - this.ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, Easing.OutQuint); break; } } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 1fdab08112..1dcabbfa15 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -125,8 +125,8 @@ namespace osu.Game.Overlays { base.PopIn(); - sectionsContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); - sidebar.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); + sectionsContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); + sidebar.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); this.FadeTo(1, TRANSITION_LENGTH / 2); searchTextBox.HoldFocus = true; @@ -136,8 +136,8 @@ namespace osu.Game.Overlays { base.PopOut(); - sectionsContainer.MoveToX(-width, TRANSITION_LENGTH, EasingTypes.OutQuint); - sidebar.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, EasingTypes.OutQuint); + sectionsContainer.MoveToX(-width, TRANSITION_LENGTH, Easing.OutQuint); + sidebar.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, Easing.OutQuint); this.FadeTo(0, TRANSITION_LENGTH / 2); searchTextBox.HoldFocus = false; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 9070bc45ad..bef9de6b6b 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -107,29 +107,29 @@ namespace osu.Game.Overlays.Toolbar protected override bool OnHover(InputState state) { - solidBackground.FadeTo(alpha_hovering, transition_time, EasingTypes.OutQuint); - gradientBackground.FadeIn(transition_time, EasingTypes.OutQuint); + solidBackground.FadeTo(alpha_hovering, transition_time, Easing.OutQuint); + gradientBackground.FadeIn(transition_time, Easing.OutQuint); return true; } protected override void OnHoverLost(InputState state) { - solidBackground.FadeTo(alpha_normal, transition_time, EasingTypes.OutQuint); - gradientBackground.FadeOut(transition_time, EasingTypes.OutQuint); + solidBackground.FadeTo(alpha_normal, transition_time, Easing.OutQuint); + gradientBackground.FadeOut(transition_time, Easing.OutQuint); } } protected override void PopIn() { - this.MoveToY(0, transition_time, EasingTypes.OutQuint); - this.FadeIn(transition_time / 2, EasingTypes.OutQuint); + this.MoveToY(0, transition_time, Easing.OutQuint); + this.FadeIn(transition_time / 2, Easing.OutQuint); } protected override void PopOut() { userArea?.LoginOverlay.Hide(); - this.MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint); + this.MoveToY(-DrawSize.Y, transition_time, Easing.OutQuint); this.FadeOut(transition_time); } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 38fd954fe3..b5e832d381 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -135,7 +135,7 @@ namespace osu.Game.Overlays.Toolbar protected override bool OnClick(InputState state) { - HoverBackground.FlashColour(Color4.White.Opacity(100), 500, EasingTypes.OutQuint); + HoverBackground.FlashColour(Color4.White.Opacity(100), 500, Easing.OutQuint); return base.OnClick(state); } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 3ecf0fd83c..f48cb681a8 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -115,7 +115,7 @@ namespace osu.Game.Overlays.Toolbar if (!activeMode.IsValid) { - modeButtonLine.MoveToX(activeButton.DrawPosition.X, 200, EasingTypes.OutQuint); + modeButtonLine.MoveToX(activeButton.DrawPosition.X, 200, Easing.OutQuint); activeMode.Validate(); } } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index f26b143088..f604eb5cd2 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -73,13 +73,13 @@ namespace osu.Game.Overlays protected override void PopIn() { base.PopIn(); - FadeEdgeEffectTo(0.5f, APPEAR_DURATION, EasingTypes.In); + FadeEdgeEffectTo(0.5f, APPEAR_DURATION, Easing.In); } protected override void PopOut() { base.PopOut(); - FadeEdgeEffectTo(0, DISAPPEAR_DURATION, EasingTypes.Out); + FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out); } public void ShowUser(User user, bool fetchOnline = true) diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index ce587c9ed2..fd89dcfbc4 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -17,8 +17,8 @@ namespace osu.Game.Overlays protected const float APPEAR_DURATION = 800; protected const float DISAPPEAR_DURATION = 500; - private const EasingTypes easing_show = EasingTypes.OutSine; - private const EasingTypes easing_hide = EasingTypes.InSine; + private const Easing easing_show = Easing.OutSine; + private const Easing easing_hide = Easing.InSine; private readonly Wave firstWave; private readonly Wave secondWave; @@ -137,23 +137,23 @@ namespace osu.Game.Overlays foreach (var w in wavesContainer.Children) w.State = Visibility.Visible; - this.FadeIn(100, EasingTypes.OutQuint); - contentContainer.MoveToY(0, APPEAR_DURATION, EasingTypes.OutQuint); + this.FadeIn(100, Easing.OutQuint); + contentContainer.MoveToY(0, APPEAR_DURATION, Easing.OutQuint); - this.FadeIn(100, EasingTypes.OutQuint); + this.FadeIn(100, Easing.OutQuint); } protected override void PopOut() { base.PopOut(); - this.FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); - contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, EasingTypes.In); + this.FadeOut(DISAPPEAR_DURATION, Easing.InQuint); + contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, Easing.In); foreach (var w in wavesContainer.Children) w.State = Visibility.Hidden; - this.FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); + this.FadeOut(DISAPPEAR_DURATION, Easing.InQuint); } protected override void UpdateAfterChildren() diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index ac8a8e2005..f0a53d677b 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -64,22 +64,22 @@ namespace osu.Game.Rulesets.Judgements { base.LoadComplete(); - this.FadeInFromZero(100, EasingTypes.OutQuint); + this.FadeInFromZero(100, Easing.OutQuint); switch (Judgement.Result) { case HitResult.Miss: this.ScaleTo(1.6f); - this.ScaleTo(1, 100, EasingTypes.In); + this.ScaleTo(1, 100, Easing.In); - this.MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); - this.RotateTo(40, 800, EasingTypes.InQuint); + this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint); + this.RotateTo(40, 800, Easing.InQuint); this.Delay(600).FadeOut(200); break; case HitResult.Hit: this.ScaleTo(0.9f); - this.ScaleTo(1, 500, EasingTypes.OutElastic); + this.ScaleTo(1, 500, Easing.OutElastic); this.Delay(100).FadeOut(400); break; diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index a9cb93876c..c5bbf04075 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -56,29 +56,29 @@ namespace osu.Game.Screens Content.FadeOut(); Content.MoveToX(x_movement_amount); - Content.FadeIn(transition_length, EasingTypes.InOutQuart); - Content.MoveToX(0, transition_length, EasingTypes.InOutQuart); + Content.FadeIn(transition_length, Easing.InOutQuart); + Content.MoveToX(0, transition_length, Easing.InOutQuart); base.OnEntering(last); } protected override void OnSuspending(Screen next) { - Content.MoveToX(-x_movement_amount, transition_length, EasingTypes.InOutQuart); + Content.MoveToX(-x_movement_amount, transition_length, Easing.InOutQuart); base.OnSuspending(next); } protected override bool OnExiting(Screen next) { - Content.FadeOut(transition_length, EasingTypes.OutExpo); - Content.MoveToX(x_movement_amount, transition_length, EasingTypes.OutExpo); + Content.FadeOut(transition_length, Easing.OutExpo); + Content.MoveToX(x_movement_amount, transition_length, Easing.OutExpo); return base.OnExiting(next); } protected override void OnResuming(Screen last) { - Content.MoveToX(0, transition_length, EasingTypes.OutExpo); + Content.MoveToX(0, transition_length, Easing.OutExpo); base.OnResuming(last); } } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index ac5ea04ecc..29a422892f 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Backgrounds Beatmap = beatmap; } - public void BlurTo(Vector2 sigma, double duration, EasingTypes easing = EasingTypes.None) + public void BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None) { background?.BlurTo(sigma, duration, easing); blurTarget = sigma; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index bab267a24a..de84e90baf 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Backgrounds private void display(Background newBackground) { - current?.FadeOut(800, EasingTypes.OutQuint); + current?.FadeOut(800, Easing.OutQuint); current?.Expire(); Add(current = newBackground); diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index e04e3ce66b..e55c4ef4fe 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -128,14 +128,14 @@ namespace osu.Game.Screens.Menu bool rightward = beatIndex % 2 == 1; double duration = timingPoint.BeatLength / 2; - icon.RotateTo(rightward ? 10 : -10, duration * 2, EasingTypes.InOutSine); + icon.RotateTo(rightward ? 10 : -10, duration * 2, Easing.InOutSine); icon.Animate( - i => i.MoveToY(-10, duration, EasingTypes.Out), - i => i.ScaleTo(1, duration, EasingTypes.Out) + i => i.MoveToY(-10, duration, Easing.Out), + i => i.ScaleTo(1, duration, Easing.Out) ).Then( - i => i.MoveToY(0, duration, EasingTypes.In), - i => i.ScaleTo(new Vector2(1, 0.9f), duration, EasingTypes.In) + i => i.MoveToY(0, duration, Easing.In), + i => i.ScaleTo(new Vector2(1, 0.9f), duration, Easing.In) ); } @@ -145,25 +145,25 @@ namespace osu.Game.Screens.Menu sampleHover?.Play(); - box.ScaleTo(new Vector2(1.5f, 1), 500, EasingTypes.OutElastic); + box.ScaleTo(new Vector2(1.5f, 1), 500, Easing.OutElastic); double duration = TimeUntilNextBeat; icon.ClearTransforms(); - icon.RotateTo(10, duration, EasingTypes.InOutSine); - icon.ScaleTo(new Vector2(1, 0.9f), duration, EasingTypes.Out); + icon.RotateTo(10, duration, Easing.InOutSine); + icon.ScaleTo(new Vector2(1, 0.9f), duration, Easing.Out); return true; } protected override void OnHoverLost(InputState state) { icon.ClearTransforms(); - icon.RotateTo(0, 500, EasingTypes.Out); - icon.MoveTo(Vector2.Zero, 500, EasingTypes.Out); - icon.ScaleTo(Vector2.One, 200, EasingTypes.Out); + icon.RotateTo(0, 500, Easing.Out); + icon.MoveTo(Vector2.Zero, 500, Easing.Out); + icon.ScaleTo(Vector2.One, 200, Easing.Out); if (State == ButtonState.Expanded) - box.ScaleTo(new Vector2(1, 1), 500, EasingTypes.OutElastic); + box.ScaleTo(new Vector2(1, 1), 500, Easing.OutElastic); } [BackgroundDependencyLoader] @@ -176,13 +176,13 @@ namespace osu.Game.Screens.Menu protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - boxHoverLayer.FadeTo(0.1f, 1000, EasingTypes.OutQuint); + boxHoverLayer.FadeTo(0.1f, 1000, Easing.OutQuint); return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - boxHoverLayer.FadeTo(0, 1000, EasingTypes.OutQuint); + boxHoverLayer.FadeTo(0, 1000, Easing.OutQuint); return base.OnMouseUp(state, args); } @@ -214,7 +214,7 @@ namespace osu.Game.Screens.Menu boxHoverLayer.ClearTransforms(); boxHoverLayer.Alpha = 0.9f; - boxHoverLayer.FadeOut(800, EasingTypes.OutExpo); + boxHoverLayer.FadeOut(800, Easing.OutExpo); } public override bool HandleInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f; @@ -246,23 +246,23 @@ namespace osu.Game.Screens.Menu switch (ContractStyle) { default: - box.ScaleTo(new Vector2(0, 1), 500, EasingTypes.OutExpo); + box.ScaleTo(new Vector2(0, 1), 500, Easing.OutExpo); this.FadeOut(500); break; case 1: - box.ScaleTo(new Vector2(0, 1), 400, EasingTypes.InSine); + box.ScaleTo(new Vector2(0, 1), 400, Easing.InSine); this.FadeOut(800); break; } break; case ButtonState.Expanded: const int expand_duration = 500; - box.ScaleTo(new Vector2(1, 1), expand_duration, EasingTypes.OutExpo); + box.ScaleTo(new Vector2(1, 1), expand_duration, Easing.OutExpo); this.FadeIn(expand_duration / 6f); break; case ButtonState.Exploded: const int explode_duration = 200; - box.ScaleTo(new Vector2(2, 1), explode_duration, EasingTypes.OutExpo); + box.ScaleTo(new Vector2(2, 1), explode_duration, Easing.OutExpo); this.FadeOut(explode_duration / 4f * 3); break; } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 65ba555630..71f2a16c09 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -224,13 +224,13 @@ namespace osu.Game.Screens.Menu { case MenuState.Exit: case MenuState.Initial: - buttonAreaBackground.ScaleTo(Vector2.One, 500, EasingTypes.Out); + buttonAreaBackground.ScaleTo(Vector2.One, 500, Easing.Out); buttonArea.FadeOut(300); osuLogo.Delay(150) .Schedule(() => toolbar?.Hide()) - .ScaleTo(1, 800, EasingTypes.OutExpo) - .MoveTo(Vector2.Zero, 800, EasingTypes.OutExpo); + .ScaleTo(1, 800, Easing.OutExpo) + .MoveTo(Vector2.Zero, 800, Easing.OutExpo); foreach (Button b in buttonsTopLevel) b.State = ButtonState.Contracted; @@ -247,11 +247,11 @@ namespace osu.Game.Screens.Menu sampleBack?.Play(); break; case MenuState.TopLevel: - buttonAreaBackground.ScaleTo(Vector2.One, 200, EasingTypes.Out); + buttonAreaBackground.ScaleTo(Vector2.One, 200, Easing.Out); var sequence = osuLogo - .ScaleTo(0.5f, 200, EasingTypes.In) - .MoveTo(buttonFlow.DrawPosition, 200, EasingTypes.In); + .ScaleTo(0.5f, 200, Easing.In) + .MoveTo(buttonFlow.DrawPosition, 200, Easing.In); if (fromInitial && osuLogo.Scale.X > 0.5f) sequence.OnComplete(o => @@ -276,7 +276,7 @@ namespace osu.Game.Screens.Menu b.State = ButtonState.Expanded; break; case MenuState.EnteringMode: - buttonAreaBackground.ScaleTo(new Vector2(2, 0), 300, EasingTypes.InSine); + buttonAreaBackground.ScaleTo(new Vector2(2, 0), 300, Easing.InSine); buttonsTopLevel.ForEach(b => b.ContractStyle = 1); buttonsPlay.ForEach(b => b.ContractStyle = 1); diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 6e42a1bae9..7b16e7e7ad 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -134,8 +134,8 @@ namespace osu.Game.Screens.Menu logo.ScaleTo(0.4f); logo.FadeOut(); - logo.ScaleTo(1, 4400, EasingTypes.OutQuint); - logo.FadeIn(20000, EasingTypes.OutQuint); + logo.ScaleTo(1, 4400, Easing.OutQuint); + logo.FadeIn(20000, Easing.OutQuint); } protected override void OnSuspending(Screen next) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index def9c13c10..2544cc2837 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -118,10 +118,10 @@ namespace osu.Game.Screens.Menu buttons.State = MenuState.EnteringMode; - Content.FadeOut(length, EasingTypes.InSine); - Content.MoveTo(new Vector2(-800, 0), length, EasingTypes.InSine); + Content.FadeOut(length, Easing.InSine); + Content.MoveTo(new Vector2(-800, 0), length, Easing.InSine); - sideFlashes.FadeOut(length / 4, EasingTypes.OutQuint); + sideFlashes.FadeOut(length / 4, Easing.OutQuint); } protected override void OnResuming(Screen last) @@ -137,10 +137,10 @@ namespace osu.Game.Screens.Menu buttons.State = MenuState.TopLevel; - Content.FadeIn(length, EasingTypes.OutQuint); - Content.MoveTo(new Vector2(0, 0), length, EasingTypes.OutQuint); + Content.FadeIn(length, Easing.OutQuint); + Content.MoveTo(new Vector2(0, 0), length, Easing.OutQuint); - sideFlashes.FadeIn(length / 4, EasingTypes.InQuint); + sideFlashes.FadeIn(length / 4, Easing.InQuint); } protected override bool OnExiting(Screen next) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index fdacccd913..4ecf78e764 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -92,7 +92,7 @@ namespace osu.Game.Screens.Menu { d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time) .Then() - .FadeOut(beatLength, EasingTypes.In); + .FadeOut(beatLength, Easing.In); } } } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 0b05b68080..64c28816d8 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -240,27 +240,27 @@ namespace osu.Game.Screens.Menu this.Delay(early_activation).Schedule(() => sampleBeat.Play()); logoBeatContainer - .ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, EasingTypes.Out) + .ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, Easing.Out) .Then() - .ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + .ScaleTo(1, beatLength * 2, Easing.OutQuint); ripple.ClearTransforms(); ripple .ScaleTo(logoAmplitudeContainer.Scale) - .ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, EasingTypes.OutQuint) - .FadeTo(0.15f * amplitudeAdjust).FadeOut(beatLength, EasingTypes.OutQuint); + .ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, Easing.OutQuint) + .FadeTo(0.15f * amplitudeAdjust).FadeOut(beatLength, Easing.OutQuint); if (effectPoint.KiaiMode && flashLayer.Alpha < 0.4f) { flashLayer.ClearTransforms(); flashLayer - .FadeTo(0.2f * amplitudeAdjust, early_activation, EasingTypes.Out) + .FadeTo(0.2f * amplitudeAdjust, early_activation, Easing.Out) .Then() .FadeOut(beatLength); visualizer.ClearTransforms(); visualizer - .FadeTo(0.9f * amplitudeAdjust, early_activation, EasingTypes.Out) + .FadeTo(0.9f * amplitudeAdjust, early_activation, Easing.Out) .Then() .FadeTo(0.5f, beatLength); } @@ -274,7 +274,7 @@ namespace osu.Game.Screens.Menu const float velocity_adjust_cutoff = 0.98f; var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; - logoAmplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 75, EasingTypes.OutQuint); + logoAmplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 75, Easing.OutQuint); if (maxAmplitude > velocity_adjust_cutoff) triangles.Velocity = 1 + Math.Max(0, maxAmplitude - velocity_adjust_cutoff) * 50; @@ -286,13 +286,13 @@ namespace osu.Game.Screens.Menu { if (!Interactive) return false; - logoBounceContainer.ScaleTo(0.9f, 1000, EasingTypes.Out); + logoBounceContainer.ScaleTo(0.9f, 1000, Easing.Out); return true; } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - logoBounceContainer.ScaleTo(1f, 500, EasingTypes.OutElastic); + logoBounceContainer.ScaleTo(1f, 500, Easing.OutElastic); return true; } @@ -304,7 +304,7 @@ namespace osu.Game.Screens.Menu flashLayer.ClearTransforms(); flashLayer.Alpha = 0.4f; - flashLayer.FadeOut(1500, EasingTypes.OutExpo); + flashLayer.FadeOut(1500, Easing.OutExpo); Action?.Invoke(); return true; @@ -314,18 +314,18 @@ namespace osu.Game.Screens.Menu { if (!Interactive) return false; - logoHoverContainer.ScaleTo(1.1f, 500, EasingTypes.OutElastic); + logoHoverContainer.ScaleTo(1.1f, 500, Easing.OutElastic); return true; } protected override void OnHoverLost(InputState state) { - logoHoverContainer.ScaleTo(1, 500, EasingTypes.OutElastic); + logoHoverContainer.ScaleTo(1, 500, Easing.OutElastic); } public void Impact() { - impactContainer.FadeOutFromOne(250, EasingTypes.In); + impactContainer.FadeOutFromOne(250, Easing.In); impactContainer.ScaleTo(0.96f); impactContainer.ScaleTo(1.12f, 250); } diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index d8963be116..8e2d9e0200 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -235,7 +235,7 @@ namespace osu.Game.Screens.Multiplayer Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), }) { RelativeSizeAxes = Axes.Both }, }; diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 83950b4387..5a9b3e4d11 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -337,7 +337,7 @@ namespace osu.Game.Screens.Multiplayer Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), }) { RelativeSizeAxes = Axes.Both }, }; diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index c6b1bbcf31..47099f96e9 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Play.HUD protected virtual double PopOutDuration => 150; protected virtual float PopOutScale => 2.0f; - protected virtual EasingTypes PopOutEasing => EasingTypes.None; + protected virtual Easing PopOutEasing => Easing.None; protected virtual float PopOutInitialAlpha => 0.75f; protected virtual double FadeOutDuration => 100; @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play.HUD /// /// Easing for the counter rollover animation. /// - protected EasingTypes RollingEasing => EasingTypes.None; + protected Easing RollingEasing => Easing.None; protected SpriteText DisplayedCountSpriteText; diff --git a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs index 1686b6174d..a4732f6796 100644 --- a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs @@ -12,7 +12,7 @@ namespace osu.Game.Screens.Play.HUD public class ComboResultCounter : RollingCounter { protected override double RollingDuration => 500; - protected override EasingTypes RollingEasing => EasingTypes.Out; + protected override Easing RollingEasing => Easing.Out; protected override double GetProportionalDuration(long currentValue, long newValue) { diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index e72310f1fe..18a3096d7c 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -76,20 +76,20 @@ namespace osu.Game.Screens.Play.HUD private void appearTransform() { if (mods.Value.Any(m => !m.Ranked)) - unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint); + unrankedText.FadeInFromZero(fade_duration, Easing.OutQuint); else unrankedText.Hide(); iconsContainer.FinishTransforms(); - iconsContainer.FadeInFromZero(fade_duration, EasingTypes.OutQuint); + iconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint); expand(); using (iconsContainer.BeginDelayedSequence(1200)) contract(); } - private void expand() => iconsContainer.TransformSpacingTo(new Vector2(5, 0), 500, EasingTypes.OutQuint); + private void expand() => iconsContainer.TransformSpacingTo(new Vector2(5, 0), 500, Easing.OutQuint); - private void contract() => iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, EasingTypes.OutQuint); + private void contract() => iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, Easing.OutQuint); protected override bool OnHover(InputState state) { diff --git a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index b4b3bd885e..06ef87276a 100644 --- a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -97,11 +97,11 @@ namespace osu.Game.Screens.Play.HUD if (judgement.Result == HitResult.Miss) return; - fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint) + fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, Easing.OutQuint) .Delay(glow_fade_delay) - .FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint); + .FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, Easing.OutQuint); } - protected override void SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, EasingTypes.OutQuint); + protected override void SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, Easing.OutQuint); } } diff --git a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs index c4d956ebce..11f9a484dd 100644 --- a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs +++ b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Play if (args.Key == Key.Tilde) { - overlay.FadeIn(activate_delay, EasingTypes.Out); + overlay.FadeIn(activate_delay, Easing.Out); return true; } @@ -57,7 +57,7 @@ namespace osu.Game.Screens.Play { if (args.Key == Key.Tilde && !fired) { - overlay.FadeOut(fadeout_delay, EasingTypes.Out); + overlay.FadeOut(fadeout_delay, Easing.Out); return true; } diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index ee08bcc031..a0f867d248 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -76,8 +76,8 @@ namespace osu.Game.Screens.Play public override bool HandleInput => State == Visibility.Visible; - protected override void PopIn() => this.FadeIn(transition_duration, EasingTypes.In); - protected override void PopOut() => this.FadeOut(transition_duration, EasingTypes.In); + protected override void PopIn() => this.FadeIn(transition_duration, Easing.In); + protected override void PopOut() => this.FadeOut(transition_duration, Easing.In); // Don't let mouse down events through the overlay or people can click circles while paused. protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c22a02ed35..cda4713575 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -262,8 +262,8 @@ namespace osu.Game.Screens.Play if (!loadedSuccessfully) return; - (Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, EasingTypes.OutQuint); - Background?.FadeTo(1 - (float)dimLevel, 1500, EasingTypes.OutQuint); + (Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, Easing.OutQuint); + Background?.FadeTo(1 - (float)dimLevel, 1500, Easing.OutQuint); Content.Alpha = 0; @@ -271,7 +271,7 @@ namespace osu.Game.Screens.Play Content .ScaleTo(0.7f) - .ScaleTo(1, 750, EasingTypes.OutQuint) + .ScaleTo(1, 750, Easing.OutQuint) .Delay(250) .FadeIn(250); @@ -282,7 +282,7 @@ namespace osu.Game.Screens.Play }); pauseContainer.Alpha = 0; - pauseContainer.FadeIn(750, EasingTypes.OutQuint); + pauseContainer.FadeIn(750, Easing.OutQuint); } protected override void OnSuspending(Screen next) @@ -314,7 +314,7 @@ namespace osu.Game.Screens.Play HitRenderer?.FadeOut(fade_out_duration); Content.FadeOut(fade_out_duration); - hudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, EasingTypes.In); + hudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, Easing.In); Background?.FadeTo(1f, fade_out_duration); } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index bd4ca768b8..d9bdb50ef0 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -82,13 +82,13 @@ namespace osu.Game.Screens.Play private void contentIn() { - Content.ScaleTo(1, 650, EasingTypes.OutQuint); + Content.ScaleTo(1, 650, Easing.OutQuint); Content.FadeInFromZero(400); } private void contentOut() { - Content.ScaleTo(0.7f, 300, EasingTypes.InQuint); + Content.ScaleTo(0.7f, 300, Easing.InQuint); Content.FadeOut(250); } @@ -102,7 +102,7 @@ namespace osu.Game.Screens.Play contentIn(); - logo.Delay(500).MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo); + logo.Delay(500).MoveToOffset(new Vector2(0, -180), 500, Easing.InOutExpo); info.Delay(750).FadeIn(500); this.Delay(2150).Schedule(pushWhenLoaded); } @@ -131,7 +131,7 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(Screen next) { - Content.ScaleTo(0.7f, 150, EasingTypes.InQuint); + Content.ScaleTo(0.7f, 150, Easing.InQuint); this.FadeOut(150); return base.OnExiting(next); diff --git a/osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs b/osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs index a2494d3a69..06cd783cae 100644 --- a/osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs +++ b/osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs @@ -94,7 +94,7 @@ namespace osu.Game.Screens.Play.ReplaySettings Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeDuration = transition_duration, - AutoSizeEasing = EasingTypes.OutQuint, + AutoSizeEasing = Easing.OutQuint, AutoSizeAxes = Axes.Y, Padding = new MarginPadding(15), Spacing = new Vector2(0, 15), @@ -123,10 +123,10 @@ namespace osu.Game.Screens.Play.ReplaySettings else { content.AutoSizeAxes = Axes.None; - content.ResizeHeightTo(0, transition_duration, EasingTypes.OutQuint); + content.ResizeHeightTo(0, transition_duration, Easing.OutQuint); } - button.FadeColour(expanded ? buttonActiveColour : Color4.White, 200, EasingTypes.OutQuint); + button.FadeColour(expanded ? buttonActiveColour : Color4.White, 200, Easing.OutQuint); } } } diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index 6637680c15..b2d5abe71a 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -114,7 +114,7 @@ namespace osu.Game.Screens.Play protected override void Update() { base.Update(); - remainingTimeBox.ResizeWidthTo((float)Math.Max(0, 1 - (Time.Current - displayTime) / (beginFadeTime - displayTime)), 120, EasingTypes.OutQuint); + remainingTimeBox.ResizeWidthTo((float)Math.Max(0, 1 - (Time.Current - displayTime) / (beginFadeTime - displayTime)), 120, Easing.OutQuint); } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) @@ -154,14 +154,14 @@ namespace osu.Game.Screens.Play { case Visibility.Visible: if (lastState == Visibility.Hidden) - this.FadeIn(500, EasingTypes.OutExpo); + this.FadeIn(500, Easing.OutExpo); if (!IsHovered) using (BeginDelayedSequence(1000)) scheduledHide = Schedule(() => State = Visibility.Hidden); break; case Visibility.Hidden: - this.FadeOut(1000, EasingTypes.OutExpo); + this.FadeOut(1000, Easing.OutExpo); break; } } @@ -249,29 +249,29 @@ namespace osu.Game.Screens.Play protected override bool OnHover(InputState state) { - flow.TransformSpacingTo(new Vector2(5), 500, EasingTypes.OutQuint); - box.FadeColour(colourHover, 500, EasingTypes.OutQuint); - background.FadeTo(0.4f, 500, EasingTypes.OutQuint); + flow.TransformSpacingTo(new Vector2(5), 500, Easing.OutQuint); + box.FadeColour(colourHover, 500, Easing.OutQuint); + background.FadeTo(0.4f, 500, Easing.OutQuint); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - flow.TransformSpacingTo(new Vector2(0), 500, EasingTypes.OutQuint); - box.FadeColour(colourNormal, 500, EasingTypes.OutQuint); - background.FadeTo(0.2f, 500, EasingTypes.OutQuint); + flow.TransformSpacingTo(new Vector2(0), 500, Easing.OutQuint); + box.FadeColour(colourNormal, 500, Easing.OutQuint); + background.FadeTo(0.2f, 500, Easing.OutQuint); base.OnHoverLost(state); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - aspect.ScaleTo(0.75f, 2000, EasingTypes.OutQuint); + aspect.ScaleTo(0.75f, 2000, Easing.OutQuint); return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - aspect.ScaleTo(1, 1000, EasingTypes.OutElastic); + aspect.ScaleTo(1, 1000, Easing.OutElastic); return base.OnMouseUp(state, args); } @@ -280,8 +280,8 @@ namespace osu.Game.Screens.Play if (!Enabled) return false; - box.FlashColour(Color4.White, 500, EasingTypes.OutQuint); - aspect.ScaleTo(1.2f, 2000, EasingTypes.OutQuint); + box.FlashColour(Color4.White, 500, Easing.OutQuint); + aspect.ScaleTo(1.2f, 2000, Easing.OutQuint); bool result = base.OnClick(state); diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index b0684b80cc..c513daf3d9 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -121,14 +121,14 @@ namespace osu.Game.Screens.Play private void updateBarVisibility() { - bar.FadeTo(allowSeeking ? 1 : 0, transition_duration, EasingTypes.In); - this.MoveTo(new Vector2(0, allowSeeking ? 0 : bottom_bar_height), transition_duration, EasingTypes.In); + bar.FadeTo(allowSeeking ? 1 : 0, transition_duration, Easing.In); + this.MoveTo(new Vector2(0, allowSeeking ? 0 : bottom_bar_height), transition_duration, Easing.In); } protected override void PopIn() { updateBarVisibility(); - this.FadeIn(500, EasingTypes.OutQuint); + this.FadeIn(500, Easing.OutQuint); } protected override void PopOut() diff --git a/osu.Game/Screens/Ranking/ResultModeButton.cs b/osu.Game/Screens/Ranking/ResultModeButton.cs index 4789a5abb7..50be5c8d00 100644 --- a/osu.Game/Screens/Ranking/ResultModeButton.cs +++ b/osu.Game/Screens/Ranking/ResultModeButton.cs @@ -92,8 +92,8 @@ namespace osu.Game.Screens.Ranking }; } - protected override void OnActivated() => colouredPart.FadeColour(activeColour, 200, EasingTypes.OutQuint); + protected override void OnActivated() => colouredPart.FadeColour(activeColour, 200, Easing.OutQuint); - protected override void OnDeactivated() => colouredPart.FadeColour(inactiveColour, 200, EasingTypes.OutQuint); + protected override void OnDeactivated() => colouredPart.FadeColour(inactiveColour, 200, Easing.OutQuint); } } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index a0bf42599b..60ad484673 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Ranking protected override void OnEntering(Screen last) { base.OnEntering(last); - (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, EasingTypes.OutQuint); + (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, Easing.OutQuint); allCircles.ForEach(c => { @@ -68,27 +68,27 @@ namespace osu.Game.Screens.Ranking currentPage.FadeOut(); circleOuterBackground - .FadeIn(transition_time, EasingTypes.OutQuint) - .ScaleTo(1, transition_time, EasingTypes.OutQuint); + .FadeIn(transition_time, Easing.OutQuint) + .ScaleTo(1, transition_time, Easing.OutQuint); using (BeginDelayedSequence(transition_time * 0.25f, true)) { circleOuter - .FadeIn(transition_time, EasingTypes.OutQuint) - .ScaleTo(1, transition_time, EasingTypes.OutQuint); + .FadeIn(transition_time, Easing.OutQuint) + .ScaleTo(1, transition_time, Easing.OutQuint); using (BeginDelayedSequence(transition_time * 0.3f, true)) { - backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint); + backgroundParallax.FadeIn(transition_time, Easing.OutQuint); circleInner - .FadeIn(transition_time, EasingTypes.OutQuint) - .ScaleTo(1, transition_time, EasingTypes.OutQuint); + .FadeIn(transition_time, Easing.OutQuint) + .ScaleTo(1, transition_time, Easing.OutQuint); using (BeginDelayedSequence(transition_time * 0.4f, true)) { - modeChangeButtons.FadeIn(transition_time, EasingTypes.OutQuint); - currentPage.FadeIn(transition_time, EasingTypes.OutQuint); + modeChangeButtons.FadeIn(transition_time, Easing.OutQuint); + currentPage.FadeIn(transition_time, Easing.OutQuint); } } } @@ -98,7 +98,7 @@ namespace osu.Game.Screens.Ranking { allCircles.ForEach(c => { - c.ScaleTo(0, transition_time, EasingTypes.OutSine); + c.ScaleTo(0, transition_time, Easing.OutSine); }); Content.FadeOut(transition_time / 4); diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 09db835144..c5b7b85cf4 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -158,7 +158,7 @@ namespace osu.Game.Screens.Ranking Origin = Anchor.TopCentre, Direction = FillDirection.Horizontal, LayoutDuration = 200, - LayoutEasing = EasingTypes.OutQuint + LayoutEasing = Easing.OutQuint } } } @@ -180,7 +180,7 @@ namespace osu.Game.Screens.Ranking { s.FadeOut() .Then(delay += 200) - .FadeIn(300 + delay, EasingTypes.Out); + .FadeIn(300 + delay, Easing.Out); } }); } @@ -372,7 +372,7 @@ namespace osu.Game.Screens.Ranking { protected override double RollingDuration => 3000; - protected override EasingTypes RollingEasing => EasingTypes.OutPow10; + protected override Easing RollingEasing => Easing.OutPow10; public SlowScoreCounter(uint leading = 0) : base(leading) { diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index 7eac2407e9..5596f345d5 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -46,18 +46,18 @@ namespace osu.Game.Screens using (Content.BeginDelayedSequence(300, true)) { - boxContainer.ScaleTo(1, transition_time, EasingTypes.OutElastic); - boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); + boxContainer.ScaleTo(1, transition_time, Easing.OutElastic); + boxContainer.RotateTo(0, transition_time / 2, Easing.OutQuint); - textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo); - Content.FadeIn(transition_time, EasingTypes.OutExpo); + textContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo); + Content.FadeIn(transition_time, Easing.OutExpo); } } protected override bool OnExiting(Screen next) { - textContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, EasingTypes.OutExpo); - Content.FadeOut(transition_time, EasingTypes.OutExpo); + textContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, Easing.OutExpo); + Content.FadeOut(transition_time, Easing.OutExpo); return base.OnExiting(next); } @@ -66,16 +66,16 @@ namespace osu.Game.Screens { base.OnSuspending(next); - textContainer.MoveTo(new Vector2(-(DrawSize.X / 16), 0), transition_time, EasingTypes.OutExpo); - Content.FadeOut(transition_time, EasingTypes.OutExpo); + textContainer.MoveTo(new Vector2(-(DrawSize.X / 16), 0), transition_time, Easing.OutExpo); + Content.FadeOut(transition_time, Easing.OutExpo); } protected override void OnResuming(Screen last) { base.OnResuming(last); - textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo); - Content.FadeIn(transition_time, EasingTypes.OutExpo); + textContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo); + Content.FadeIn(transition_time, Easing.OutExpo); } public ScreenWhiteBox() diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index b696d637e6..7f49109bd0 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -341,7 +341,7 @@ namespace osu.Game.Screens.Select if (group.State == BeatmapGroupState.Expanded) { - group.Header.MoveToX(-100, 500, EasingTypes.OutExpo); + group.Header.MoveToX(-100, 500, Easing.OutExpo); var headerY = group.Header.Position.Y; foreach (BeatmapPanel panel in group.BeatmapPanels) @@ -349,7 +349,7 @@ namespace osu.Game.Screens.Select if (panel == selectedPanel) selectedY = currentY + panel.DrawHeight / 2 - DrawHeight / 2; - panel.MoveToX(-50, 500, EasingTypes.OutExpo); + panel.MoveToX(-50, 500, Easing.OutExpo); //on first display we want to begin hidden under our group's header. if (panel.Alpha == 0) @@ -360,11 +360,11 @@ namespace osu.Game.Screens.Select } else { - group.Header.MoveToX(0, 500, EasingTypes.OutExpo); + group.Header.MoveToX(0, 500, Easing.OutExpo); foreach (BeatmapPanel panel in group.BeatmapPanels) { - panel.MoveToX(0, 500, EasingTypes.OutExpo); + panel.MoveToX(0, 500, Easing.OutExpo); movePanel(panel, false, animated, ref currentY); } } @@ -379,7 +379,7 @@ namespace osu.Game.Screens.Select private void movePanel(Panel panel, bool advance, bool animated, ref float currentY) { yPositions.Add(currentY); - panel.MoveToY(currentY, animated ? 750 : 0, EasingTypes.OutExpo); + panel.MoveToY(currentY, animated ? 750 : 0, Easing.OutExpo); if (advance) currentY += panel.DrawHeight + 5; diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 9ad932ff26..972d563ca5 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -119,12 +119,12 @@ namespace osu.Game.Screens.Select ratingsGraph.Values = ratings.Select(rating => (float)rating); - ratingsContainer.FadeColour(Color4.White, 500, EasingTypes.Out); + ratingsContainer.FadeColour(Color4.White, 500, Easing.Out); } else if (failOnMissing) ratingsGraph.Values = new float[10]; else - ratingsContainer.FadeColour(Color4.Gray, 500, EasingTypes.Out); + ratingsContainer.FadeColour(Color4.Gray, 500, Easing.Out); if (hasRetriesFails) { @@ -139,7 +139,7 @@ namespace osu.Game.Screens.Select failGraph.Values = fails.Select(fail => (float)fail); retryGraph.Values = retries.Zip(fails, (retry, fail) => retry + MathHelper.Clamp(fail, 0, maxValue)); - retryFailContainer.FadeColour(Color4.White, 500, EasingTypes.Out); + retryFailContainer.FadeColour(Color4.White, 500, Easing.Out); } else if (failOnMissing) { @@ -147,7 +147,7 @@ namespace osu.Game.Screens.Select retryGraph.Values = new float[100]; } else - retryFailContainer.FadeColour(Color4.Gray, 500, EasingTypes.Out); + retryFailContainer.FadeColour(Color4.Gray, 500, Easing.Out); } public BeatmapDetails() @@ -169,7 +169,7 @@ namespace osu.Game.Screens.Select Width = 0.4f, Direction = FillDirection.Vertical, LayoutDuration = 200, - LayoutEasing = EasingTypes.OutQuint, + LayoutEasing = Easing.OutQuint, Children = new[] { description = new MetadataSegment("Description"), diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index fbe0015d52..c2282beae8 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -57,14 +57,14 @@ namespace osu.Game.Screens.Select protected override void PopIn() { - this.MoveToX(0, 800, EasingTypes.OutQuint); - this.RotateTo(0, 800, EasingTypes.OutQuint); + this.MoveToX(0, 800, Easing.OutQuint); + this.RotateTo(0, 800, Easing.OutQuint); } protected override void PopOut() { - this.MoveToX(-100, 800, EasingTypes.InQuint); - this.RotateTo(10, 800, EasingTypes.InQuint); + this.MoveToX(-100, 800, Easing.InQuint); + this.RotateTo(10, 800, Easing.InQuint); } public void UpdateBeatmap(WorkingBeatmap beatmap) diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 33252f78f8..bb6d16da0f 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Select Action = action, }); - private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, EasingTypes.OutQuint); + private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, Easing.OutQuint); public Footer() { diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 536bf3971a..ae6c7d3c1e 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -89,27 +89,27 @@ namespace osu.Game.Screens.Select protected override bool OnHover(InputState state) { Hovered?.Invoke(); - light.ScaleTo(new Vector2(1, 2), Footer.TRANSITION_LENGTH, EasingTypes.OutQuint); - light.FadeColour(SelectedColour, Footer.TRANSITION_LENGTH, EasingTypes.OutQuint); + light.ScaleTo(new Vector2(1, 2), Footer.TRANSITION_LENGTH, Easing.OutQuint); + light.FadeColour(SelectedColour, Footer.TRANSITION_LENGTH, Easing.OutQuint); return true; } protected override void OnHoverLost(InputState state) { HoverLost?.Invoke(); - light.ScaleTo(new Vector2(1, 1), Footer.TRANSITION_LENGTH, EasingTypes.OutQuint); - light.FadeColour(DeselectedColour, Footer.TRANSITION_LENGTH, EasingTypes.OutQuint); + light.ScaleTo(new Vector2(1, 1), Footer.TRANSITION_LENGTH, Easing.OutQuint); + light.FadeColour(DeselectedColour, Footer.TRANSITION_LENGTH, Easing.OutQuint); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - box.FadeTo(0.3f, Footer.TRANSITION_LENGTH * 2, EasingTypes.OutQuint); + box.FadeTo(0.3f, Footer.TRANSITION_LENGTH * 2, Easing.OutQuint); return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - box.FadeOut(Footer.TRANSITION_LENGTH, EasingTypes.OutQuint); + box.FadeOut(Footer.TRANSITION_LENGTH, Easing.OutQuint); return base.OnMouseUp(state, args); } @@ -117,7 +117,7 @@ namespace osu.Game.Screens.Select { box.ClearTransforms(); box.Alpha = 1; - box.FadeOut(Footer.TRANSITION_LENGTH * 3, EasingTypes.OutQuint); + box.FadeOut(Footer.TRANSITION_LENGTH * 3, Easing.OutQuint); return base.OnClick(state); } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index b0e234e5a2..c2d2f82b5c 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -62,15 +62,15 @@ namespace osu.Game.Screens.Select.Leaderboards break; case Visibility.Visible: this.FadeIn(200); - content.MoveToY(0, 800, EasingTypes.OutQuint); + content.MoveToY(0, 800, Easing.OutQuint); using (BeginDelayedSequence(100, true)) { - avatar.FadeIn(300, EasingTypes.OutQuint); - nameLabel.FadeIn(350, EasingTypes.OutQuint); + avatar.FadeIn(300, Easing.OutQuint); + nameLabel.FadeIn(350, Easing.OutQuint); - avatar.MoveToX(0, 300, EasingTypes.OutQuint); - nameLabel.MoveToX(0, 350, EasingTypes.OutQuint); + avatar.MoveToX(0, 300, Easing.OutQuint); + nameLabel.MoveToX(0, 350, Easing.OutQuint); using (BeginDelayedSequence(250, true)) { @@ -269,13 +269,13 @@ namespace osu.Game.Screens.Select.Leaderboards protected override bool OnHover(Framework.Input.InputState state) { - background.FadeTo(0.5f, 300, EasingTypes.OutQuint); + background.FadeTo(0.5f, 300, Easing.OutQuint); return base.OnHover(state); } protected override void OnHoverLost(Framework.Input.InputState state) { - background.FadeTo(background_alpha, 200, EasingTypes.OutQuint); + background.FadeTo(background_alpha, 200, Easing.OutQuint); base.OnHoverLost(state); } diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index 58ce5ac564..ab02e8678f 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -54,13 +54,13 @@ namespace osu.Game.Screens.Select.Options protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - flash.FadeTo(0.1f, 1000, EasingTypes.OutQuint); + flash.FadeTo(0.1f, 1000, Easing.OutQuint); return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - flash.FadeTo(0, 1000, EasingTypes.OutQuint); + flash.FadeTo(0, 1000, Easing.OutQuint); return base.OnMouseUp(state, args); } @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Select.Options { flash.ClearTransforms(); flash.Alpha = 0.9f; - flash.FadeOut(800, EasingTypes.OutExpo); + flash.FadeOut(800, Easing.OutExpo); return base.OnClick(state); } diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index 4b9a85f7f8..0a410f0e0f 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -29,27 +29,27 @@ namespace osu.Game.Screens.Select.Options { base.PopIn(); - this.FadeIn(transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, Easing.OutQuint); if (buttonsContainer.Position.X == 1 || Alpha == 0) buttonsContainer.MoveToX(x_position - x_movement); - holder.ScaleTo(new Vector2(1, 1), transition_duration / 2, EasingTypes.OutQuint); + holder.ScaleTo(new Vector2(1, 1), transition_duration / 2, Easing.OutQuint); - buttonsContainer.MoveToX(x_position, transition_duration, EasingTypes.OutQuint); - buttonsContainer.TransformSpacingTo(Vector2.Zero, transition_duration, EasingTypes.OutQuint); + buttonsContainer.MoveToX(x_position, transition_duration, Easing.OutQuint); + buttonsContainer.TransformSpacingTo(Vector2.Zero, transition_duration, Easing.OutQuint); } protected override void PopOut() { base.PopOut(); - holder.ScaleTo(new Vector2(1, 0), transition_duration / 2, EasingTypes.InSine); + holder.ScaleTo(new Vector2(1, 0), transition_duration / 2, Easing.InSine); - buttonsContainer.MoveToX(x_position + x_movement, transition_duration, EasingTypes.InSine); - buttonsContainer.TransformSpacingTo(new Vector2(200f, 0f), transition_duration, EasingTypes.InSine); + buttonsContainer.MoveToX(x_position + x_movement, transition_duration, Easing.InSine); + buttonsContainer.TransformSpacingTo(new Vector2(200f, 0f), transition_duration, Easing.InSine); - this.FadeOut(transition_duration, EasingTypes.InQuint); + this.FadeOut(transition_duration, Easing.InQuint); } public BeatmapOptionsOverlay() diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index baa0f180f5..09fd22ecbe 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -312,14 +312,14 @@ namespace osu.Game.Screens.Select Content.FadeIn(250); - Content.ScaleTo(1, 250, EasingTypes.OutSine); + Content.ScaleTo(1, 250, Easing.OutSine); FilterControl.Activate(); } protected override void OnSuspending(Screen next) { - Content.ScaleTo(1.1f, 250, EasingTypes.InSine); + Content.ScaleTo(1.1f, 250, Easing.InSine); Content.FadeOut(250); diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 8920ca2be8..8dc0110312 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -296,7 +296,7 @@ namespace osu.Game.Screens.Tournament } } - private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => + private void speedTo(float value, double duration = 0, Easing easing = Easing.None) => this.TransformTo(nameof(speed), value, duration, easing); private enum ScrollState diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index b3c227855d..d51df8ccaa 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -169,7 +169,7 @@ namespace osu.Game.Users private void load(OsuColour colours, UserProfileOverlay profile) { Status.ValueChanged += displayStatus; - Status.ValueChanged += status => statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, EasingTypes.OutQuint); + Status.ValueChanged += status => statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); base.Action = () => { @@ -190,15 +190,15 @@ namespace osu.Game.Users if (status == null) { - statusBar.ResizeHeightTo(0f, transition_duration, EasingTypes.OutQuint); - statusBar.FadeOut(transition_duration, EasingTypes.OutQuint); - this.ResizeHeightTo(height - status_height, transition_duration, EasingTypes.OutQuint); + statusBar.ResizeHeightTo(0f, transition_duration, Easing.OutQuint); + statusBar.FadeOut(transition_duration, Easing.OutQuint); + this.ResizeHeightTo(height - status_height, transition_duration, Easing.OutQuint); } else { - statusBar.ResizeHeightTo(status_height, transition_duration, EasingTypes.OutQuint); - statusBar.FadeIn(transition_duration, EasingTypes.OutQuint); - this.ResizeHeightTo(height, transition_duration, EasingTypes.OutQuint); + statusBar.ResizeHeightTo(status_height, transition_duration, Easing.OutQuint); + statusBar.FadeIn(transition_duration, Easing.OutQuint); + this.ResizeHeightTo(height, transition_duration, Easing.OutQuint); statusMessage.Text = status.Message; } From c6250e1da52bbf19b865baf75f0e86e96fc5da2f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 23 Jul 2017 11:34:09 +0900 Subject: [PATCH 063/132] Supress compiler warning I don't think this is a sustainable solution if we start doing this in more places. --- osu.Game/Screens/Tournament/ScrollingTeamContainer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 8920ca2be8..ae0f6e4b3f 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -28,7 +28,11 @@ namespace osu.Game.Screens.Tournament private readonly Container tracker; +#pragma warning disable 649 + // set via reflection. private float speed; +#pragma warning restore 649 + private int expiredCount; private float offset; From 436e155e23dc40c3199b797237b278d87edea3a2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 23 Jul 2017 13:47:48 +0900 Subject: [PATCH 064/132] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index eda38950b5..b2d10ab19b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit eda38950b57fe0693e1faa6ad8e55f2da9665f91 +Subproject commit b2d10ab19b74ecd38911f8bdf278b42379da0530 From 76edcb4a67d6ed4ef0a2008430addf78d6ba2050 Mon Sep 17 00:00:00 2001 From: Ben Pig Chu Date: Sat, 22 Jul 2017 15:26:47 +0800 Subject: [PATCH 065/132] Update playlist when adding or removing beatmap set --- osu.Game/Overlays/Music/PlaylistList.cs | 11 +++++++++++ osu.Game/Overlays/Music/PlaylistOverlay.cs | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index ca46bdea95..e961b1d69b 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -73,6 +73,17 @@ namespace osu.Game.Overlays.Music }; } + public void AddBeatmapSet(BeatmapSetInfo beatmapSet) + { + items.Add(new PlaylistItem(beatmapSet) { OnSelect = itemSelected }); + } + + public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) + { + PlaylistItem itemToRemove = items.Children.FirstOrDefault(item => item.BeatmapSetInfo == beatmapSet); + if (itemToRemove != null) items.Remove(itemToRemove); + } + private class ItemSearchContainer : FillFlowContainer, IHasFilterableChildren { public string[] FilterTerms => new string[] { }; diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 1e4c3c5ff6..3e93a80872 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -80,6 +80,9 @@ namespace osu.Game.Overlays.Music list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren(b => !b.DeletePending).ToList(); + beatmaps.BeatmapSetAdded += onBeatmapSetAdded; + beatmaps.BeatmapSetRemoved += onBeatmapSetRemoved; + beatmapBacking.BindTo(game.Beatmap); filter.Search.OnCommit = (sender, newText) => @@ -89,6 +92,17 @@ namespace osu.Game.Overlays.Music }; } + protected override void Dispose(bool isDisposing) + { + if (beatmaps != null) + { + beatmaps.BeatmapSetAdded -= onBeatmapSetAdded; + beatmaps.BeatmapSetRemoved -= onBeatmapSetRemoved; + } + + base.Dispose(isDisposing); + } + protected override void LoadComplete() { base.LoadComplete(); @@ -124,6 +138,10 @@ namespace osu.Game.Overlays.Music playSpecified(set.Beatmaps[0]); } + private void onBeatmapSetAdded(BeatmapSetInfo s) => list.AddBeatmapSet(s); + + private void onBeatmapSetRemoved(BeatmapSetInfo s) => list.RemoveBeatmapSet(s); + public void PlayPrevious() { var currentID = beatmapBacking.Value?.BeatmapSetInfo.ID ?? -1; From 950c55d6d0ad021ae5522d851261927c0a2e1fac Mon Sep 17 00:00:00 2001 From: Ben Pig Chu Date: Mon, 24 Jul 2017 13:10:51 +0800 Subject: [PATCH 066/132] No need to dispose/unbind the delegates --- osu.Game/Overlays/Music/PlaylistOverlay.cs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 3e93a80872..cd8fa5377d 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -80,8 +80,8 @@ namespace osu.Game.Overlays.Music list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren(b => !b.DeletePending).ToList(); - beatmaps.BeatmapSetAdded += onBeatmapSetAdded; - beatmaps.BeatmapSetRemoved += onBeatmapSetRemoved; + beatmaps.BeatmapSetAdded += s => list.AddBeatmapSet(s); + beatmaps.BeatmapSetRemoved += s => list.RemoveBeatmapSet(s); beatmapBacking.BindTo(game.Beatmap); @@ -92,17 +92,6 @@ namespace osu.Game.Overlays.Music }; } - protected override void Dispose(bool isDisposing) - { - if (beatmaps != null) - { - beatmaps.BeatmapSetAdded -= onBeatmapSetAdded; - beatmaps.BeatmapSetRemoved -= onBeatmapSetRemoved; - } - - base.Dispose(isDisposing); - } - protected override void LoadComplete() { base.LoadComplete(); @@ -138,10 +127,6 @@ namespace osu.Game.Overlays.Music playSpecified(set.Beatmaps[0]); } - private void onBeatmapSetAdded(BeatmapSetInfo s) => list.AddBeatmapSet(s); - - private void onBeatmapSetRemoved(BeatmapSetInfo s) => list.RemoveBeatmapSet(s); - public void PlayPrevious() { var currentID = beatmapBacking.Value?.BeatmapSetInfo.ID ?? -1; From c80f5c708a424f85d0b1ed3cf10fb0bceaf052c7 Mon Sep 17 00:00:00 2001 From: Nabile Rahmani Date: Mon, 24 Jul 2017 09:25:49 +0200 Subject: [PATCH 067/132] Less verbose DrawableFlag constructor. --- osu.Game/Overlays/Profile/ProfileHeader.cs | 2 +- osu.Game/Screens/Multiplayer/ParticipantInfo.cs | 2 +- osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/Users/Country.cs | 4 ++-- osu.Game/Users/UserPanel.cs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index d42ebc3384..25d28c1744 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Profile Origin = Anchor.BottomLeft, Y = -48 }, - countryFlag = new DrawableFlag(user.Country?.FlagName ?? "__") + countryFlag = new DrawableFlag(user.Country?.FlagName) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, diff --git a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs index 639f29567f..fa48287ce1 100644 --- a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs +++ b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Multiplayer set { host.Text = value.Username; - flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName) { RelativeSizeAxes = Axes.Both } }; } } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index c2d2f82b5c..39c948f8d3 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -191,7 +191,7 @@ namespace osu.Game.Screens.Select.Leaderboards Masking = true, Children = new Drawable[] { - new DrawableFlag(Score.User?.Country?.FlagName ?? "__") + new DrawableFlag(Score.User?.Country?.FlagName) { Width = 30, RelativeSizeAxes = Axes.Y, diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index ac95d22329..bf06d9f8bc 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -49,9 +49,9 @@ namespace osu.Game.Users sprite.Texture = textures.Get($@"Flags/{flagName}"); } - public DrawableFlag(string name = @"__") + public DrawableFlag(string name = null) { - flagName = name; + flagName = name ?? @"__"; Children = new Drawable[] { diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index d51df8ccaa..cd9ca582fc 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -102,7 +102,7 @@ namespace osu.Game.Users Spacing = new Vector2(5f, 0f), Children = new Drawable[] { - new DrawableFlag(user.Country?.FlagName ?? @"__") + new DrawableFlag(user.Country?.FlagName) { Width = 30f, RelativeSizeAxes = Axes.Y, From 5d30efc0908f22f8cbc099ef73307fe4629f7fad Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Mon, 24 Jul 2017 09:57:12 +0200 Subject: [PATCH 068/132] Do not trigger Random if no Beatmaps are imported --- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 7f49109bd0..06ad7c1aa9 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -177,6 +177,9 @@ namespace osu.Game.Screens.Select public void SelectNextRandom() { + if (groups.Count == 0) + return; + randomSelectedBeatmaps.Push(new KeyValuePair(selectedGroup, selectedGroup.SelectedPanel)); var visibleGroups = getVisibleGroups(); From d0e99f0c95cc4101fb8b8246d13cce91e6b9864a Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Mon, 24 Jul 2017 10:25:33 +0200 Subject: [PATCH 069/132] check removed beatmap being null, check promptdelete beatmap being default --- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 +++ osu.Game/Screens/Select/SongSelect.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 06ad7c1aa9..d46d093263 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -313,6 +313,9 @@ namespace osu.Game.Screens.Select private void removeGroup(BeatmapGroup group) { + if (group == null) + return; + groups.Remove(group); panels.Remove(group.Header); foreach (var p in group.BeatmapPanels) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 09fd22ecbe..b2311d6561 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -384,7 +384,7 @@ namespace osu.Game.Screens.Select private void promptDelete() { - if (Beatmap != null) + if (Beatmap != null && !Beatmap.IsDefault) dialogOverlay?.Push(new BeatmapDeleteDialog(Beatmap)); } From ed7bb329de51fcfc5a3bf51590d6cb4a8736e109 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Jul 2017 18:11:25 +0900 Subject: [PATCH 070/132] Add word wrap support to chat --- osu.Game/Overlays/Chat/ChatLine.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 809e771840..fcebca6fe3 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.Effects; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Allocation; using osu.Game.Users; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Chat { @@ -164,10 +165,12 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding { Left = message_padding + padding }, Children = new Drawable[] { - new OsuSpriteText + new OsuTextFlowContainer(t => + { + t.TextSize = text_size; + }) { Text = Message.Content, - TextSize = text_size, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, } From 32a6975521ea06cf5e382b970757f2eab6d037ab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jul 2017 10:16:10 +0900 Subject: [PATCH 071/132] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index d6ccab3776..05a8b26376 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit d6ccab37765ea0dfb3f7a589903760e8d7a1e26d +Subproject commit 05a8b2637623bd8ac6c1619b728ea9b4cca35b8a From fce580d717ef57e2fb1e12f889a8a8c2f387208f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jul 2017 13:22:46 +0900 Subject: [PATCH 072/132] Reshuffle namespaces --- .../Tests/TestCaseBeatmapDetails.cs | 2 +- osu.Desktop.VisualTests/Tests/TestCaseDirect.cs | 3 ++- osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs | 3 ++- osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs | 2 +- osu.Desktop.VisualTests/Tests/TestCaseMods.cs | 2 +- .../Tests/TestCasePlaySongSelect.cs | 4 ++-- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 2 +- osu.Desktop.VisualTests/Tests/TestCaseResults.cs | 1 - .../Tests/TestCaseRoomInspector.cs | 3 ++- .../Beatmaps/ManiaBeatmapConverter.cs | 1 - .../Beatmaps/Patterns/Legacy/PatternGenerator.cs | 1 - osu.Game.Rulesets.Mania/Judgements/HitWindows.cs | 2 +- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 2 +- osu.Game.Rulesets.Mania/Objects/Note.cs | 2 +- .../Scoring/ManiaScoreProcessor.cs | 1 - osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 2 +- .../Beatmaps/TaikoBeatmapConverter.cs | 1 - osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/Hit.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs | 2 +- .../Scoring/TaikoScoreProcessor.cs | 1 - osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 3 ++- osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs | 2 +- osu.Game/Beatmaps/Beatmap.cs | 1 - osu.Game/{Database => Beatmaps}/BeatmapDatabase.cs | 6 +++--- .../BeatmapDatabaseWorkingBeatmap.cs} | 10 +++++----- osu.Game/{Database => Beatmaps}/BeatmapDifficulty.cs | 2 +- osu.Game/{Database => Beatmaps}/BeatmapInfo.cs | 11 ++++++----- osu.Game/{Database => Beatmaps}/BeatmapMetadata.cs | 2 +- osu.Game/{Database => Beatmaps}/BeatmapMetrics.cs | 2 +- osu.Game/{Database => Beatmaps}/BeatmapOnlineInfo.cs | 2 +- osu.Game/{Database => Beatmaps}/BeatmapSetInfo.cs | 2 +- .../{Database => Beatmaps}/BeatmapSetOnlineInfo.cs | 2 +- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 1 - osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs | 1 - .../Beatmaps/Drawables/DifficultyColouredContainer.cs | 1 - osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 1 - osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 1 - osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 1 - osu.Game/{Database => Beatmaps}/RankStatus.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 1 - osu.Game/Database/{Database.cs => DatabaseBacking.cs} | 4 ++-- osu.Game/Graphics/Cursor/GameplayCursor.cs | 1 - osu.Game/IPC/BeatmapIPCChannel.cs | 2 +- osu.Game/IPC/ScoreIPCChannel.cs | 2 +- .../Online/API/Requests/GetBeatmapDetailsRequest.cs | 2 +- osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs | 3 ++- osu.Game/Online/API/Requests/GetScoresRequest.cs | 2 +- osu.Game/Online/Multiplayer/Room.cs | 2 +- osu.Game/OsuGame.cs | 2 +- osu.Game/OsuGameBase.cs | 3 ++- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectListPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectPanel.cs | 2 +- osu.Game/Overlays/Direct/FilterControl.cs | 3 ++- osu.Game/Overlays/DirectOverlay.cs | 3 ++- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/Music/PlaylistItem.cs | 2 +- osu.Game/Overlays/Music/PlaylistList.cs | 2 +- osu.Game/Overlays/Music/PlaylistOverlay.cs | 1 - osu.Game/Overlays/MusicController.cs | 1 - .../Overlays/Settings/Sections/GameplaySection.cs | 1 - osu.Game/Overlays/Settings/SettingsFooter.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarModeButton.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs | 2 +- osu.Game/Rulesets/Objects/HitObject.cs | 2 +- osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs | 2 +- osu.Game/{Database => Rulesets}/RulesetDatabase.cs | 0 osu.Game/{Database => Rulesets}/RulesetInfo.cs | 0 osu.Game/Rulesets/Scoring/Score.cs | 2 +- .../{Database => Rulesets/Scoring}/ScoreDatabase.cs | 6 +++--- osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 2 +- osu.Game/Screens/Multiplayer/ModeTypeInfo.cs | 2 +- osu.Game/Screens/Multiplayer/RoomInspector.cs | 2 +- osu.Game/Screens/OsuScreen.cs | 2 +- osu.Game/Screens/Play/Player.cs | 1 - osu.Game/Screens/Play/PlayerLoader.cs | 1 - osu.Game/Screens/Ranking/ResultsPageScore.cs | 1 - osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/BeatmapDeleteDialog.cs | 1 - osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 1 - osu.Game/Screens/Select/FilterControl.cs | 2 +- osu.Game/Screens/Select/FilterCriteria.cs | 2 +- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- osu.Game/osu.Game.csproj | 6 +++--- 90 files changed, 90 insertions(+), 104 deletions(-) rename osu.Game/{Database => Beatmaps}/BeatmapDatabase.cs (94%) rename osu.Game/{Database/DatabaseWorkingBeatmap.cs => Beatmaps/BeatmapDatabaseWorkingBeatmap.cs} (83%) rename osu.Game/{Database => Beatmaps}/BeatmapDifficulty.cs (96%) rename osu.Game/{Database => Beatmaps}/BeatmapInfo.cs (95%) rename osu.Game/{Database => Beatmaps}/BeatmapMetadata.cs (94%) rename osu.Game/{Database => Beatmaps}/BeatmapMetrics.cs (94%) rename osu.Game/{Database => Beatmaps}/BeatmapOnlineInfo.cs (93%) rename osu.Game/{Database => Beatmaps}/BeatmapSetInfo.cs (94%) rename osu.Game/{Database => Beatmaps}/BeatmapSetOnlineInfo.cs (94%) rename osu.Game/{Database => Beatmaps}/RankStatus.cs (91%) rename osu.Game/Database/{Database.cs => DatabaseBacking.cs} (92%) rename osu.Game/{Database => Rulesets}/RulesetDatabase.cs (100%) rename osu.Game/{Database => Rulesets}/RulesetInfo.cs (100%) rename osu.Game/{Database => Rulesets/Scoring}/ScoreDatabase.cs (93%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 9335938265..111bc03377 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -3,9 +3,9 @@ using osu.Framework.Graphics; using osu.Framework.Testing; -using osu.Game.Database; using osu.Game.Screens.Select; using System.Linq; +using osu.Game.Beatmaps; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs index 2a20bca836..0bda3c013f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -4,8 +4,9 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Testing; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Overlays; +using osu.Game.Rulesets; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 4f4ef9bbb5..20c8156a33 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -7,8 +7,9 @@ using osu.Framework.Testing; using osu.Game.Screens.Multiplayer; using osu.Game.Online.Multiplayer; using osu.Game.Users; -using osu.Game.Database; using osu.Framework.Allocation; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index 0c5f21a185..c7af7550b9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -8,7 +8,6 @@ using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Objects; @@ -19,6 +18,7 @@ using System.Collections.Generic; using osu.Desktop.VisualTests.Beatmaps; using osu.Framework.Allocation; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMods.cs b/osu.Desktop.VisualTests/Tests/TestCaseMods.cs index e626a70e5f..f9dc2caa56 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMods.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMods.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Overlays.Mods; using osu.Framework.Testing; -using osu.Game.Database; +using osu.Game.Rulesets; using osu.Game.Screens.Play.HUD; using OpenTK; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 83a1436357..55fd8b45cc 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -13,7 +13,7 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCasePlaySongSelect : TestCase { - private readonly BeatmapDatabase db; + private readonly BeatmapStore db; public override string Description => @"with fake data"; @@ -30,7 +30,7 @@ namespace osu.Desktop.VisualTests.Tests var backingDatabase = storage.GetDatabase(@"client"); rulesets = new RulesetDatabase(storage, backingDatabase); - db = new BeatmapDatabase(storage, backingDatabase, rulesets); + db = new BeatmapStore(storage, backingDatabase, rulesets); var sets = new List(); diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 088ccb2aa3..c72c014d09 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; using OpenTK; -using osu.Game.Database; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Play; @@ -14,6 +13,7 @@ using OpenTK.Graphics; using osu.Desktop.VisualTests.Beatmaps; using osu.Game.Rulesets.Osu.UI; using osu.Framework.Graphics.Shapes; +using osu.Game.Rulesets; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index 4a980068b9..a553814ce8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -7,7 +7,6 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Users; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index 4d650afed5..232d7bf6e3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -4,10 +4,11 @@ using osu.Framework.Testing; using osu.Framework.Graphics; using osu.Game.Screens.Multiplayer; -using osu.Game.Database; using osu.Game.Online.Multiplayer; using osu.Game.Users; using osu.Framework.Allocation; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 0ed2a0ba6f..b55b9fdb37 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -10,7 +10,6 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Mania.Beatmaps.Patterns; using osu.Game.Rulesets.Mania.MathUtils; -using osu.Game.Database; using osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy; using OpenTK; using osu.Game.Audio; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index e6e3f1d07f..b72618c36c 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -4,7 +4,6 @@ using System; using System.Linq; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Objects; using OpenTK; diff --git a/osu.Game.Rulesets.Mania/Judgements/HitWindows.cs b/osu.Game.Rulesets.Mania/Judgements/HitWindows.cs index 674d83f6f2..52b55a4ff5 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HitWindows.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HitWindows.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Database; +using osu.Game.Beatmaps; namespace osu.Game.Rulesets.Mania.Judgements { diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index fa32d46a88..c3a29b39a8 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -2,8 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Database; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Mania.Objects diff --git a/osu.Game.Rulesets.Mania/Objects/Note.cs b/osu.Game.Rulesets.Mania/Objects/Note.cs index 6c0cacd277..3c4ff4216f 100644 --- a/osu.Game.Rulesets.Mania/Objects/Note.cs +++ b/osu.Game.Rulesets.Mania/Objects/Note.cs @@ -1,8 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Database; using osu.Game.Rulesets.Mania.Judgements; namespace osu.Game.Rulesets.Mania.Objects diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 798d4b8c5b..f575342486 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -4,7 +4,6 @@ using System; using System.Linq; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index e6fd82e6c8..7a311f1467 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using OpenTK; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; using OpenTK.Graphics; -using osu.Game.Database; using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Rulesets.Osu.Objects diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 3b44e38d5e..4d8c030ede 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -6,9 +6,9 @@ using osu.Game.Rulesets.Objects.Types; using System; using System.Collections.Generic; using osu.Game.Rulesets.Objects; -using osu.Game.Database; using System.Linq; using osu.Game.Audio; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Rulesets.Osu.Objects diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 6ba499739a..c4f5dfe97a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -1,8 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Database; using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Rulesets.Osu.Objects diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 5d44da78f9..44f61e2074 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -8,7 +8,6 @@ using osu.Game.Rulesets.Taiko.Objects; using System; using System.Collections.Generic; using System.Linq; -using osu.Game.Database; using osu.Game.IO.Serialization; using osu.Game.Audio; using osu.Game.Rulesets.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index 18e3016fc3..fd9daa269c 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -5,8 +5,8 @@ using osu.Game.Rulesets.Objects.Types; using System; using System.Collections.Generic; using System.Linq; -using osu.Game.Database; using osu.Game.Audio; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Rulesets.Taiko.Objects diff --git a/osu.Game.Rulesets.Taiko/Objects/Hit.cs b/osu.Game.Rulesets.Taiko/Objects/Hit.cs index f31472d0fd..03b9be4157 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Hit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Hit.cs @@ -1,8 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Database; namespace osu.Game.Rulesets.Taiko.Objects { diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index 79bb901112..db368cb112 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -1,8 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Database; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Taiko.UI; diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index f5e2094cbf..70df3d8317 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -3,7 +3,6 @@ using System; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Judgements; diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 24970b8dab..a3da9ca3ca 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -10,9 +10,10 @@ using System.Threading.Tasks; using NUnit.Framework; using osu.Framework.Desktop.Platform; using osu.Framework.Platform; -using osu.Game.Database; using osu.Game.IPC; using osu.Framework.Allocation; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; namespace osu.Game.Tests.Beatmaps.IO { diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index c9b3b1b922..fadfa872ce 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -3,10 +3,10 @@ using System.IO; using NUnit.Framework; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.IO; using osu.Game.Tests.Resources; using osu.Game.Beatmaps.Formats; -using osu.Game.Database; namespace osu.Game.Tests.Beatmaps.IO { diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 0368455b92..8668b0c995 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -3,7 +3,6 @@ using OpenTK.Graphics; using osu.Game.Beatmaps.Timing; -using osu.Game.Database; using osu.Game.Rulesets.Objects; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Beatmaps/BeatmapDatabase.cs similarity index 94% rename from osu.Game/Database/BeatmapDatabase.cs rename to osu.Game/Beatmaps/BeatmapDatabase.cs index 84a7096da4..acf41197da 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Beatmaps/BeatmapDatabase.cs @@ -18,7 +18,7 @@ using SQLiteNetExtensions.Extensions; namespace osu.Game.Database { - public class BeatmapDatabase : Database + public class BeatmapStore : DatabaseBacking { private readonly RulesetDatabase rulesets; @@ -33,7 +33,7 @@ namespace osu.Game.Database /// public WorkingBeatmap DefaultBeatmap { private get; set; } - public BeatmapDatabase(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) : base(storage, connection) + public BeatmapStore(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) : base(storage, connection) { this.rulesets = rulesets; if (importHost != null) @@ -291,7 +291,7 @@ namespace osu.Game.Database if (beatmapInfo.Metadata == null) beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; - WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo); + WorkingBeatmap working = new BeatmapStoreWorkingBeatmap(this, beatmapInfo); previous?.TransferTo(working); diff --git a/osu.Game/Database/DatabaseWorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapDatabaseWorkingBeatmap.cs similarity index 83% rename from osu.Game/Database/DatabaseWorkingBeatmap.cs rename to osu.Game/Beatmaps/BeatmapDatabaseWorkingBeatmap.cs index 25944faa42..7c3959f53b 100644 --- a/osu.Game/Database/DatabaseWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/BeatmapDatabaseWorkingBeatmap.cs @@ -10,17 +10,17 @@ using osu.Game.Beatmaps.IO; namespace osu.Game.Database { - internal class DatabaseWorkingBeatmap : WorkingBeatmap + internal class BeatmapDatabaseWorkingBeatmap : WorkingBeatmap { - private readonly BeatmapDatabase database; + private readonly BeatmapStore store; - public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo) + public BeatmapDatabaseWorkingBeatmap(BeatmapStore store, BeatmapInfo beatmapInfo) : base(beatmapInfo) { - this.database = database; + this.store = store; } - private ArchiveReader getReader() => database?.GetReader(BeatmapSetInfo); + private ArchiveReader getReader() => store?.GetReader(BeatmapSetInfo); protected override Beatmap GetBeatmap() { diff --git a/osu.Game/Database/BeatmapDifficulty.cs b/osu.Game/Beatmaps/BeatmapDifficulty.cs similarity index 96% rename from osu.Game/Database/BeatmapDifficulty.cs rename to osu.Game/Beatmaps/BeatmapDifficulty.cs index 87c651aa88..7c2294cae9 100644 --- a/osu.Game/Database/BeatmapDifficulty.cs +++ b/osu.Game/Beatmaps/BeatmapDifficulty.cs @@ -3,7 +3,7 @@ using SQLite.Net.Attributes; -namespace osu.Game.Database +namespace osu.Game.Beatmaps { public class BeatmapDifficulty { diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs similarity index 95% rename from osu.Game/Database/BeatmapInfo.cs rename to osu.Game/Beatmaps/BeatmapInfo.cs index 9f253f6055..a154fc008a 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -1,14 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using Newtonsoft.Json; -using osu.Game.IO.Serialization; -using SQLite.Net.Attributes; -using SQLiteNetExtensions.Attributes; using System; using System.Linq; +using Newtonsoft.Json; +using osu.Game.IO.Serialization; +using osu.Game.Rulesets; +using SQLite.Net.Attributes; +using SQLiteNetExtensions.Attributes; -namespace osu.Game.Database +namespace osu.Game.Beatmaps { public class BeatmapInfo : IEquatable, IJsonSerializable { diff --git a/osu.Game/Database/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs similarity index 94% rename from osu.Game/Database/BeatmapMetadata.cs rename to osu.Game/Beatmaps/BeatmapMetadata.cs index ccf1a99c2c..cc9a51b4e2 100644 --- a/osu.Game/Database/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -5,7 +5,7 @@ using System.Linq; using Newtonsoft.Json; using SQLite.Net.Attributes; -namespace osu.Game.Database +namespace osu.Game.Beatmaps { public class BeatmapMetadata { diff --git a/osu.Game/Database/BeatmapMetrics.cs b/osu.Game/Beatmaps/BeatmapMetrics.cs similarity index 94% rename from osu.Game/Database/BeatmapMetrics.cs rename to osu.Game/Beatmaps/BeatmapMetrics.cs index 25de0f0a8d..730cf635da 100644 --- a/osu.Game/Database/BeatmapMetrics.cs +++ b/osu.Game/Beatmaps/BeatmapMetrics.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using Newtonsoft.Json; -namespace osu.Game.Database +namespace osu.Game.Beatmaps { /// /// Beatmap metrics based on acculumated online data from community plays. diff --git a/osu.Game/Database/BeatmapOnlineInfo.cs b/osu.Game/Beatmaps/BeatmapOnlineInfo.cs similarity index 93% rename from osu.Game/Database/BeatmapOnlineInfo.cs rename to osu.Game/Beatmaps/BeatmapOnlineInfo.cs index f4e70388f5..e8f40a7e07 100644 --- a/osu.Game/Database/BeatmapOnlineInfo.cs +++ b/osu.Game/Beatmaps/BeatmapOnlineInfo.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; -namespace osu.Game.Database +namespace osu.Game.Beatmaps { /// /// Beatmap info retrieved for previewing locally without having the beatmap downloaded. diff --git a/osu.Game/Database/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs similarity index 94% rename from osu.Game/Database/BeatmapSetInfo.cs rename to osu.Game/Beatmaps/BeatmapSetInfo.cs index 017a489d9e..2e41ded28a 100644 --- a/osu.Game/Database/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -6,7 +6,7 @@ using System.Linq; using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; -namespace osu.Game.Database +namespace osu.Game.Beatmaps { public class BeatmapSetInfo { diff --git a/osu.Game/Database/BeatmapSetOnlineInfo.cs b/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs similarity index 94% rename from osu.Game/Database/BeatmapSetOnlineInfo.cs rename to osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs index 61d408c94a..e5a1984f50 100644 --- a/osu.Game/Database/BeatmapSetOnlineInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; -namespace osu.Game.Database +namespace osu.Game.Beatmaps { /// /// Beatmap set info retrieved for previewing locally without having the set downloaded. diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index 8e928391fb..429ecaf416 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs index 4e41424ae8..df7e0905d0 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Game.Database; namespace osu.Game.Beatmaps.Drawables { diff --git a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs index e91b52565a..2614baa116 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; -using osu.Game.Database; using osu.Game.Graphics; using OpenTK.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 14298c4172..f61380bfb8 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Game.Database; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 970a3dbd35..0885fb05e5 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; -using osu.Game.Database; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 21a3ab9842..a365974cfa 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.IO; using osu.Game.Rulesets.Objects; -using osu.Game.Database; namespace osu.Game.Beatmaps.Formats { diff --git a/osu.Game/Database/RankStatus.cs b/osu.Game/Beatmaps/RankStatus.cs similarity index 91% rename from osu.Game/Database/RankStatus.cs rename to osu.Game/Beatmaps/RankStatus.cs index f2a7d67a40..17a4a4aa3f 100644 --- a/osu.Game/Database/RankStatus.cs +++ b/osu.Game/Beatmaps/RankStatus.cs @@ -3,7 +3,7 @@ using System.ComponentModel; -namespace osu.Game.Database +namespace osu.Game.Beatmaps { public enum RankStatus { diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 4dd624c14e..a6a3b23d5d 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -4,7 +4,6 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics.Textures; -using osu.Game.Database; using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; diff --git a/osu.Game/Database/Database.cs b/osu.Game/Database/DatabaseBacking.cs similarity index 92% rename from osu.Game/Database/Database.cs rename to osu.Game/Database/DatabaseBacking.cs index a55c0f570b..92d99cb834 100644 --- a/osu.Game/Database/Database.cs +++ b/osu.Game/Database/DatabaseBacking.cs @@ -12,12 +12,12 @@ using SQLiteNetExtensions.Extensions; namespace osu.Game.Database { - public abstract class Database + public abstract class DatabaseBacking { protected SQLiteConnection Connection { get; } protected Storage Storage { get; } - protected Database(Storage storage, SQLiteConnection connection) + protected DatabaseBacking(Storage storage, SQLiteConnection connection) { Storage = storage; Connection = connection; diff --git a/osu.Game/Graphics/Cursor/GameplayCursor.cs b/osu.Game/Graphics/Cursor/GameplayCursor.cs index e74222f136..9f771ae56d 100644 --- a/osu.Game/Graphics/Cursor/GameplayCursor.cs +++ b/osu.Game/Graphics/Cursor/GameplayCursor.cs @@ -13,7 +13,6 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Configuration; -using osu.Game.Database; namespace osu.Game.Graphics.Cursor { diff --git a/osu.Game/IPC/BeatmapIPCChannel.cs b/osu.Game/IPC/BeatmapIPCChannel.cs index 61e6cc76cc..e28c488708 100644 --- a/osu.Game/IPC/BeatmapIPCChannel.cs +++ b/osu.Game/IPC/BeatmapIPCChannel.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Threading.Tasks; using osu.Framework.Platform; -using osu.Game.Database; +using osu.Game.Beatmaps; namespace osu.Game.IPC { diff --git a/osu.Game/IPC/ScoreIPCChannel.cs b/osu.Game/IPC/ScoreIPCChannel.cs index 7a509ee0e8..cfc74c4824 100644 --- a/osu.Game/IPC/ScoreIPCChannel.cs +++ b/osu.Game/IPC/ScoreIPCChannel.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Threading.Tasks; using osu.Framework.Platform; -using osu.Game.Database; +using osu.Game.Rulesets.Scoring; namespace osu.Game.IPC { diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs index a529dde592..15e20a3d55 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using Newtonsoft.Json; -using osu.Game.Database; +using osu.Game.Beatmaps; namespace osu.Game.Online.API.Requests { diff --git a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs index f6f9bf69fd..3b7711677e 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs @@ -4,9 +4,10 @@ using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Overlays.Direct; +using osu.Game.Rulesets; namespace osu.Game.Online.API.Requests { diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs index 5e6bf1ea9f..966049429e 100644 --- a/osu.Game/Online/API/Requests/GetScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using Newtonsoft.Json; using osu.Framework.IO.Network; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Scoring; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index 26b9dbc88a..e808f2c3ad 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Configuration; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Users; namespace osu.Game.Online.Multiplayer diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 2cfd1f8214..aa55fc025a 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -21,10 +21,10 @@ using OpenTK; using System.Linq; using System.Threading.Tasks; using osu.Framework.Threading; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Rulesets.Scoring; using osu.Game.Overlays.Notifications; +using osu.Game.Rulesets; using osu.Game.Screens.Play; namespace osu.Game diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 27ad4f20f9..312734773e 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -13,13 +13,14 @@ using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Beatmaps.IO; using osu.Game.Configuration; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Processing; using osu.Game.Online.API; using SQLite.Net; using osu.Framework.Graphics.Performance; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Scoring; namespace osu.Game { diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index b7631d5794..98ab5e88f8 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -8,10 +8,10 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps; namespace osu.Game.Overlays.Direct { diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 0a445e49d4..b9063a5c82 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -9,11 +9,11 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Colour; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Database; using osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Framework.Input; using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Direct diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 09b634de81..75619d9ba4 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -6,8 +6,8 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index e947895fc2..24a878da1d 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -7,10 +7,11 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays.SearchableList; +using osu.Game.Rulesets; namespace osu.Game.Overlays.Direct { diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index f10d542830..3724c3e191 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -9,13 +9,14 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Threading; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Direct; using osu.Game.Overlays.SearchableList; +using osu.Game.Rulesets; using OpenTK.Graphics; namespace osu.Game.Overlays diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 703deea382..6324b9ac3d 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -15,8 +15,8 @@ using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; using System.Linq; -using osu.Game.Database; using osu.Framework.Graphics.Shapes; +using osu.Game.Rulesets; namespace osu.Game.Overlays.Mods { diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 128dddbce5..1e3e48b17a 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index cd28737adb..88f499f9a6 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Music diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index bd822f8145..6283368138 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -9,7 +9,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index b435c505c9..2807a02543 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -18,7 +18,6 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Framework.Localisation; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Threading; diff --git a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs index c20519a9b5..32cc0fcca5 100644 --- a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs +++ b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Overlays.Settings.Sections.Gameplay; using osu.Game.Rulesets; diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index be08e61c1a..f5f7fe0ace 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -5,9 +5,9 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs index 6a11f68572..2c50897e1f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Containers; -using osu.Game.Database; +using osu.Game.Rulesets; using OpenTK.Graphics; namespace osu.Game.Overlays.Toolbar diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index f48cb681a8..f6d7a05f61 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -6,11 +6,11 @@ using osu.Framework.Allocation; using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Database; using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics.Shapes; +using osu.Game.Rulesets; namespace osu.Game.Overlays.Toolbar { diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index b282965db8..c343cdaf33 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -2,8 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Audio; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Database; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index 8c2aead5ff..ffe40e4f2e 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -6,8 +6,8 @@ using System; using System.Collections.Generic; using OpenTK; using osu.Game.Audio; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Database; namespace osu.Game.Rulesets.Objects.Legacy { diff --git a/osu.Game/Database/RulesetDatabase.cs b/osu.Game/Rulesets/RulesetDatabase.cs similarity index 100% rename from osu.Game/Database/RulesetDatabase.cs rename to osu.Game/Rulesets/RulesetDatabase.cs diff --git a/osu.Game/Database/RulesetInfo.cs b/osu.Game/Rulesets/RulesetInfo.cs similarity index 100% rename from osu.Game/Database/RulesetInfo.cs rename to osu.Game/Rulesets/RulesetInfo.cs diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index 2cca0f54af..6169bb7380 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using Newtonsoft.Json; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; using osu.Game.Users; using osu.Game.Rulesets.Replays; diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Rulesets/Scoring/ScoreDatabase.cs similarity index 93% rename from osu.Game/Database/ScoreDatabase.cs rename to osu.Game/Rulesets/Scoring/ScoreDatabase.cs index adca76d2ac..efefa03e8d 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Rulesets/Scoring/ScoreDatabase.cs @@ -15,11 +15,11 @@ using SQLite.Net; namespace osu.Game.Database { - public class ScoreDatabase : Database + public class ScoreDatabase : DatabaseBacking { private readonly Storage storage; - private readonly BeatmapDatabase beatmaps; + private readonly BeatmapStore beatmaps; private readonly RulesetDatabase rulesets; private const string replay_folder = @"replays"; @@ -27,7 +27,7 @@ namespace osu.Game.Database // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private ScoreIPCChannel ipc; - public ScoreDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapDatabase beatmaps = null, RulesetDatabase rulesets = null) : base(storage, connection) + public ScoreDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapStore beatmaps = null, RulesetDatabase rulesets = null) : base(storage, connection) { this.storage = storage; this.beatmaps = beatmaps; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 7b16e7e7ad..4f484e9638 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -9,9 +9,9 @@ using osu.Framework.Configuration; using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.MathUtils; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.IO; using osu.Game.Configuration; -using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using OpenTK.Graphics; diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 8e2d9e0200..d2f88224c2 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -10,8 +10,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs index fff40aeed5..40d385418a 100644 --- a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs @@ -4,8 +4,8 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; -using osu.Game.Database; using osu.Game.Online.Multiplayer; namespace osu.Game.Screens.Multiplayer diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 18fad53b51..66ce51b428 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -13,8 +13,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index d916614abd..d215385ece 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -6,11 +6,11 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Screens; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Graphics.Containers; using OpenTK; using osu.Framework.Audio.Sample; using osu.Framework.Audio; +using osu.Game.Rulesets; namespace osu.Game.Screens { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index cda4713575..84261d509e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -13,7 +13,6 @@ using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Timing; using osu.Game.Configuration; -using osu.Game.Database; using osu.Game.Rulesets; using osu.Game.Rulesets.UI; using osu.Game.Screens.Backgrounds; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index d9bdb50ef0..1cac1bd2ad 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Backgrounds; diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 00cc031ec6..bf406ff912 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -15,7 +15,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 1940cdef6e..b26d6d4385 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -4,7 +4,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Database; using System; using System.Collections.Generic; using System.Linq; @@ -18,6 +17,7 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Threading; using osu.Framework.Configuration; +using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Select diff --git a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs index 0890625eb9..b27119a16d 100644 --- a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs +++ b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs @@ -4,7 +4,6 @@ using System; using osu.Framework.Allocation; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Overlays.Dialog; diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 972d563ca5..f38d2c454a 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -6,7 +6,6 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -16,6 +15,7 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Framework.Threading; using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps; namespace osu.Game.Screens.Select { diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 8aa2796189..385492980f 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -14,7 +14,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 35fee9e32d..c406e7c44d 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -14,8 +14,8 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select.Filter; using Container = osu.Framework.Graphics.Containers.Container; using osu.Framework.Input; -using osu.Game.Database; using osu.Framework.Graphics.Shapes; +using osu.Game.Rulesets; namespace osu.Game.Screens.Select { diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 3634e739cf..a1fea4a41d 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps.Drawables; -using osu.Game.Database; +using osu.Game.Rulesets; using osu.Game.Screens.Select.Filter; namespace osu.Game.Screens.Select diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 57c333138f..5a375e55d4 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Containers; using System; using osu.Framework.Allocation; using osu.Framework.Threading; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index b2311d6561..cee5e88deb 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -16,10 +16,10 @@ using osu.Framework.Input; using osu.Framework.Screens; using osu.Framework.Threading; using osu.Game.Beatmaps; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays; +using osu.Game.Rulesets; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Select.Options; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6031304b26..42067fb8d5 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -127,7 +127,7 @@ - + @@ -384,7 +384,7 @@ - + @@ -394,7 +394,7 @@ - + From 9e20a02c0aab7e68c646d5b487e8d4543657eb54 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jul 2017 16:28:32 +0900 Subject: [PATCH 073/132] Split out BeatmapDatabase into BeatmapStore Hide database functionality at a lower level in preparation from eventually making it private. --- .../Tests/TestCasePlaySongSelect.cs | 22 +- .../Tests/TestCaseResults.cs | 6 +- osu.Desktop/OsuGameDesktop.cs | 2 +- .../Beatmaps/IO/ImportBeatmapTest.cs | 24 +- osu.Game/Beatmaps/BeatmapDatabase.cs | 314 ++++-------------- .../Beatmaps/BeatmapDatabaseWorkingBeatmap.cs | 75 ----- osu.Game/Beatmaps/BeatmapStore.cs | 212 ++++++++++++ .../Beatmaps/BeatmapStoreWorkingBeatmap.cs | 70 ++++ osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 5 +- .../{DatabaseBacking.cs => DatabaseStore.cs} | 7 +- osu.Game/IPC/BeatmapIPCChannel.cs | 4 +- osu.Game/OsuGame.cs | 4 +- osu.Game/OsuGameBase.cs | 10 +- osu.Game/Overlays/Music/PlaylistOverlay.cs | 6 +- osu.Game/Rulesets/RulesetDatabase.cs | 10 +- osu.Game/Rulesets/RulesetInfo.cs | 3 +- osu.Game/Rulesets/Scoring/ScoreDatabase.cs | 11 +- osu.Game/Screens/Menu/Intro.cs | 10 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 8 +- .../Screens/Select/BeatmapDeleteDialog.cs | 8 +- osu.Game/Screens/Select/SongSelect.cs | 22 +- osu.Game/osu.Game.csproj | 23 +- 22 files changed, 428 insertions(+), 428 deletions(-) delete mode 100644 osu.Game/Beatmaps/BeatmapDatabaseWorkingBeatmap.cs create mode 100644 osu.Game/Beatmaps/BeatmapStore.cs create mode 100644 osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs rename osu.Game/Database/{DatabaseBacking.cs => DatabaseStore.cs} (87%) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 55fd8b45cc..6d41be72c7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -5,7 +5,8 @@ using System.Collections.Generic; using osu.Desktop.VisualTests.Platform; using osu.Framework.Testing; using osu.Framework.MathUtils; -using osu.Game.Database; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; @@ -13,7 +14,7 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCasePlaySongSelect : TestCase { - private readonly BeatmapStore db; + private readonly BeatmapStore store; public override string Description => @"with fake data"; @@ -23,21 +24,21 @@ namespace osu.Desktop.VisualTests.Tests { PlaySongSelect songSelect; - if (db == null) + if (store == null) { var storage = new TestStorage(@"TestCasePlaySongSelect"); var backingDatabase = storage.GetDatabase(@"client"); - rulesets = new RulesetDatabase(storage, backingDatabase); - db = new BeatmapStore(storage, backingDatabase, rulesets); + rulesets = new RulesetDatabase(backingDatabase); + store = new BeatmapStore(storage, backingDatabase, rulesets); var sets = new List(); for (int i = 0; i < 100; i += 10) sets.Add(createTestBeatmapSet(i)); - db.Import(sets); + store.Database.Import(sets); } Add(songSelect = new PlaySongSelect()); @@ -48,21 +49,12 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); } - //protected override void Dispose(bool isDisposing) - //{ - // if (oldDb != null) - // db = null; - - // base.Dispose(isDisposing); - //} - private BeatmapSetInfo createTestBeatmapSet(int i) { return new BeatmapSetInfo { OnlineBeatmapSetID = 1234 + i, Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249", - Path = string.Empty, Metadata = new BeatmapMetadata { OnlineBeatmapSetID = 1234 + i, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index a553814ce8..5b9ee2198d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -15,12 +15,12 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseResults : TestCase { - private BeatmapDatabase db; + private BeatmapStore db; public override string Description => @"Results after playing."; [BackgroundDependencyLoader] - private void load(BeatmapDatabase db) + private void load(BeatmapStore db) { this.db = db; } @@ -33,7 +33,7 @@ namespace osu.Desktop.VisualTests.Tests if (beatmap == null) { - var beatmapInfo = db.Query().FirstOrDefault(b => b.RulesetID == 0); + var beatmapInfo = db.Database.Query().FirstOrDefault(b => b.RulesetID == 0); if (beatmapInfo != null) beatmap = db.GetWorkingBeatmap(beatmapInfo); } diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index a2bfe6bf2e..ccedcc07d5 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -65,7 +65,7 @@ namespace osu.Desktop var filePaths = dropData.Select(f => f.ToString()).ToArray(); if (filePaths.All(f => Path.GetExtension(f) == @".osz")) - Task.Run(() => BeatmapDatabase.Import(filePaths)); + Task.Run(() => BeatmapStore.Import(filePaths)); else if (filePaths.All(f => Path.GetExtension(f) == @".osr")) Task.Run(() => { diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index a3da9ca3ca..5c1fd381e2 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -34,7 +34,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(File.Exists(temp)); - osu.Dependencies.Get().Import(temp); + osu.Dependencies.Get().Import(temp); ensureLoaded(osu); @@ -80,7 +80,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(File.Exists(temp), "Temporary file copy never substantiated"); using (File.OpenRead(temp)) - osu.Dependencies.Get().Import(temp); + osu.Dependencies.Get().Import(temp); ensureLoaded(osu); @@ -106,7 +106,7 @@ namespace osu.Game.Tests.Beatmaps.IO //reset beatmap database (sqlite and storage backing) osu.Dependencies.Get().Reset(); - osu.Dependencies.Get().Reset(); + osu.Dependencies.Get().Reset(); return osu; } @@ -117,8 +117,8 @@ namespace osu.Game.Tests.Beatmaps.IO Action waitAction = () => { - while (!(resultSets = osu.Dependencies.Get() - .Query().Where(s => s.OnlineBeatmapSetID == 241526)).Any()) + while (!(resultSets = osu.Dependencies.Get().Database. + Query().Where(s => s.OnlineBeatmapSetID == 241526)).Any()) Thread.Sleep(50); }; @@ -134,15 +134,15 @@ namespace osu.Game.Tests.Beatmaps.IO //if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. waitAction = () => { - while ((resultBeatmaps = osu.Dependencies.Get() - .GetAllWithChildren(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) + while ((resultBeatmaps = osu.Dependencies.Get().Database. + GetAllWithChildren(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) Thread.Sleep(50); }; Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), @"Beatmaps did not import to the database in allocated time"); - var set = osu.Dependencies.Get().GetChildren(resultSets.First()); + var set = osu.Dependencies.Get().Database.GetChildren(resultSets.First()); Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(), $@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count})."); @@ -152,16 +152,16 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count > 0); - var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; + var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); } } diff --git a/osu.Game/Beatmaps/BeatmapDatabase.cs b/osu.Game/Beatmaps/BeatmapDatabase.cs index acf41197da..2e8e5da65b 100644 --- a/osu.Game/Beatmaps/BeatmapDatabase.cs +++ b/osu.Game/Beatmaps/BeatmapDatabase.cs @@ -1,43 +1,77 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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.IO; -using System.Linq; -using osu.Framework.Extensions; using osu.Framework.Logging; -using osu.Framework.Platform; -using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Formats; -using osu.Game.Beatmaps.IO; -using osu.Game.IPC; +using osu.Game.Database; using osu.Game.Screens.Menu; using SQLite.Net; using SQLiteNetExtensions.Extensions; -namespace osu.Game.Database +namespace osu.Game.Beatmaps { - public class BeatmapStore : DatabaseBacking + /// + /// Handles the storage and retrieval of Beatmaps/BeatmapSets to the database backing + /// + public class BeatmapDatabase : DatabaseStore { - private readonly RulesetDatabase rulesets; - public event Action BeatmapSetAdded; public event Action BeatmapSetRemoved; - // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) - private BeatmapIPCChannel ipc; - - /// - /// A default representation of a WorkingBeatmap to use when no beatmap is available. - /// - public WorkingBeatmap DefaultBeatmap { private get; set; } - - public BeatmapStore(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) : base(storage, connection) + public BeatmapDatabase(SQLiteConnection connection) : base(connection) { - this.rulesets = rulesets; - if (importHost != null) - ipc = new BeatmapIPCChannel(importHost, this); + } + + protected override Type[] ValidTypes => new[] { + typeof(BeatmapSetInfo), + typeof(BeatmapInfo), + typeof(BeatmapMetadata), + typeof(BeatmapDifficulty), + }; + + protected override void Prepare(bool reset = false) + { + Connection.CreateTable(); + Connection.CreateTable(); + Connection.CreateTable(); + Connection.CreateTable(); + + if (reset) + { + Connection.DropTable(); + Connection.DropTable(); + Connection.DropTable(); + Connection.DropTable(); + } + + deletePending(); + } + + public void Import(IEnumerable beatmapSets) + { + lock (Connection) + { + Connection.BeginTransaction(); + + foreach (var s in beatmapSets) + { + Connection.InsertOrReplaceWithChildren(s, true); + BeatmapSetAdded?.Invoke(s); + } + + Connection.Commit(); + } + } + + public void Delete(IEnumerable beatmapSets) + { + foreach (var s in beatmapSets) + { + s.DeletePending = true; + Update(s, false); + BeatmapSetRemoved?.Invoke(s); + } } private void deletePending() @@ -50,8 +84,6 @@ namespace osu.Game.Database try { - Storage.Delete(b.Path); - foreach (var i in b.Beatmaps) { if (i.Metadata != null) Connection.Delete(i.Metadata); @@ -73,231 +105,5 @@ namespace osu.Game.Database //see https://github.com/praeclarum/sqlite-net/issues/326 Connection.Query("UPDATE BeatmapSetInfo SET DeletePending = 0 WHERE DeletePending IS NULL"); } - - protected override void Prepare(bool reset = false) - { - Connection.CreateTable(); - Connection.CreateTable(); - Connection.CreateTable(); - Connection.CreateTable(); - - if (reset) - { - Storage.DeleteDatabase(@"beatmaps"); - - foreach (var setInfo in Query()) - { - if (Storage.Exists(setInfo.Path)) - Storage.Delete(setInfo.Path); - } - - Connection.DeleteAll(); - Connection.DeleteAll(); - Connection.DeleteAll(); - Connection.DeleteAll(); - } - - deletePending(); - } - - protected override Type[] ValidTypes => new[] { - typeof(BeatmapSetInfo), - typeof(BeatmapInfo), - typeof(BeatmapMetadata), - typeof(BeatmapDifficulty), - }; - - public void Import(string path) - { - try - { - Import(ArchiveReader.GetReader(Storage, path)); - - // We may or may not want to delete the file depending on where it is stored. - // e.g. reconstructing/repairing database with beatmaps from default storage. - // Also, not always a single file, i.e. for LegacyFilesystemReader - // TODO: Add a check to prevent files from storage to be deleted. - try - { - File.Delete(path); - } - catch (Exception e) - { - Logger.Error(e, $@"Could not delete file at {path}"); - } - } - catch (Exception e) - { - e = e.InnerException ?? e; - Logger.Error(e, @"Could not import beatmap set"); - } - } - - public void Import(ArchiveReader archiveReader) - { - BeatmapSetInfo set = getBeatmapSet(archiveReader); - - //If we have an ID then we already exist in the database. - if (set.ID == 0) - Import(new[] { set }); - } - - /// - /// Import multiple from . - /// - /// Multiple locations on disk - public void Import(params string[] paths) - { - foreach (string p in paths) - { - //In case the file was imported twice and deleted after the first time - if (File.Exists(p)) - Import(p); - } - } - - /// - /// Duplicates content from to storage and returns a representing . - /// - /// Content location - /// - private BeatmapSetInfo getBeatmapSet(string path) => getBeatmapSet(ArchiveReader.GetReader(Storage, path)); - - private BeatmapSetInfo getBeatmapSet(ArchiveReader archiveReader) - { - BeatmapMetadata metadata; - - using (var stream = new StreamReader(archiveReader.GetStream(archiveReader.BeatmapFilenames[0]))) - metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; - - string hash; - string path; - - using (var input = archiveReader.GetUnderlyingStream()) - { - hash = input.GetMd5Hash(); - input.Seek(0, SeekOrigin.Begin); - path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash); - if (!Storage.Exists(path)) - using (var output = Storage.GetStream(path, FileAccess.Write)) - input.CopyTo(output); - } - - var existing = Connection.Table().FirstOrDefault(b => b.Hash == hash); - - if (existing != null) - { - GetChildren(existing); - - if (existing.DeletePending) - { - existing.DeletePending = false; - Update(existing, false); - BeatmapSetAdded?.Invoke(existing); - } - - return existing; - } - - var beatmapSet = new BeatmapSetInfo - { - OnlineBeatmapSetID = metadata.OnlineBeatmapSetID, - Beatmaps = new List(), - Path = path, - Hash = hash, - Metadata = metadata - }; - - using (var archive = ArchiveReader.GetReader(Storage, path)) - { - string[] mapNames = archive.BeatmapFilenames; - foreach (var name in mapNames) - using (var raw = archive.GetStream(name)) - using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit - using (var sr = new StreamReader(ms)) - { - raw.CopyTo(ms); - ms.Position = 0; - - var decoder = BeatmapDecoder.GetDecoder(sr); - Beatmap beatmap = decoder.Decode(sr); - - beatmap.BeatmapInfo.Path = name; - beatmap.BeatmapInfo.Hash = ms.GetMd5Hash(); - - // TODO: Diff beatmap metadata with set metadata and leave it here if necessary - beatmap.BeatmapInfo.Metadata = null; - - // TODO: this should be done in a better place once we actually need to dynamically update it. - beatmap.BeatmapInfo.Ruleset = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID); - beatmap.BeatmapInfo.StarDifficulty = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap).Calculate() ?? 0; - - beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); - } - beatmapSet.StoryboardFile = archive.StoryboardFilename; - } - - return beatmapSet; - } - - public void Import(IEnumerable beatmapSets) - { - lock (Connection) - { - Connection.BeginTransaction(); - - foreach (var s in beatmapSets) - { - Connection.InsertOrReplaceWithChildren(s, true); - BeatmapSetAdded?.Invoke(s); - } - - Connection.Commit(); - } - } - - public void Delete(BeatmapSetInfo beatmapSet) - { - beatmapSet.DeletePending = true; - Update(beatmapSet, false); - - BeatmapSetRemoved?.Invoke(beatmapSet); - } - - public ArchiveReader GetReader(BeatmapSetInfo beatmapSet) - { - if (string.IsNullOrEmpty(beatmapSet.Path)) - return null; - - return ArchiveReader.GetReader(Storage, beatmapSet.Path); - } - - public BeatmapSetInfo GetBeatmapSet(int id) - { - return Query().FirstOrDefault(s => s.OnlineBeatmapSetID == id); - } - - public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false) - { - if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) - return DefaultBeatmap; - - if (beatmapInfo.BeatmapSet == null || beatmapInfo.Ruleset == null) - beatmapInfo = GetChildren(beatmapInfo, true); - - if (beatmapInfo.BeatmapSet == null) - throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); - - if (beatmapInfo.Metadata == null) - beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; - - WorkingBeatmap working = new BeatmapStoreWorkingBeatmap(this, beatmapInfo); - - previous?.TransferTo(working); - - return working; - } - - public bool Exists(BeatmapSetInfo beatmapSet) => Storage.Exists(beatmapSet.Path); } -} +} \ No newline at end of file diff --git a/osu.Game/Beatmaps/BeatmapDatabaseWorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapDatabaseWorkingBeatmap.cs deleted file mode 100644 index 7c3959f53b..0000000000 --- a/osu.Game/Beatmaps/BeatmapDatabaseWorkingBeatmap.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.IO; -using osu.Framework.Audio.Track; -using osu.Framework.Graphics.Textures; -using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Formats; -using osu.Game.Beatmaps.IO; - -namespace osu.Game.Database -{ - internal class BeatmapDatabaseWorkingBeatmap : WorkingBeatmap - { - private readonly BeatmapStore store; - - public BeatmapDatabaseWorkingBeatmap(BeatmapStore store, BeatmapInfo beatmapInfo) - : base(beatmapInfo) - { - this.store = store; - } - - private ArchiveReader getReader() => store?.GetReader(BeatmapSetInfo); - - protected override Beatmap GetBeatmap() - { - try - { - Beatmap beatmap; - - using (var reader = getReader()) - { - BeatmapDecoder decoder; - using (var stream = new StreamReader(reader.GetStream(BeatmapInfo.Path))) - { - decoder = BeatmapDecoder.GetDecoder(stream); - beatmap = decoder.Decode(stream); - } - - if (beatmap == null || BeatmapSetInfo.StoryboardFile == null) - return beatmap; - - using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile))) - decoder.Decode(stream, beatmap); - } - - return beatmap; - } - catch { return null; } - } - - protected override Texture GetBackground() - { - if (Metadata?.BackgroundFile == null) - return null; - - try - { - using (var reader = getReader()) - return new TextureStore(new RawTextureLoaderStore(reader), false).Get(Metadata.BackgroundFile); - } - catch { return null; } - } - - protected override Track GetTrack() - { - try - { - var trackData = getReader()?.GetStream(Metadata.AudioFile); - return trackData == null ? null : new TrackBass(trackData); - } - catch { return new TrackVirtual(); } - } - } -} diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs new file mode 100644 index 0000000000..4e5eeee0a4 --- /dev/null +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -0,0 +1,212 @@ +// 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.IO; +using System.Linq; +using osu.Framework.Extensions; +using osu.Framework.Logging; +using osu.Framework.Platform; +using osu.Game.Beatmaps.Formats; +using osu.Game.Beatmaps.IO; +using osu.Game.IPC; +using osu.Game.Rulesets; +using SQLite.Net; + +namespace osu.Game.Beatmaps +{ + /// + /// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps. + /// + public class BeatmapStore + { + // todo: make this private + public readonly BeatmapDatabase Database; + + private readonly Storage storage; + + private readonly RulesetDatabase rulesets; + + public event Action BeatmapSetAdded; + public event Action BeatmapSetRemoved; + + // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) + private BeatmapIPCChannel ipc; + + /// + /// A default representation of a WorkingBeatmap to use when no beatmap is available. + /// + public WorkingBeatmap DefaultBeatmap { private get; set; } + + public BeatmapStore(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) + { + Database = new BeatmapDatabase(connection); + Database.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); + Database.BeatmapSetRemoved += s => BeatmapSetRemoved?.Invoke(s); + + this.storage = storage; + this.rulesets = rulesets; + if (importHost != null) + ipc = new BeatmapIPCChannel(importHost, this); + } + + /// + /// Import multiple from filesystem . + /// + /// Multiple locations on disk. + public void Import(params string[] paths) + { + foreach (string path in paths) + { + try + { + Import(ArchiveReader.GetReader(storage, path)); + + // We may or may not want to delete the file depending on where it is stored. + // e.g. reconstructing/repairing database with beatmaps from default storage. + // Also, not always a single file, i.e. for LegacyFilesystemReader + // TODO: Add a check to prevent files from storage to be deleted. + try + { + File.Delete(path); + } + catch (Exception e) + { + Logger.Error(e, $@"Could not delete file at {path}"); + } + } + catch (Exception e) + { + e = e.InnerException ?? e; + Logger.Error(e, @"Could not import beatmap set"); + } + } + } + + /// + /// Import a beatmap from an . + /// + /// The beatmap to be imported. + public void Import(ArchiveReader archiveReader) + { + BeatmapSetInfo set = importToStorage(archiveReader); + + //If we have an ID then we already exist in the database. + if (set.ID == 0) + Database.Import(new[] { set }); + } + + /// + /// Delete a beatmap from the store. + /// + /// The beatmap to delete. + public void Delete(BeatmapSetInfo beatmapSet) => Database.Delete(new[] { beatmapSet }); + + public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) + { + if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) + return DefaultBeatmap; + + if (beatmapInfo.BeatmapSet == null || beatmapInfo.Ruleset == null) + beatmapInfo = Database.GetChildren(beatmapInfo, true); + + if (beatmapInfo.BeatmapSet == null) + throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); + + if (beatmapInfo.Metadata == null) + beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; + + WorkingBeatmap working = new BeatmapStoreWorkingBeatmap(() => string.IsNullOrEmpty(beatmapInfo.BeatmapSet.Path) ? null : ArchiveReader.GetReader(storage, beatmapInfo.BeatmapSet.Path), beatmapInfo); + + previous?.TransferTo(working); + + return working; + } + + /// + /// Reset the store to an empty state. + /// + public void Reset() + { + Database.Reset(); + } + + private BeatmapSetInfo importToStorage(ArchiveReader archiveReader) + { + BeatmapMetadata metadata; + + using (var stream = new StreamReader(archiveReader.GetStream(archiveReader.BeatmapFilenames[0]))) + metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; + + string hash; + string path; + + using (var input = archiveReader.GetUnderlyingStream()) + { + hash = input.GetMd5Hash(); + input.Seek(0, SeekOrigin.Begin); + path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash); + if (!storage.Exists(path)) + using (var output = storage.GetStream(path, FileAccess.Write)) + input.CopyTo(output); + } + + var existing = Database.Query().FirstOrDefault(b => b.Hash == hash); + + if (existing != null) + { + Database.GetChildren(existing); + + if (existing.DeletePending) + { + existing.DeletePending = false; + Database.Update(existing, false); + BeatmapSetAdded?.Invoke(existing); + } + + return existing; + } + + var beatmapSet = new BeatmapSetInfo + { + OnlineBeatmapSetID = metadata.OnlineBeatmapSetID, + Beatmaps = new List(), + Path = path, + Hash = hash, + Metadata = metadata + }; + + using (var archive = ArchiveReader.GetReader(storage, path)) + { + string[] mapNames = archive.BeatmapFilenames; + foreach (var name in mapNames) + using (var raw = archive.GetStream(name)) + using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit + using (var sr = new StreamReader(ms)) + { + raw.CopyTo(ms); + ms.Position = 0; + + var decoder = BeatmapDecoder.GetDecoder(sr); + Beatmap beatmap = decoder.Decode(sr); + + beatmap.BeatmapInfo.Path = name; + beatmap.BeatmapInfo.Hash = ms.GetMd5Hash(); + + // TODO: Diff beatmap metadata with set metadata and leave it here if necessary + beatmap.BeatmapInfo.Metadata = null; + + // TODO: this should be done in a better place once we actually need to dynamically update it. + beatmap.BeatmapInfo.Ruleset = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID); + beatmap.BeatmapInfo.StarDifficulty = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap).Calculate() ?? 0; + + beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); + } + beatmapSet.StoryboardFile = archive.StoryboardFilename; + } + + return beatmapSet; + } + } +} diff --git a/osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs new file mode 100644 index 0000000000..478cd7d87d --- /dev/null +++ b/osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs @@ -0,0 +1,70 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.IO; +using osu.Framework.Audio.Track; +using osu.Framework.Graphics.Textures; +using osu.Framework.IO.Stores; +using osu.Game.Beatmaps.Formats; + +namespace osu.Game.Beatmaps +{ + internal class BeatmapStoreWorkingBeatmap : WorkingBeatmap + { + private readonly Func> getStore; + + public BeatmapStoreWorkingBeatmap(Func> getStore, BeatmapInfo beatmapInfo) + : base(beatmapInfo) + { + this.getStore = getStore; + } + + protected override Beatmap GetBeatmap() + { + try + { + Beatmap beatmap; + + BeatmapDecoder decoder; + using (var stream = new StreamReader(getStore().GetStream(BeatmapInfo.Path))) + { + decoder = BeatmapDecoder.GetDecoder(stream); + beatmap = decoder.Decode(stream); + } + + if (beatmap == null || BeatmapSetInfo.StoryboardFile == null) + return beatmap; + + using (var stream = new StreamReader(getStore().GetStream(BeatmapSetInfo.StoryboardFile))) + decoder.Decode(stream, beatmap); + + + return beatmap; + } + catch { return null; } + } + + protected override Texture GetBackground() + { + if (Metadata?.BackgroundFile == null) + return null; + + try + { + return new TextureStore(new RawTextureLoaderStore(getStore()), false).Get(Metadata.BackgroundFile); + } + catch { return null; } + } + + protected override Track GetTrack() + { + try + { + var trackData = getStore().GetStream(Metadata.AudioFile); + return trackData == null ? null : new TrackBass(trackData); + } + catch { return new TrackVirtual(); } + } + } +} diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index 11cc6122ac..89ba9133c1 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework; using osu.Framework.Graphics; -using osu.Game.Database; namespace osu.Game.Beatmaps.Drawables { @@ -59,10 +58,10 @@ namespace osu.Game.Beatmaps.Drawables } } - public BeatmapGroup(BeatmapSetInfo beatmapSet, BeatmapDatabase database) + public BeatmapGroup(BeatmapSetInfo beatmapSet, BeatmapStore store) { BeatmapSet = beatmapSet; - WorkingBeatmap beatmap = database.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault()); + WorkingBeatmap beatmap = store.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault()); Header = new BeatmapSetHeader(beatmap) { diff --git a/osu.Game/Database/DatabaseBacking.cs b/osu.Game/Database/DatabaseStore.cs similarity index 87% rename from osu.Game/Database/DatabaseBacking.cs rename to osu.Game/Database/DatabaseStore.cs index 92d99cb834..0102998604 100644 --- a/osu.Game/Database/DatabaseBacking.cs +++ b/osu.Game/Database/DatabaseStore.cs @@ -6,20 +6,17 @@ using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using osu.Framework.Logging; -using osu.Framework.Platform; using SQLite.Net; using SQLiteNetExtensions.Extensions; namespace osu.Game.Database { - public abstract class DatabaseBacking + public abstract class DatabaseStore { protected SQLiteConnection Connection { get; } - protected Storage Storage { get; } - protected DatabaseBacking(Storage storage, SQLiteConnection connection) + protected DatabaseStore(SQLiteConnection connection) { - Storage = storage; Connection = connection; try diff --git a/osu.Game/IPC/BeatmapIPCChannel.cs b/osu.Game/IPC/BeatmapIPCChannel.cs index e28c488708..f42e750a6f 100644 --- a/osu.Game/IPC/BeatmapIPCChannel.cs +++ b/osu.Game/IPC/BeatmapIPCChannel.cs @@ -10,9 +10,9 @@ namespace osu.Game.IPC { public class BeatmapIPCChannel : IpcChannel { - private readonly BeatmapDatabase beatmaps; + private readonly BeatmapStore beatmaps; - public BeatmapIPCChannel(IIpcHost host, BeatmapDatabase beatmaps = null) + public BeatmapIPCChannel(IIpcHost host, BeatmapStore beatmaps = null) : base(host) { this.beatmaps = beatmaps; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index aa55fc025a..44af591cc8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -99,7 +99,7 @@ namespace osu.Game if (args?.Length > 0) { var paths = args.Where(a => !a.StartsWith(@"-")); - Task.Run(() => BeatmapDatabase.Import(paths.ToArray())); + Task.Run(() => BeatmapStore.Import(paths.ToArray())); } dependencies.Cache(this); @@ -140,7 +140,7 @@ namespace osu.Game return; } - Beatmap.Value = BeatmapDatabase.GetWorkingBeatmap(s.Beatmap); + Beatmap.Value = BeatmapStore.GetWorkingBeatmap(s.Beatmap); menu.Push(new PlayerLoader(new ReplayPlayer(s.Replay))); } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 312734773e..82e4b5d4ca 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -28,7 +28,7 @@ namespace osu.Game { protected OsuConfigManager LocalConfig; - protected BeatmapDatabase BeatmapDatabase; + protected BeatmapStore BeatmapStore; protected RulesetDatabase RulesetDatabase; @@ -95,9 +95,9 @@ namespace osu.Game SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); - dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection)); - dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host)); - dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase)); + dependencies.Cache(RulesetDatabase = new RulesetDatabase(connection)); + dependencies.Cache(BeatmapStore = new BeatmapStore(Host.Storage, connection, RulesetDatabase, Host)); + dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapStore)); dependencies.Cache(new OsuColour()); //this completely overrides the framework default. will need to change once we make a proper FontStore. @@ -129,7 +129,7 @@ namespace osu.Game var defaultBeatmap = new DummyWorkingBeatmap(this); Beatmap = new NonNullableBindable(defaultBeatmap); - BeatmapDatabase.DefaultBeatmap = defaultBeatmap; + BeatmapStore.DefaultBeatmap = defaultBeatmap; OszArchiveReader.Register(); diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 6283368138..37ec90ad32 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Music private FilterControl filter; private PlaylistList list; - private BeatmapDatabase beatmaps; + private BeatmapStore beatmaps; private readonly Bindable beatmapBacking = new Bindable(); @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Music private InputManager inputManager; [BackgroundDependencyLoader] - private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours, UserInputManager inputManager) + private void load(OsuGameBase game, BeatmapStore beatmaps, OsuColour colours, UserInputManager inputManager) { this.inputManager = inputManager; this.beatmaps = beatmaps; @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Music }, }; - list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren(b => !b.DeletePending).ToList(); + list.BeatmapSets = BeatmapSets = beatmaps.Database.GetAllWithChildren(b => !b.DeletePending).ToList(); beatmaps.BeatmapSetAdded += s => list.AddBeatmapSet(s); beatmaps.BeatmapSetRemoved += s => list.RemoveBeatmapSet(s); diff --git a/osu.Game/Rulesets/RulesetDatabase.cs b/osu.Game/Rulesets/RulesetDatabase.cs index b78ca5ffc6..be2ba19c0c 100644 --- a/osu.Game/Rulesets/RulesetDatabase.cs +++ b/osu.Game/Rulesets/RulesetDatabase.cs @@ -6,21 +6,19 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; -using osu.Framework.Platform; -using osu.Game.Rulesets; +using osu.Game.Database; using SQLite.Net; -namespace osu.Game.Database +namespace osu.Game.Rulesets { /// /// Todo: All of this needs to be moved to a RulesetDatabase. /// - public class RulesetDatabase : Database + public class RulesetDatabase : DatabaseStore { public IEnumerable AllRulesets => Query().Where(r => r.Available); - public RulesetDatabase(Storage storage, SQLiteConnection connection) - : base(storage, connection) + public RulesetDatabase(SQLiteConnection connection) : base(connection) { } diff --git a/osu.Game/Rulesets/RulesetInfo.cs b/osu.Game/Rulesets/RulesetInfo.cs index 3990f9e8ae..84ecb7718e 100644 --- a/osu.Game/Rulesets/RulesetInfo.cs +++ b/osu.Game/Rulesets/RulesetInfo.cs @@ -2,10 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Game.Rulesets; using SQLite.Net.Attributes; -namespace osu.Game.Database +namespace osu.Game.Rulesets { public class RulesetInfo { diff --git a/osu.Game/Rulesets/Scoring/ScoreDatabase.cs b/osu.Game/Rulesets/Scoring/ScoreDatabase.cs index efefa03e8d..84a532ec14 100644 --- a/osu.Game/Rulesets/Scoring/ScoreDatabase.cs +++ b/osu.Game/Rulesets/Scoring/ScoreDatabase.cs @@ -6,16 +6,17 @@ using System.Collections.Generic; using System.IO; using System.Linq; using osu.Framework.Platform; +using osu.Game.Beatmaps; +using osu.Game.Database; using osu.Game.IO.Legacy; using osu.Game.IPC; using osu.Game.Rulesets.Replays; -using osu.Game.Rulesets.Scoring; using SharpCompress.Compressors.LZMA; using SQLite.Net; -namespace osu.Game.Database +namespace osu.Game.Rulesets.Scoring { - public class ScoreDatabase : DatabaseBacking + public class ScoreDatabase : DatabaseStore { private readonly Storage storage; @@ -27,7 +28,7 @@ namespace osu.Game.Database // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private ScoreIPCChannel ipc; - public ScoreDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapStore beatmaps = null, RulesetDatabase rulesets = null) : base(storage, connection) + public ScoreDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapStore beatmaps = null, RulesetDatabase rulesets = null) : base(connection) { this.storage = storage; this.beatmaps = beatmaps; @@ -53,7 +54,7 @@ namespace osu.Game.Database var version = sr.ReadInt32(); /* score.FileChecksum = */ var beatmapHash = sr.ReadString(); - score.Beatmap = beatmaps.Query().FirstOrDefault(b => b.Hash == beatmapHash); + score.Beatmap = beatmaps.Database.Query().FirstOrDefault(b => b.Hash == beatmapHash); /* score.PlayerName = */ sr.ReadString(); /* var localScoreChecksum = */ diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 4f484e9638..a8f2c3c78f 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Menu private Track track; [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps, Framework.Game game) + private void load(AudioManager audio, OsuConfigManager config, BeatmapStore beatmaps, Framework.Game game) { menuVoice = config.GetBindable(OsuSetting.MenuVoice); menuMusic = config.GetBindable(OsuSetting.MenuMusic); @@ -76,7 +76,7 @@ namespace osu.Game.Screens.Menu if (!menuMusic) { - var query = beatmaps.Query().Where(b => !b.DeletePending); + var query = beatmaps.Database.Query().Where(b => !b.DeletePending); int count = query.Count(); if (count > 0) setInfo = query.ElementAt(RNG.Next(0, count - 1)); @@ -84,7 +84,7 @@ namespace osu.Game.Screens.Menu if (setInfo == null) { - var query = beatmaps.Query().Where(b => b.Hash == MENU_MUSIC_BEATMAP_HASH); + var query = beatmaps.Database.Query().Where(b => b.Hash == MENU_MUSIC_BEATMAP_HASH); setInfo = query.FirstOrDefault(); @@ -96,11 +96,11 @@ namespace osu.Game.Screens.Menu setInfo = query.First(); setInfo.DeletePending = true; - beatmaps.Update(setInfo, false); + beatmaps.Database.Update(setInfo, false); } } - beatmaps.GetChildren(setInfo); + beatmaps.Database.GetChildren(setInfo); Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); track = Beatmap.Value.Track; diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index b26d6d4385..736ed0c1d8 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Select /// /// Required for now unfortunately. /// - private BeatmapDatabase database; + private BeatmapStore store; private readonly Container scrollableContent; @@ -289,7 +289,7 @@ namespace osu.Game.Screens.Select b.Metadata = beatmapSet.Metadata; } - return new BeatmapGroup(beatmapSet, database) + return new BeatmapGroup(beatmapSet, store) { SelectionChanged = (g, p) => selectGroup(g, p), StartRequested = b => StartRequested?.Invoke(), @@ -298,9 +298,9 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapDatabase database, OsuConfigManager config) + private void load(BeatmapStore store, OsuConfigManager config) { - this.database = database; + this.store = store; randomType = config.GetBindable(OsuSetting.SelectionRandomType); } diff --git a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs index b27119a16d..a605691ec5 100644 --- a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs +++ b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs @@ -11,12 +11,12 @@ namespace osu.Game.Screens.Select { public class BeatmapDeleteDialog : PopupDialog { - private BeatmapDatabase database; + private BeatmapStore store; [BackgroundDependencyLoader] - private void load(BeatmapDatabase beatmapDatabase) + private void load(BeatmapStore beatmapStore) { - database = beatmapDatabase; + store = beatmapStore; } public BeatmapDeleteDialog(WorkingBeatmap beatmap) @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Select Action = () => { beatmap.Dispose(); - database.Delete(beatmap.BeatmapSetInfo); + store.Delete(beatmap.BeatmapSetInfo); }, }, new PopupDialogCancelButton diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index cee5e88deb..ef1a65d914 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select public abstract class SongSelect : OsuScreen { private readonly Bindable ruleset = new Bindable(); - private BeatmapDatabase database; + private BeatmapStore store; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(); private readonly BeatmapCarousel carousel; @@ -154,7 +154,7 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, UserInputManager input) + private void load(BeatmapStore beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, UserInputManager input) { if (Footer != null) { @@ -164,14 +164,14 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue); } - if (database == null) - database = beatmaps; + if (store == null) + store = beatmaps; if (osu != null) ruleset.BindTo(osu.Ruleset); - database.BeatmapSetAdded += onBeatmapSetAdded; - database.BeatmapSetRemoved += onBeatmapSetRemoved; + store.BeatmapSetAdded += onBeatmapSetAdded; + store.BeatmapSetRemoved += onBeatmapSetRemoved; dialogOverlay = dialog; @@ -180,7 +180,7 @@ namespace osu.Game.Screens.Select initialAddSetsTask = new CancellationTokenSource(); - carousel.Beatmaps = database.GetAllWithChildren(b => !b.DeletePending); + carousel.Beatmaps = store.Database.GetAllWithChildren(b => !b.DeletePending); Beatmap.ValueChanged += beatmap_ValueChanged; @@ -230,7 +230,7 @@ namespace osu.Game.Screens.Select { bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID; - Beatmap.Value = database.GetWorkingBeatmap(beatmap, Beatmap); + Beatmap.Value = store.GetWorkingBeatmap(beatmap, Beatmap); ensurePlayingSelected(preview); } @@ -341,10 +341,10 @@ namespace osu.Game.Screens.Select { base.Dispose(isDisposing); - if (database != null) + if (store != null) { - database.BeatmapSetAdded -= onBeatmapSetAdded; - database.BeatmapSetRemoved -= onBeatmapSetRemoved; + store.BeatmapSetAdded -= onBeatmapSetAdded; + store.BeatmapSetRemoved -= onBeatmapSetRemoved; } initialAddSetsTask?.Cancel(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 42067fb8d5..43c300dc30 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -74,6 +74,7 @@ + @@ -125,10 +126,10 @@ - - + + - + @@ -215,7 +216,7 @@ - + @@ -390,10 +391,10 @@ - - - - + + + + @@ -488,10 +489,10 @@ - + - - + + From 5fc68aabbfdba8dd915081f8329c80cdc6764fbe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jul 2017 17:14:38 +0900 Subject: [PATCH 074/132] Fix reset function not running in correct order --- osu.Game/Beatmaps/BeatmapDatabase.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDatabase.cs b/osu.Game/Beatmaps/BeatmapDatabase.cs index 2e8e5da65b..ca607c87eb 100644 --- a/osu.Game/Beatmaps/BeatmapDatabase.cs +++ b/osu.Game/Beatmaps/BeatmapDatabase.cs @@ -32,11 +32,6 @@ namespace osu.Game.Beatmaps protected override void Prepare(bool reset = false) { - Connection.CreateTable(); - Connection.CreateTable(); - Connection.CreateTable(); - Connection.CreateTable(); - if (reset) { Connection.DropTable(); @@ -45,6 +40,11 @@ namespace osu.Game.Beatmaps Connection.DropTable(); } + Connection.CreateTable(); + Connection.CreateTable(); + Connection.CreateTable(); + Connection.CreateTable(); + deletePending(); } From 898a60109873697ed8b165ab3f5e8f885af41843 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jul 2017 20:22:02 +0900 Subject: [PATCH 075/132] Introduce a reference counting file store --- .../Tests/TestCasePlaySongSelect.cs | 2 +- .../Beatmaps/IO/LegacyFilesystemReader.cs | 43 ------ osu.Desktop/Program.cs | 3 - osu.Desktop/osu.Desktop.csproj | 1 - .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 6 - .../Beatmaps/IO/OszArchiveReaderTest.cs | 9 +- osu.Game/Beatmaps/BeatmapDatabase.cs | 43 ++++-- osu.Game/Beatmaps/BeatmapInfo.cs | 4 +- osu.Game/Beatmaps/BeatmapSetFileInfo.cs | 17 +++ osu.Game/Beatmaps/BeatmapSetInfo.cs | 8 +- osu.Game/Beatmaps/BeatmapStore.cs | 132 +++++++++++------- .../Beatmaps/BeatmapStoreWorkingBeatmap.cs | 18 +-- osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 5 + osu.Game/Beatmaps/IO/ArchiveReader.cs | 36 +---- .../Beatmaps/IO/LegacyFilesystemReader.cs | 33 +++++ osu.Game/Beatmaps/IO/OszArchiveReader.cs | 32 ++--- osu.Game/Database/DatabaseStore.cs | 18 +-- osu.Game/IO/FileDatabase.cs | 114 +++++++++++++++ osu.Game/IO/FileInfo.cs | 24 ++++ osu.Game/OsuGameBase.cs | 9 +- osu.Game/Screens/Menu/Intro.cs | 15 +- osu.Game/osu.Game.csproj | 4 + 22 files changed, 361 insertions(+), 215 deletions(-) delete mode 100644 osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs create mode 100644 osu.Game/Beatmaps/BeatmapSetFileInfo.cs create mode 100644 osu.Game/Beatmaps/IO/LegacyFilesystemReader.cs create mode 100644 osu.Game/IO/FileDatabase.cs create mode 100644 osu.Game/IO/FileInfo.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 6d41be72c7..a17b873b0d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -31,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests var backingDatabase = storage.GetDatabase(@"client"); rulesets = new RulesetDatabase(backingDatabase); - store = new BeatmapStore(storage, backingDatabase, rulesets); + store = new BeatmapStore(storage, null, backingDatabase, rulesets); var sets = new List(); diff --git a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs deleted file mode 100644 index 8772fc9f28..0000000000 --- a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.IO; -using System.Linq; -using osu.Game.Beatmaps.IO; - -namespace osu.Desktop.Beatmaps.IO -{ - /// - /// Reads an extracted legacy beatmap from disk. - /// - public class LegacyFilesystemReader : ArchiveReader - { - public static void Register() => AddReader((storage, path) => Directory.Exists(path)); - - private readonly string basePath; - - public LegacyFilesystemReader(string path) - { - basePath = path; - - BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(Path.GetFileName).ToArray(); - - if (BeatmapFilenames.Length == 0) - throw new FileNotFoundException(@"This directory contains no beatmaps"); - - StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(Path.GetFileName).FirstOrDefault(); - } - - public override Stream GetStream(string name) - { - return File.OpenRead(Path.Combine(basePath, name)); - } - - public override void Dispose() - { - // no-op - } - - public override Stream GetUnderlyingStream() => null; - } -} diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 210f780078..3b63239525 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -3,7 +3,6 @@ using System; using System.IO; -using osu.Desktop.Beatmaps.IO; using osu.Framework.Desktop; using osu.Framework.Desktop.Platform; using osu.Game.IPC; @@ -15,8 +14,6 @@ namespace osu.Desktop [STAThread] public static int Main(string[] args) { - LegacyFilesystemReader.Register(); - // Back up the cwd before DesktopGameHost changes it var cwd = Environment.CurrentDirectory; diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index e69603602c..82fbefec7a 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -228,7 +228,6 @@ - diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 4814af984e..da3b448f74 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -16,12 +16,6 @@ namespace osu.Game.Tests.Beatmaps.Formats [TestFixture] public class OsuLegacyDecoderTest { - [OneTimeSetUpAttribute] - public void SetUp() - { - OsuLegacyDecoder.Register(); - } - [Test] public void TestDecodeMetadata() { diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index fadfa872ce..7a7a8a58bc 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.IO; +using System.Linq; using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Beatmaps.IO; @@ -13,12 +14,6 @@ namespace osu.Game.Tests.Beatmaps.IO [TestFixture] public class OszArchiveReaderTest { - [OneTimeSetUpAttribute] - public void SetUp() - { - OszArchiveReader.Register(); - } - [Test] public void TestReadBeatmaps() { @@ -40,7 +35,7 @@ namespace osu.Game.Tests.Beatmaps.IO "Soleily - Renatus (MMzz) [Muzukashii].osu", "Soleily - Renatus (MMzz) [Oni].osu" }; - var maps = reader.BeatmapFilenames; + var maps = reader.Filenames.ToArray(); foreach (var map in expected) Assert.Contains(map, maps); } diff --git a/osu.Game/Beatmaps/BeatmapDatabase.cs b/osu.Game/Beatmaps/BeatmapDatabase.cs index ca607c87eb..1fd3f5b52f 100644 --- a/osu.Game/Beatmaps/BeatmapDatabase.cs +++ b/osu.Game/Beatmaps/BeatmapDatabase.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using osu.Framework.Logging; using osu.Game.Database; -using osu.Game.Screens.Menu; using SQLite.Net; using SQLiteNetExtensions.Extensions; @@ -19,11 +18,13 @@ namespace osu.Game.Beatmaps public event Action BeatmapSetAdded; public event Action BeatmapSetRemoved; - public BeatmapDatabase(SQLiteConnection connection) : base(connection) + public BeatmapDatabase(SQLiteConnection connection) + : base(connection) { } - protected override Type[] ValidTypes => new[] { + protected override Type[] ValidTypes => new[] + { typeof(BeatmapSetInfo), typeof(BeatmapInfo), typeof(BeatmapMetadata), @@ -37,17 +38,21 @@ namespace osu.Game.Beatmaps Connection.DropTable(); Connection.DropTable(); Connection.DropTable(); + Connection.DropTable(); Connection.DropTable(); } Connection.CreateTable(); Connection.CreateTable(); Connection.CreateTable(); + Connection.CreateTable(); Connection.CreateTable(); deletePending(); } + public void Update(BeatmapSetInfo setInfo) => Connection.Update(setInfo); + public void Import(IEnumerable beatmapSets) { lock (Connection) @@ -64,24 +69,32 @@ namespace osu.Game.Beatmaps } } - public void Delete(IEnumerable beatmapSets) + public bool Delete(BeatmapSetInfo set) { - foreach (var s in beatmapSets) - { - s.DeletePending = true; - Update(s, false); - BeatmapSetRemoved?.Invoke(s); - } + if (set.DeletePending) return false; + + set.DeletePending = true; + Connection.Update(set); + + BeatmapSetRemoved?.Invoke(set); + return true; + } + + public bool Undelete(BeatmapSetInfo set) + { + if (!set.DeletePending) return false; + + set.DeletePending = false; + Connection.Update(set); + + BeatmapSetAdded?.Invoke(set); + return true; } private void deletePending() { - foreach (var b in GetAllWithChildren(b => b.DeletePending)) + foreach (var b in GetAllWithChildren(b => b.DeletePending && !b.Protected)) { - if (b.Hash == Intro.MENU_MUSIC_BEATMAP_HASH) - // this is a bit hacky, but will do for now. - continue; - try { foreach (var i in b.Beatmaps) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index a154fc008a..32d50145a6 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -95,11 +95,11 @@ namespace osu.Game.Beatmaps } public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && - BeatmapSet.Path == other.BeatmapSet.Path && + BeatmapSet.Hash == other.BeatmapSet.Hash && (Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile; public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && - BeatmapSet.Path == other.BeatmapSet.Path && + BeatmapSet.Hash == other.BeatmapSet.Hash && (Metadata ?? BeatmapSet.Metadata).BackgroundFile == (other.Metadata ?? other.BeatmapSet.Metadata).BackgroundFile; } } diff --git a/osu.Game/Beatmaps/BeatmapSetFileInfo.cs b/osu.Game/Beatmaps/BeatmapSetFileInfo.cs new file mode 100644 index 0000000000..d18b1e833b --- /dev/null +++ b/osu.Game/Beatmaps/BeatmapSetFileInfo.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.IO; +using SQLiteNetExtensions.Attributes; + +namespace osu.Game.Beatmaps +{ + public class BeatmapSetFileInfo + { + [ForeignKey(typeof(BeatmapSetInfo))] + public int BeatmapSetInfoID { get; set; } + + [ForeignKey(typeof(FileInfo))] + public int FileInfoID { get; set; } + } +} \ No newline at end of file diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index 2e41ded28a..6a466fb3b2 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; +using osu.Game.IO; using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; @@ -34,8 +35,11 @@ namespace osu.Game.Beatmaps public string Hash { get; set; } - public string Path { get; set; } + public string StoryboardFile => Files.FirstOrDefault(f => f.Filename.EndsWith(".osb"))?.Filename; - public string StoryboardFile { get; set; } + [ManyToMany(typeof(BeatmapSetFileInfo))] + public List Files { get; set; } + + public bool Protected { get; set; } } } diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 4e5eeee0a4..b84d249893 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -5,14 +5,17 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using Ionic.Zip; using osu.Framework.Extensions; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.IO; +using osu.Game.IO; using osu.Game.IPC; using osu.Game.Rulesets; using SQLite.Net; +using FileInfo = osu.Game.IO.FileInfo; namespace osu.Game.Beatmaps { @@ -25,6 +28,7 @@ namespace osu.Game.Beatmaps public readonly BeatmapDatabase Database; private readonly Storage storage; + private readonly FileDatabase files; private readonly RulesetDatabase rulesets; @@ -39,14 +43,16 @@ namespace osu.Game.Beatmaps /// public WorkingBeatmap DefaultBeatmap { private get; set; } - public BeatmapStore(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) + public BeatmapStore(Storage storage, FileDatabase files, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) { Database = new BeatmapDatabase(connection); Database.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); Database.BeatmapSetRemoved += s => BeatmapSetRemoved?.Invoke(s); this.storage = storage; + this.files = files; this.rulesets = rulesets; + if (importHost != null) ipc = new BeatmapIPCChannel(importHost, this); } @@ -61,7 +67,8 @@ namespace osu.Game.Beatmaps { try { - Import(ArchiveReader.GetReader(storage, path)); + using (ArchiveReader reader = getReaderFrom(path)) + Import(reader); // We may or may not want to delete the file depending on where it is stored. // e.g. reconstructing/repairing database with beatmaps from default storage. @@ -88,28 +95,44 @@ namespace osu.Game.Beatmaps /// Import a beatmap from an . /// /// The beatmap to be imported. - public void Import(ArchiveReader archiveReader) + public BeatmapSetInfo Import(ArchiveReader archiveReader) { BeatmapSetInfo set = importToStorage(archiveReader); //If we have an ID then we already exist in the database. if (set.ID == 0) Database.Import(new[] { set }); + + return set; } /// /// Delete a beatmap from the store. /// /// The beatmap to delete. - public void Delete(BeatmapSetInfo beatmapSet) => Database.Delete(new[] { beatmapSet }); + public void Delete(BeatmapSetInfo beatmapSet) + { + if (!Database.Delete(beatmapSet)) return; + + if (!beatmapSet.Protected) + files.Dereference(beatmapSet.Files); + } + + public void Undelete(BeatmapSetInfo beatmapSet) + { + if (!Database.Undelete(beatmapSet)) return; + + files.Reference(beatmapSet.Files); + } public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) { if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) return DefaultBeatmap; - if (beatmapInfo.BeatmapSet == null || beatmapInfo.Ruleset == null) - beatmapInfo = Database.GetChildren(beatmapInfo, true); + beatmapInfo = Database.GetChildren(beatmapInfo, true); + + Database.GetChildren(beatmapInfo.BeatmapSet, true); if (beatmapInfo.BeatmapSet == null) throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); @@ -117,7 +140,7 @@ namespace osu.Game.Beatmaps if (beatmapInfo.Metadata == null) beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; - WorkingBeatmap working = new BeatmapStoreWorkingBeatmap(() => string.IsNullOrEmpty(beatmapInfo.BeatmapSet.Path) ? null : ArchiveReader.GetReader(storage, beatmapInfo.BeatmapSet.Path), beatmapInfo); + WorkingBeatmap working = new BeatmapStoreWorkingBeatmap(files.Store, beatmapInfo); previous?.TransferTo(working); @@ -132,38 +155,43 @@ namespace osu.Game.Beatmaps Database.Reset(); } + private ArchiveReader getReaderFrom(string path) + { + if (ZipFile.IsZipFile(path)) + return new OszArchiveReader(storage.GetStream(path)); + else + return new LegacyFilesystemReader(path); + } + private BeatmapSetInfo importToStorage(ArchiveReader archiveReader) { BeatmapMetadata metadata; - using (var stream = new StreamReader(archiveReader.GetStream(archiveReader.BeatmapFilenames[0]))) + using (var stream = new StreamReader(archiveReader.GetStream(archiveReader.Filenames.First(f => f.EndsWith(".osu"))))) metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; - string hash; - string path; + MemoryStream hashable = new MemoryStream(); - using (var input = archiveReader.GetUnderlyingStream()) + List fileInfos = new List(); + + foreach (string file in archiveReader.Filenames) { - hash = input.GetMd5Hash(); - input.Seek(0, SeekOrigin.Begin); - path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash); - if (!storage.Exists(path)) - using (var output = storage.GetStream(path, FileAccess.Write)) - input.CopyTo(output); + using (Stream s = archiveReader.GetStream(file)) + { + fileInfos.Add(files.Add(s, file)); + s.CopyTo(hashable); + } } - var existing = Database.Query().FirstOrDefault(b => b.Hash == hash); + var overallHash = hashable.GetMd5Hash(); + + var existing = Database.Query().FirstOrDefault(b => b.Hash == overallHash); if (existing != null) { Database.GetChildren(existing); - if (existing.DeletePending) - { - existing.DeletePending = false; - Database.Update(existing, false); - BeatmapSetAdded?.Invoke(existing); - } + Undelete(existing); return existing; } @@ -172,41 +200,51 @@ namespace osu.Game.Beatmaps { OnlineBeatmapSetID = metadata.OnlineBeatmapSetID, Beatmaps = new List(), - Path = path, - Hash = hash, + Hash = overallHash, + Files = fileInfos, Metadata = metadata }; - using (var archive = ArchiveReader.GetReader(storage, path)) + var mapNames = archiveReader.Filenames.Where(f => f.EndsWith(".osu")); + + foreach (var name in mapNames) { - string[] mapNames = archive.BeatmapFilenames; - foreach (var name in mapNames) - using (var raw = archive.GetStream(name)) - using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit - using (var sr = new StreamReader(ms)) - { - raw.CopyTo(ms); - ms.Position = 0; + using (var raw = archiveReader.GetStream(name)) + using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit + using (var sr = new StreamReader(ms)) + { + raw.CopyTo(ms); + ms.Position = 0; - var decoder = BeatmapDecoder.GetDecoder(sr); - Beatmap beatmap = decoder.Decode(sr); + var decoder = BeatmapDecoder.GetDecoder(sr); + Beatmap beatmap = decoder.Decode(sr); - beatmap.BeatmapInfo.Path = name; - beatmap.BeatmapInfo.Hash = ms.GetMd5Hash(); + beatmap.BeatmapInfo.Path = name; + beatmap.BeatmapInfo.Hash = ms.GetMd5Hash(); - // TODO: Diff beatmap metadata with set metadata and leave it here if necessary - beatmap.BeatmapInfo.Metadata = null; + // TODO: Diff beatmap metadata with set metadata and leave it here if necessary + beatmap.BeatmapInfo.Metadata = null; - // TODO: this should be done in a better place once we actually need to dynamically update it. - beatmap.BeatmapInfo.Ruleset = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID); - beatmap.BeatmapInfo.StarDifficulty = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap).Calculate() ?? 0; + // TODO: this should be done in a better place once we actually need to dynamically update it. + beatmap.BeatmapInfo.Ruleset = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID); + beatmap.BeatmapInfo.StarDifficulty = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap) + .Calculate() ?? 0; - beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); - } - beatmapSet.StoryboardFile = archive.StoryboardFilename; + beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); + } } return beatmapSet; } + + public BeatmapSetInfo QueryBeatmapSet(Func func) + { + BeatmapSetInfo set = Database.Query().FirstOrDefault(func); + + if (set != null) + Database.GetChildren(set, true); + + return set; + } } } diff --git a/osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs index 478cd7d87d..3ddd7eecd6 100644 --- a/osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs @@ -1,8 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.IO; +using System.Linq; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; @@ -12,12 +12,12 @@ namespace osu.Game.Beatmaps { internal class BeatmapStoreWorkingBeatmap : WorkingBeatmap { - private readonly Func> getStore; + private readonly IResourceStore store; - public BeatmapStoreWorkingBeatmap(Func> getStore, BeatmapInfo beatmapInfo) + public BeatmapStoreWorkingBeatmap(IResourceStore store, BeatmapInfo beatmapInfo) : base(beatmapInfo) { - this.getStore = getStore; + this.store = store; } protected override Beatmap GetBeatmap() @@ -27,7 +27,7 @@ namespace osu.Game.Beatmaps Beatmap beatmap; BeatmapDecoder decoder; - using (var stream = new StreamReader(getStore().GetStream(BeatmapInfo.Path))) + using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo.Path)))) { decoder = BeatmapDecoder.GetDecoder(stream); beatmap = decoder.Decode(stream); @@ -36,7 +36,7 @@ namespace osu.Game.Beatmaps if (beatmap == null || BeatmapSetInfo.StoryboardFile == null) return beatmap; - using (var stream = new StreamReader(getStore().GetStream(BeatmapSetInfo.StoryboardFile))) + using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapSetInfo.StoryboardFile)))) decoder.Decode(stream, beatmap); @@ -45,6 +45,8 @@ namespace osu.Game.Beatmaps catch { return null; } } + private string getPathForFile(string filename) => BeatmapSetInfo.Files.First(f => f.Filename == filename).StoragePath; + protected override Texture GetBackground() { if (Metadata?.BackgroundFile == null) @@ -52,7 +54,7 @@ namespace osu.Game.Beatmaps try { - return new TextureStore(new RawTextureLoaderStore(getStore()), false).Get(Metadata.BackgroundFile); + return new TextureStore(new RawTextureLoaderStore(store), false).Get(getPathForFile(Metadata.BackgroundFile)); } catch { return null; } } @@ -61,7 +63,7 @@ namespace osu.Game.Beatmaps { try { - var trackData = getStore().GetStream(Metadata.AudioFile); + var trackData = store.GetStream(getPathForFile(Metadata.AudioFile)); return trackData == null ? null : new TrackBass(trackData); } catch { return new TrackVirtual(); } diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index a365974cfa..1c3eadc91e 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -12,6 +12,11 @@ namespace osu.Game.Beatmaps.Formats { private static readonly Dictionary decoders = new Dictionary(); + static BeatmapDecoder() + { + OsuLegacyDecoder.Register(); + } + public static BeatmapDecoder GetDecoder(StreamReader stream) { string line = stream.ReadLine()?.Trim(); diff --git a/osu.Game/Beatmaps/IO/ArchiveReader.cs b/osu.Game/Beatmaps/IO/ArchiveReader.cs index 7ff5668b6f..3af2a7ea2a 100644 --- a/osu.Game/Beatmaps/IO/ArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/ArchiveReader.cs @@ -5,45 +5,11 @@ using System; using System.Collections.Generic; using System.IO; using osu.Framework.IO.Stores; -using osu.Framework.Platform; namespace osu.Game.Beatmaps.IO { public abstract class ArchiveReader : IDisposable, IResourceStore { - private class Reader - { - public Func Test; - public Type Type; - } - - private static readonly List readers = new List(); - - public static ArchiveReader GetReader(Storage storage, string path) - { - foreach (var reader in readers) - { - if (reader.Test(storage, path)) - return (ArchiveReader)Activator.CreateInstance(reader.Type, storage.GetStream(path)); - } - throw new IOException(@"Unknown file format"); - } - - protected static void AddReader(Func test) where T : ArchiveReader - { - readers.Add(new Reader { Test = test, Type = typeof(T) }); - } - - /// - /// Gets a list of beatmap file names. - /// - public string[] BeatmapFilenames { get; protected set; } - - /// - /// The storyboard filename. Null if no storyboard is present. - /// - public string StoryboardFilename { get; protected set; } - /// /// Opens a stream for reading a specific file from this archive. /// @@ -51,6 +17,8 @@ namespace osu.Game.Beatmaps.IO public abstract void Dispose(); + public abstract IEnumerable Filenames { get; } + public virtual byte[] Get(string name) { using (Stream input = GetStream(name)) diff --git a/osu.Game/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Game/Beatmaps/IO/LegacyFilesystemReader.cs new file mode 100644 index 0000000000..dc38181717 --- /dev/null +++ b/osu.Game/Beatmaps/IO/LegacyFilesystemReader.cs @@ -0,0 +1,33 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace osu.Game.Beatmaps.IO +{ + /// + /// Reads an extracted legacy beatmap from disk. + /// + public class LegacyFilesystemReader : ArchiveReader + { + private readonly string path; + + public LegacyFilesystemReader(string path) + { + this.path = path; + } + + public override Stream GetStream(string name) => File.OpenRead(Path.Combine(path, name)); + + public override void Dispose() + { + // no-op + } + + public override IEnumerable Filenames => Directory.GetFiles(path).Select(Path.GetFileName).ToArray(); + + public override Stream GetUnderlyingStream() => null; + } +} diff --git a/osu.Game/Beatmaps/IO/OszArchiveReader.cs b/osu.Game/Beatmaps/IO/OszArchiveReader.cs index a22a5f4cce..4e0c40d28e 100644 --- a/osu.Game/Beatmaps/IO/OszArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/OszArchiveReader.cs @@ -1,25 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using System.IO; using System.Linq; using Ionic.Zip; -using osu.Game.Beatmaps.Formats; namespace osu.Game.Beatmaps.IO { public sealed class OszArchiveReader : ArchiveReader { - public static void Register() - { - AddReader((storage, path) => - { - using (var stream = storage.GetStream(path)) - return stream != null && ZipFile.IsZipFile(stream, false); - }); - OsuLegacyDecoder.Register(); - } - private readonly Stream archiveStream; private readonly ZipFile archive; @@ -27,13 +17,6 @@ namespace osu.Game.Beatmaps.IO { this.archiveStream = archiveStream; archive = ZipFile.Read(archiveStream); - - BeatmapFilenames = archive.Entries.Where(e => e.FileName.EndsWith(@".osu")).Select(e => e.FileName).ToArray(); - - if (BeatmapFilenames.Length == 0) - throw new FileNotFoundException(@"This directory contains no beatmaps"); - - StoryboardFilename = archive.Entries.Where(e => e.FileName.EndsWith(@".osb")).Select(e => e.FileName).FirstOrDefault(); } public override Stream GetStream(string name) @@ -41,7 +24,16 @@ namespace osu.Game.Beatmaps.IO ZipEntry entry = archive.Entries.SingleOrDefault(e => e.FileName == name); if (entry == null) throw new FileNotFoundException(); - return entry.OpenReader(); + + // allow seeking + MemoryStream copy = new MemoryStream(); + + using (Stream s = entry.OpenReader()) + s.CopyTo(copy); + + copy.Position = 0; + + return copy; } public override void Dispose() @@ -50,6 +42,8 @@ namespace osu.Game.Beatmaps.IO archiveStream.Dispose(); } + public override IEnumerable Filenames => archive.Entries.Select(e => e.FileName).ToArray(); + public override Stream GetUnderlyingStream() => archiveStream; } } \ No newline at end of file diff --git a/osu.Game/Database/DatabaseStore.cs b/osu.Game/Database/DatabaseStore.cs index 0102998604..5187769bb2 100644 --- a/osu.Game/Database/DatabaseStore.cs +++ b/osu.Game/Database/DatabaseStore.cs @@ -3,9 +3,9 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Linq.Expressions; using osu.Framework.Logging; +using osu.Framework.Platform; using SQLite.Net; using SQLiteNetExtensions.Extensions; @@ -13,10 +13,12 @@ namespace osu.Game.Database { public abstract class DatabaseStore { - protected SQLiteConnection Connection { get; } + protected readonly Storage Storage; + protected readonly SQLiteConnection Connection; - protected DatabaseStore(SQLiteConnection connection) + protected DatabaseStore(SQLiteConnection connection, Storage storage = null) { + Storage = storage; Connection = connection; try @@ -63,15 +65,5 @@ namespace osu.Game.Database } protected abstract Type[] ValidTypes { get; } - - public void Update(T record, bool cascade = true) where T : class - { - if (ValidTypes.All(t => t != typeof(T))) - throw new ArgumentException("Must be a type managed by BeatmapDatabase", nameof(T)); - if (cascade) - Connection.UpdateWithChildren(record); - else - Connection.Update(record); - } } } \ No newline at end of file diff --git a/osu.Game/IO/FileDatabase.cs b/osu.Game/IO/FileDatabase.cs new file mode 100644 index 0000000000..b61fbdb0e1 --- /dev/null +++ b/osu.Game/IO/FileDatabase.cs @@ -0,0 +1,114 @@ +// 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.IO; +using System.Linq; +using osu.Framework.Extensions; +using osu.Framework.IO.Stores; +using osu.Framework.Logging; +using osu.Framework.Platform; +using osu.Game.Database; +using SQLite.Net; + +namespace osu.Game.IO +{ + /// + /// Handles the Store and retrieval of Files/FileSets to the database backing + /// + public class FileDatabase : DatabaseStore + { + private const string prefix = "files"; + + public readonly ResourceStore Store; + + public FileDatabase(SQLiteConnection connection, Storage storage) : base(connection, storage) + { + Store = new NamespacedResourceStore(new StorageBackedResourceStore(storage), prefix); + } + + protected override Type[] ValidTypes => new[] { + typeof(FileInfo), + }; + + protected override void Prepare(bool reset = false) + { + if (reset) + Connection.DropTable(); + + Connection.CreateTable(); + + deletePending(); + } + + public FileInfo Add(Stream data, string filename = null) + { + string hash = data.GetMd5Hash(); + + var info = new FileInfo + { + Filename = filename, + Hash = hash, + }; + + var existing = Connection.Table().FirstOrDefault(f => f.Hash == info.Hash); + + if (existing != null) + { + info = existing; + } + else + { + string path = Path.Combine(prefix, info.StoragePath); + + data.Seek(0, SeekOrigin.Begin); + + if (!Storage.Exists(path)) + using (var output = Storage.GetStream(path, FileAccess.Write)) + data.CopyTo(output); + + data.Seek(0, SeekOrigin.Begin); + + Connection.Insert(info); + } + + Reference(new[] { info }); + return info; + } + + public void Reference(IEnumerable files) + { + foreach (var f in files) + { + f.ReferenceCount++; + Connection.Update(f); + } + } + + public void Dereference(IEnumerable files) + { + foreach (var f in files) + { + f.ReferenceCount--; + Connection.Update(f); + } + } + + private void deletePending() + { + foreach (var f in GetAllWithChildren(f => f.ReferenceCount < 1)) + { + try + { + Connection.Delete(f); + Storage.Delete(Path.Combine(prefix, f.Hash)); + } + catch (Exception e) + { + Logger.Error(e, $@"Could not delete beatmap {f}"); + } + } + } + } +} \ No newline at end of file diff --git a/osu.Game/IO/FileInfo.cs b/osu.Game/IO/FileInfo.cs new file mode 100644 index 0000000000..6f4c4b26e8 --- /dev/null +++ b/osu.Game/IO/FileInfo.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.IO; +using SQLite.Net.Attributes; + +namespace osu.Game.IO +{ + public class FileInfo + { + [PrimaryKey, AutoIncrement] + public int ID { get; set; } + + public string Filename { get; set; } + + [Indexed(Unique = true)] + public string Hash { get; set; } + + public string StoragePath => Path.Combine(Hash.Remove(1), Hash.Remove(2), Hash); + + [Indexed] + public int ReferenceCount { get; set; } + } +} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 82e4b5d4ca..8ad07cd7bc 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.IO.Stores; using osu.Framework.Platform; using osu.Game.Beatmaps; -using osu.Game.Beatmaps.IO; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Cursor; @@ -19,6 +18,7 @@ using osu.Game.Graphics.Processing; using osu.Game.Online.API; using SQLite.Net; using osu.Framework.Graphics.Performance; +using osu.Game.IO; using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; @@ -32,6 +32,8 @@ namespace osu.Game protected RulesetDatabase RulesetDatabase; + protected FileDatabase FileDatabase; + protected ScoreDatabase ScoreDatabase; protected override string MainResourceFile => @"osu.Game.Resources.dll"; @@ -96,7 +98,8 @@ namespace osu.Game SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); dependencies.Cache(RulesetDatabase = new RulesetDatabase(connection)); - dependencies.Cache(BeatmapStore = new BeatmapStore(Host.Storage, connection, RulesetDatabase, Host)); + dependencies.Cache(FileDatabase = new FileDatabase(connection, Host.Storage)); + dependencies.Cache(BeatmapStore = new BeatmapStore(Host.Storage, FileDatabase, connection, RulesetDatabase, Host)); dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapStore)); dependencies.Cache(new OsuColour()); @@ -131,8 +134,6 @@ namespace osu.Game Beatmap = new NonNullableBindable(defaultBeatmap); BeatmapStore.DefaultBeatmap = defaultBeatmap; - OszArchiveReader.Register(); - dependencies.Cache(API = new APIAccess { Username = LocalConfig.Get(OsuSetting.Username), diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index a8f2c3c78f..55eedaba9a 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Menu { private readonly OsuLogo logo; - public const string MENU_MUSIC_BEATMAP_HASH = "21c1271b91234385978b5418881fdd88"; + private const string menu_music_beatmap_hash = "715a09144f885d746644c1983e285044"; /// /// Whether we have loaded the menu previously. @@ -84,23 +84,18 @@ namespace osu.Game.Screens.Menu if (setInfo == null) { - var query = beatmaps.Database.Query().Where(b => b.Hash == MENU_MUSIC_BEATMAP_HASH); - - setInfo = query.FirstOrDefault(); + setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == menu_music_beatmap_hash); if (setInfo == null) { // we need to import the default menu background beatmap - beatmaps.Import(new OszArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz"))); + setInfo = beatmaps.Import(new OszArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz"))); - setInfo = query.First(); - - setInfo.DeletePending = true; - beatmaps.Database.Update(setInfo, false); + setInfo.Protected = true; + beatmaps.Delete(setInfo); } } - beatmaps.Database.GetChildren(setInfo); Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); track = Beatmap.Value.Track; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 43c300dc30..13c4056bba 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -75,9 +75,11 @@ + + @@ -89,6 +91,8 @@ + + From 99e53b510965f16fb713a6ab785e95f5cb738e33 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jul 2017 22:48:16 +0900 Subject: [PATCH 076/132] Initial documentation pass on BeatmapStore --- osu.Game/Beatmaps/BeatmapStore.cs | 37 ++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index b84d249893..9e0df553c3 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -108,6 +108,7 @@ namespace osu.Game.Beatmaps /// /// Delete a beatmap from the store. + /// Is a no-op for already deleted beatmaps. /// /// The beatmap to delete. public void Delete(BeatmapSetInfo beatmapSet) @@ -118,6 +119,11 @@ namespace osu.Game.Beatmaps files.Dereference(beatmapSet.Files); } + /// + /// Returns a to a usable state if it has previously been deleted but not yet purged. + /// Is a no-op for already usable beatmaps. + /// + /// The beatmap to restore. public void Undelete(BeatmapSetInfo beatmapSet) { if (!Database.Undelete(beatmapSet)) return; @@ -125,6 +131,12 @@ namespace osu.Game.Beatmaps files.Reference(beatmapSet.Files); } + /// + /// Retrieve a instance for the provided + /// + /// The beatmap to lookup. + /// The currently loaded . Allows for optimisation where elements are shared with the new beatmap. + /// A instance correlating to the provided . public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) { if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) @@ -155,6 +167,11 @@ namespace osu.Game.Beatmaps Database.Reset(); } + /// + /// Creates an from a valid storage path. + /// + /// A file or folder path resolving the beatmap content. + /// A reader giving access to the beatmap's content. private ArchiveReader getReaderFrom(string path) { if (ZipFile.IsZipFile(path)) @@ -163,20 +180,26 @@ namespace osu.Game.Beatmaps return new LegacyFilesystemReader(path); } - private BeatmapSetInfo importToStorage(ArchiveReader archiveReader) + /// + /// Import a beamap into our local storage. + /// If the beatmap is already imported, the existing instance will be returned. + /// + /// The beatmap archive to be read. + /// The imported beatmap, or an existing instance if it is already present. + private BeatmapSetInfo importToStorage(ArchiveReader reader) { BeatmapMetadata metadata; - using (var stream = new StreamReader(archiveReader.GetStream(archiveReader.Filenames.First(f => f.EndsWith(".osu"))))) + using (var stream = new StreamReader(reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))))) metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; MemoryStream hashable = new MemoryStream(); List fileInfos = new List(); - foreach (string file in archiveReader.Filenames) + foreach (string file in reader.Filenames) { - using (Stream s = archiveReader.GetStream(file)) + using (Stream s = reader.GetStream(file)) { fileInfos.Add(files.Add(s, file)); s.CopyTo(hashable); @@ -190,9 +213,7 @@ namespace osu.Game.Beatmaps if (existing != null) { Database.GetChildren(existing); - Undelete(existing); - return existing; } @@ -205,11 +226,11 @@ namespace osu.Game.Beatmaps Metadata = metadata }; - var mapNames = archiveReader.Filenames.Where(f => f.EndsWith(".osu")); + var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu")); foreach (var name in mapNames) { - using (var raw = archiveReader.GetStream(name)) + using (var raw = reader.GetStream(name)) using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit using (var sr = new StreamReader(ms)) { From 07d4d2dbe4f54d869dfd7b1bf55ce9ec1b041747 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jul 2017 23:13:02 +0900 Subject: [PATCH 077/132] Secondary documentation pass on BeatmapStore --- osu.Game/Beatmaps/BeatmapStore.cs | 49 +++++++++++++++++++------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 9e0df553c3..4ee8f8a322 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -27,22 +27,30 @@ namespace osu.Game.Beatmaps // todo: make this private public readonly BeatmapDatabase Database; - private readonly Storage storage; - private readonly FileDatabase files; - - private readonly RulesetDatabase rulesets; - + /// + /// Fired when a new becomes available in the database. + /// public event Action BeatmapSetAdded; - public event Action BeatmapSetRemoved; - // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) - private BeatmapIPCChannel ipc; + /// + /// Fired when a is removed from the database. + /// + public event Action BeatmapSetRemoved; /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. /// public WorkingBeatmap DefaultBeatmap { private get; set; } + private readonly Storage storage; + + private readonly FileDatabase files; + + private readonly RulesetDatabase rulesets; + + // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) + private BeatmapIPCChannel ipc; + public BeatmapStore(Storage storage, FileDatabase files, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) { Database = new BeatmapDatabase(connection); @@ -167,6 +175,21 @@ namespace osu.Game.Beatmaps Database.Reset(); } + /// + /// Perform a lookup query on available s. + /// + /// The query. + /// The first result for the provided query, or null if no results were found. + public BeatmapSetInfo QueryBeatmapSet(Func query) + { + BeatmapSetInfo set = Database.Query().FirstOrDefault(query); + + if (set != null) + Database.GetChildren(set, true); + + return set; + } + /// /// Creates an from a valid storage path. /// @@ -257,15 +280,5 @@ namespace osu.Game.Beatmaps return beatmapSet; } - - public BeatmapSetInfo QueryBeatmapSet(Func func) - { - BeatmapSetInfo set = Database.Query().FirstOrDefault(func); - - if (set != null) - Database.GetChildren(set, true); - - return set; - } } } From 87add0765e9b1cc6757907b3c654cfd52541170f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 00:04:27 +0900 Subject: [PATCH 078/132] Initial documentation pass on BeatmapDatabase Also a bit of tidying up. --- .../Tests/TestCasePlaySongSelect.cs | 6 +-- osu.Game/Beatmaps/BeatmapDatabase.cs | 48 ++++++++++--------- osu.Game/Beatmaps/BeatmapStore.cs | 2 +- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index a17b873b0d..d27a7507ab 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -33,12 +33,8 @@ namespace osu.Desktop.VisualTests.Tests rulesets = new RulesetDatabase(backingDatabase); store = new BeatmapStore(storage, null, backingDatabase, rulesets); - var sets = new List(); - for (int i = 0; i < 100; i += 10) - sets.Add(createTestBeatmapSet(i)); - - store.Database.Import(sets); + store.Database.Add(createTestBeatmapSet(i)); } Add(songSelect = new PlaySongSelect()); diff --git a/osu.Game/Beatmaps/BeatmapDatabase.cs b/osu.Game/Beatmaps/BeatmapDatabase.cs index 1fd3f5b52f..b05ea815c6 100644 --- a/osu.Game/Beatmaps/BeatmapDatabase.cs +++ b/osu.Game/Beatmaps/BeatmapDatabase.cs @@ -48,38 +48,40 @@ namespace osu.Game.Beatmaps Connection.CreateTable(); Connection.CreateTable(); - deletePending(); + cleanupPendingDeletions(); } - public void Update(BeatmapSetInfo setInfo) => Connection.Update(setInfo); - - public void Import(IEnumerable beatmapSets) + /// + /// Add a to the database. + /// + /// The beatmap to add. + public void Add(BeatmapSetInfo beatmapSet) { - lock (Connection) - { - Connection.BeginTransaction(); - - foreach (var s in beatmapSets) - { - Connection.InsertOrReplaceWithChildren(s, true); - BeatmapSetAdded?.Invoke(s); - } - - Connection.Commit(); - } + Connection.InsertOrReplaceWithChildren(beatmapSet, true); + BeatmapSetAdded?.Invoke(beatmapSet); } - public bool Delete(BeatmapSetInfo set) + /// + /// Delete a to the database. + /// + /// The beatmap to delete. + /// Whether the beatmap's was changed. + public bool Delete(BeatmapSetInfo beatmapSet) { - if (set.DeletePending) return false; + if (beatmapSet.DeletePending) return false; - set.DeletePending = true; - Connection.Update(set); + beatmapSet.DeletePending = true; + Connection.Update(beatmapSet); - BeatmapSetRemoved?.Invoke(set); + BeatmapSetRemoved?.Invoke(beatmapSet); return true; } + /// + /// Restore a previously deleted . + /// + /// The beatmap to restore. + /// Whether the beatmap's was changed. public bool Undelete(BeatmapSetInfo set) { if (!set.DeletePending) return false; @@ -91,7 +93,7 @@ namespace osu.Game.Beatmaps return true; } - private void deletePending() + private void cleanupPendingDeletions() { foreach (var b in GetAllWithChildren(b => b.DeletePending && !b.Protected)) { @@ -119,4 +121,4 @@ namespace osu.Game.Beatmaps Connection.Query("UPDATE BeatmapSetInfo SET DeletePending = 0 WHERE DeletePending IS NULL"); } } -} \ No newline at end of file +} diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 4ee8f8a322..b1c15e87be 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -109,7 +109,7 @@ namespace osu.Game.Beatmaps //If we have an ID then we already exist in the database. if (set.ID == 0) - Database.Import(new[] { set }); + Database.Add(set); return set; } From 4e742959f23228d2badd6127e9f7d82f02dc3bfe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 00:21:57 +0900 Subject: [PATCH 079/132] CI fixes --- osu.Game/Beatmaps/BeatmapDatabase.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDatabase.cs b/osu.Game/Beatmaps/BeatmapDatabase.cs index b05ea815c6..521471e401 100644 --- a/osu.Game/Beatmaps/BeatmapDatabase.cs +++ b/osu.Game/Beatmaps/BeatmapDatabase.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using osu.Framework.Logging; using osu.Game.Database; using SQLite.Net; @@ -82,14 +81,14 @@ namespace osu.Game.Beatmaps /// /// The beatmap to restore. /// Whether the beatmap's was changed. - public bool Undelete(BeatmapSetInfo set) + public bool Undelete(BeatmapSetInfo beatmapSet) { - if (!set.DeletePending) return false; + if (!beatmapSet.DeletePending) return false; - set.DeletePending = false; - Connection.Update(set); + beatmapSet.DeletePending = false; + Connection.Update(beatmapSet); - BeatmapSetAdded?.Invoke(set); + BeatmapSetAdded?.Invoke(beatmapSet); return true; } From 690b41b1e9df449c41a63ccdb5bc55f1a2b20c09 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 12:37:37 +0900 Subject: [PATCH 080/132] Fix join rows not being deleted when a beatmap is cleaned up --- osu.Game/Beatmaps/BeatmapDatabase.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Beatmaps/BeatmapDatabase.cs b/osu.Game/Beatmaps/BeatmapDatabase.cs index 521471e401..81886293c4 100644 --- a/osu.Game/Beatmaps/BeatmapDatabase.cs +++ b/osu.Game/Beatmaps/BeatmapDatabase.cs @@ -107,6 +107,9 @@ namespace osu.Game.Beatmaps } if (b.Metadata != null) Connection.Delete(b.Metadata); + + // many-to-many join table entries are not automatically tidied. + Connection.Table().Delete(f => f.BeatmapSetInfoID == b.ID); Connection.Delete(b); } catch (Exception e) From aa81397df4d0de132693fc7b68e7f922a19b32eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 12:41:34 +0900 Subject: [PATCH 081/132] Recursively retrieve files --- osu.Game/Beatmaps/BeatmapSetInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index 6a466fb3b2..a99ba94e9a 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -37,7 +37,7 @@ namespace osu.Game.Beatmaps public string StoryboardFile => Files.FirstOrDefault(f => f.Filename.EndsWith(".osb"))?.Filename; - [ManyToMany(typeof(BeatmapSetFileInfo))] + [ManyToMany(typeof(BeatmapSetFileInfo), CascadeOperations = CascadeOperation.CascadeRead)] public List Files { get; set; } public bool Protected { get; set; } From c7a634398585332c1390022bae5b5610ccf4f7e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 12:51:21 +0900 Subject: [PATCH 082/132] Never cascade-delete rulesets --- osu.Game/Beatmaps/BeatmapInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 32d50145a6..6f4a4a8a69 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -61,7 +61,7 @@ namespace osu.Game.Beatmaps [ForeignKey(typeof(RulesetInfo))] public int RulesetID { get; set; } - [OneToOne(CascadeOperations = CascadeOperation.All)] + [OneToOne(CascadeOperations = CascadeOperation.CascadeRead)] public RulesetInfo Ruleset { get; set; } public bool LetterboxInBreaks { get; set; } From a90eff69db4d0784ab8d4ad570a6ab9429abb87f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 12:51:49 +0900 Subject: [PATCH 083/132] Simplify BeatmapSetInfo deletion by relying on cascading deletes --- osu.Game/Beatmaps/BeatmapDatabase.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDatabase.cs b/osu.Game/Beatmaps/BeatmapDatabase.cs index 81886293c4..d32bf2dd5d 100644 --- a/osu.Game/Beatmaps/BeatmapDatabase.cs +++ b/osu.Game/Beatmaps/BeatmapDatabase.cs @@ -98,19 +98,9 @@ namespace osu.Game.Beatmaps { try { - foreach (var i in b.Beatmaps) - { - if (i.Metadata != null) Connection.Delete(i.Metadata); - if (i.Difficulty != null) Connection.Delete(i.Difficulty); - - Connection.Delete(i); - } - - if (b.Metadata != null) Connection.Delete(b.Metadata); - // many-to-many join table entries are not automatically tidied. Connection.Table().Delete(f => f.BeatmapSetInfoID == b.ID); - Connection.Delete(b); + Connection.Delete(b, true); } catch (Exception e) { From 31bfa00d60de7692dfba293cc372d06bf8599088 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 12:55:14 +0900 Subject: [PATCH 084/132] Schedule API callback to own scheduler Fixes race condition when API returns a failure after exiting song select. Note that the API does also schedule to the correct thread, but this schedule ensures the callback is never run, which is what we want in this case. --- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 972d563ca5..dd5ba7b8ae 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.Select requestedBeatmap.Metrics = res; Schedule(() => updateMetrics(res)); }; - lookup.Failure += e => updateMetrics(null); + lookup.Failure += e => Schedule(() => updateMetrics(null)); api.Queue(lookup); loading.Show(); From 96b08b8777308d59a76a149d644cca18708e25c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 15:06:10 +0900 Subject: [PATCH 085/132] Simplify and document DatabaseStore API --- .../Beatmaps/IO/ImportBeatmapTest.cs | 19 +++++---- osu.Game/Beatmaps/BeatmapDatabase.cs | 2 +- osu.Game/Beatmaps/BeatmapStore.cs | 8 ++-- osu.Game/Database/DatabaseStore.cs | 41 +++++++++++++++---- osu.Game/IO/FileDatabase.cs | 2 +- osu.Game/Overlays/Music/PlaylistOverlay.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 5 ++- osu.Game/Screens/Select/SongSelect.cs | 2 +- 8 files changed, 54 insertions(+), 27 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 5c1fd381e2..a9bf7f3dad 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -115,9 +115,11 @@ namespace osu.Game.Tests.Beatmaps.IO { IEnumerable resultSets = null; + var store = osu.Dependencies.Get(); + Action waitAction = () => { - while (!(resultSets = osu.Dependencies.Get().Database. + while (!(resultSets = store.Database. Query().Where(s => s.OnlineBeatmapSetID == 241526)).Any()) Thread.Sleep(50); }; @@ -134,15 +136,16 @@ namespace osu.Game.Tests.Beatmaps.IO //if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. waitAction = () => { - while ((resultBeatmaps = osu.Dependencies.Get().Database. - GetAllWithChildren(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) + while ((resultBeatmaps = store.Database. + QueryAndPopulate(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) Thread.Sleep(50); }; Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), @"Beatmaps did not import to the database in allocated time"); - var set = osu.Dependencies.Get().Database.GetChildren(resultSets.First()); + var set = resultSets.First(); + store.Database.Populate(set); Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(), $@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count})."); @@ -152,16 +155,16 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count > 0); - var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; + var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; + beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; + beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; + beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); } } diff --git a/osu.Game/Beatmaps/BeatmapDatabase.cs b/osu.Game/Beatmaps/BeatmapDatabase.cs index d32bf2dd5d..5906e72f50 100644 --- a/osu.Game/Beatmaps/BeatmapDatabase.cs +++ b/osu.Game/Beatmaps/BeatmapDatabase.cs @@ -94,7 +94,7 @@ namespace osu.Game.Beatmaps private void cleanupPendingDeletions() { - foreach (var b in GetAllWithChildren(b => b.DeletePending && !b.Protected)) + foreach (var b in QueryAndPopulate(b => b.DeletePending && !b.Protected)) { try { diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index b1c15e87be..a5f74aad1a 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -150,9 +150,7 @@ namespace osu.Game.Beatmaps if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) return DefaultBeatmap; - beatmapInfo = Database.GetChildren(beatmapInfo, true); - - Database.GetChildren(beatmapInfo.BeatmapSet, true); + Database.Populate(beatmapInfo); if (beatmapInfo.BeatmapSet == null) throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); @@ -185,7 +183,7 @@ namespace osu.Game.Beatmaps BeatmapSetInfo set = Database.Query().FirstOrDefault(query); if (set != null) - Database.GetChildren(set, true); + Database.Populate(set); return set; } @@ -235,7 +233,7 @@ namespace osu.Game.Beatmaps if (existing != null) { - Database.GetChildren(existing); + Database.Populate(existing); Undelete(existing); return existing; } diff --git a/osu.Game/Database/DatabaseStore.cs b/osu.Game/Database/DatabaseStore.cs index 5187769bb2..8e884f062a 100644 --- a/osu.Game/Database/DatabaseStore.cs +++ b/osu.Game/Database/DatabaseStore.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Linq.Expressions; using osu.Framework.Logging; using osu.Framework.Platform; @@ -42,28 +43,50 @@ namespace osu.Game.Database /// public void Reset() => Prepare(true); - public TableQuery Query() where T : class + + public TableQuery Query(Expression> filter = null) where T : class { - return Connection.Table(); + checkType(typeof(T)); + + var query = Connection.Table(); + + if (filter != null) + query = query.Where(filter); + + return query; } /// - /// This is expensive. Use with caution. + /// Query and populate results. /// - public List GetAllWithChildren(Expression> filter = null, bool recursive = true) + /// An optional filter to refine results. + /// + public List QueryAndPopulate(Expression> filter = null) where T : class { - return Connection.GetAllWithChildren(filter, recursive); + checkType(typeof(T)); + + return Connection.GetAllWithChildren(filter, true); } - public T GetChildren(T item, bool recursive = false) + /// + /// Populate a database-backed item. + /// + /// + /// Whether population should recurse beyond a single level. + public void Populate(T item, bool recursive = true) { - if (item == null) return default(T); + checkType(item.GetType()); Connection.GetChildren(item, recursive); - return item; + } + + private void checkType(Type type) + { + if (!ValidTypes.Contains(type)) + throw new InvalidOperationException($"The requested operation specified a type of {type}, which is invalid for this {nameof(DatabaseStore)}."); } protected abstract Type[] ValidTypes { get; } } -} \ No newline at end of file +} diff --git a/osu.Game/IO/FileDatabase.cs b/osu.Game/IO/FileDatabase.cs index b61fbdb0e1..2fb43f9a57 100644 --- a/osu.Game/IO/FileDatabase.cs +++ b/osu.Game/IO/FileDatabase.cs @@ -97,7 +97,7 @@ namespace osu.Game.IO private void deletePending() { - foreach (var f in GetAllWithChildren(f => f.ReferenceCount < 1)) + foreach (var f in QueryAndPopulate(f => f.ReferenceCount < 1)) { try { diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 37ec90ad32..780e713a3f 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Music }, }; - list.BeatmapSets = BeatmapSets = beatmaps.Database.GetAllWithChildren(b => !b.DeletePending).ToList(); + list.BeatmapSets = BeatmapSets = beatmaps.Database.QueryAndPopulate(b => !b.DeletePending).ToList(); beatmaps.BeatmapSetAdded += s => list.AddBeatmapSet(s); beatmaps.BeatmapSetRemoved += s => list.RemoveBeatmapSet(s); diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 55eedaba9a..b0f067d6ee 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -76,10 +76,13 @@ namespace osu.Game.Screens.Menu if (!menuMusic) { - var query = beatmaps.Database.Query().Where(b => !b.DeletePending); + var query = beatmaps.Database.Query(b => !b.DeletePending); int count = query.Count(); if (count > 0) + { setInfo = query.ElementAt(RNG.Next(0, count - 1)); + beatmaps.Database.Populate(setInfo); + } } if (setInfo == null) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index ef1a65d914..1d87080958 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -180,7 +180,7 @@ namespace osu.Game.Screens.Select initialAddSetsTask = new CancellationTokenSource(); - carousel.Beatmaps = store.Database.GetAllWithChildren(b => !b.DeletePending); + carousel.Beatmaps = store.Database.QueryAndPopulate(b => !b.DeletePending); Beatmap.ValueChanged += beatmap_ValueChanged; From cbe7b08642f2cfed26e4fd0c4c0798c8000db767 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 15:34:13 +0900 Subject: [PATCH 086/132] Make BeatmapStore's BeatmapDatabase private --- .../Tests/TestCasePlaySongSelect.cs | 2 +- .../Tests/TestCaseResults.cs | 11 ++- .../Beatmaps/IO/ImportBeatmapTest.cs | 9 +- osu.Game/Beatmaps/BeatmapStore.cs | 88 +++++++++++++++---- osu.Game/Overlays/Music/PlaylistOverlay.cs | 3 +- osu.Game/Rulesets/Scoring/ScoreDatabase.cs | 3 +- osu.Game/Screens/Menu/Intro.cs | 10 +-- osu.Game/Screens/Select/SongSelect.cs | 2 +- 8 files changed, 85 insertions(+), 43 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index d27a7507ab..2fb720c03e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -34,7 +34,7 @@ namespace osu.Desktop.VisualTests.Tests store = new BeatmapStore(storage, null, backingDatabase, rulesets); for (int i = 0; i < 100; i += 10) - store.Database.Add(createTestBeatmapSet(i)); + store.Import(createTestBeatmapSet(i)); } Add(songSelect = new PlaySongSelect()); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index 5b9ee2198d..f0a8a8394c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; @@ -15,14 +14,14 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseResults : TestCase { - private BeatmapStore db; + private BeatmapStore beatmaps; public override string Description => @"Results after playing."; [BackgroundDependencyLoader] - private void load(BeatmapStore db) + private void load(BeatmapStore beatmaps) { - this.db = db; + this.beatmaps = beatmaps; } private WorkingBeatmap beatmap; @@ -33,9 +32,9 @@ namespace osu.Desktop.VisualTests.Tests if (beatmap == null) { - var beatmapInfo = db.Database.Query().FirstOrDefault(b => b.RulesetID == 0); + var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetID == 0); if (beatmapInfo != null) - beatmap = db.GetWorkingBeatmap(beatmapInfo); + beatmap = beatmaps.GetWorkingBeatmap(beatmapInfo); } Add(new Results(new Score diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index a9bf7f3dad..4582f5b2fb 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -119,8 +119,7 @@ namespace osu.Game.Tests.Beatmaps.IO Action waitAction = () => { - while (!(resultSets = store.Database. - Query().Where(s => s.OnlineBeatmapSetID == 241526)).Any()) + while (!(resultSets = store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526)).Any()) Thread.Sleep(50); }; @@ -136,16 +135,14 @@ namespace osu.Game.Tests.Beatmaps.IO //if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. waitAction = () => { - while ((resultBeatmaps = store.Database. - QueryAndPopulate(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) + while ((resultBeatmaps = store.QueryBeatmaps(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) Thread.Sleep(50); }; Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), @"Beatmaps did not import to the database in allocated time"); - var set = resultSets.First(); - store.Database.Populate(set); + var set = store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526).First(); Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(), $@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count})."); diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index a5f74aad1a..092846170e 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Linq.Expressions; using Ionic.Zip; using osu.Framework.Extensions; using osu.Framework.Logging; @@ -24,9 +25,6 @@ namespace osu.Game.Beatmaps /// public class BeatmapStore { - // todo: make this private - public readonly BeatmapDatabase Database; - /// /// Fired when a new becomes available in the database. /// @@ -48,14 +46,16 @@ namespace osu.Game.Beatmaps private readonly RulesetDatabase rulesets; + private readonly BeatmapDatabase beatmaps; + // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private BeatmapIPCChannel ipc; public BeatmapStore(Storage storage, FileDatabase files, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) { - Database = new BeatmapDatabase(connection); - Database.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); - Database.BeatmapSetRemoved += s => BeatmapSetRemoved?.Invoke(s); + beatmaps = new BeatmapDatabase(connection); + beatmaps.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); + beatmaps.BeatmapSetRemoved += s => BeatmapSetRemoved?.Invoke(s); this.storage = storage; this.files = files; @@ -106,14 +106,22 @@ namespace osu.Game.Beatmaps public BeatmapSetInfo Import(ArchiveReader archiveReader) { BeatmapSetInfo set = importToStorage(archiveReader); - - //If we have an ID then we already exist in the database. - if (set.ID == 0) - Database.Add(set); - + Import(set); return set; } + /// + /// Import a beatmap from a . + /// + /// The beatmap to be imported. + public void Import(BeatmapSetInfo beatmapSetInfo) + { + // If we have an ID then we already exist in the database. + if (beatmapSetInfo.ID != 0) return; + + beatmaps.Add(beatmapSetInfo); + } + /// /// Delete a beatmap from the store. /// Is a no-op for already deleted beatmaps. @@ -121,7 +129,7 @@ namespace osu.Game.Beatmaps /// The beatmap to delete. public void Delete(BeatmapSetInfo beatmapSet) { - if (!Database.Delete(beatmapSet)) return; + if (!beatmaps.Delete(beatmapSet)) return; if (!beatmapSet.Protected) files.Dereference(beatmapSet.Files); @@ -134,7 +142,7 @@ namespace osu.Game.Beatmaps /// The beatmap to restore. public void Undelete(BeatmapSetInfo beatmapSet) { - if (!Database.Undelete(beatmapSet)) return; + if (!beatmaps.Undelete(beatmapSet)) return; files.Reference(beatmapSet.Files); } @@ -150,7 +158,7 @@ namespace osu.Game.Beatmaps if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) return DefaultBeatmap; - Database.Populate(beatmapInfo); + beatmaps.Populate(beatmapInfo); if (beatmapInfo.BeatmapSet == null) throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); @@ -170,7 +178,7 @@ namespace osu.Game.Beatmaps /// public void Reset() { - Database.Reset(); + beatmaps.Reset(); } /// @@ -180,14 +188,43 @@ namespace osu.Game.Beatmaps /// The first result for the provided query, or null if no results were found. public BeatmapSetInfo QueryBeatmapSet(Func query) { - BeatmapSetInfo set = Database.Query().FirstOrDefault(query); + BeatmapSetInfo set = beatmaps.Query().FirstOrDefault(query); if (set != null) - Database.Populate(set); + beatmaps.Populate(set); return set; } + /// + /// Perform a lookup query on available s. + /// + /// The query. + /// Results from the provided query. + public List QueryBeatmapSets(Expression> query) => beatmaps.QueryAndPopulate(query); + + /// + /// Perform a lookup query on available s. + /// + /// The query. + /// The first result for the provided query, or null if no results were found. + public BeatmapInfo QueryBeatmap(Func query) + { + BeatmapInfo set = beatmaps.Query().FirstOrDefault(query); + + if (set != null) + beatmaps.Populate(set); + + return set; + } + + /// + /// Perform a lookup query on available s. + /// + /// The query. + /// Results from the provided query. + public List QueryBeatmaps(Expression> query) => beatmaps.QueryAndPopulate(query); + /// /// Creates an from a valid storage path. /// @@ -229,11 +266,11 @@ namespace osu.Game.Beatmaps var overallHash = hashable.GetMd5Hash(); - var existing = Database.Query().FirstOrDefault(b => b.Hash == overallHash); + var existing = beatmaps.Query().FirstOrDefault(b => b.Hash == overallHash); if (existing != null) { - Database.Populate(existing); + beatmaps.Populate(existing); Undelete(existing); return existing; } @@ -278,5 +315,18 @@ namespace osu.Game.Beatmaps return beatmapSet; } + + /// + /// Returns a list of all usable s. + /// + /// Whether returned objects should be pre-populated with all data. + /// A list of available . + public List GetAllUsableBeatmapSets(bool populate = true) + { + if (populate) + return beatmaps.QueryAndPopulate(b => !b.DeletePending).ToList(); + else + return beatmaps.Query(b => !b.DeletePending).ToList(); + } } } diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 780e713a3f..395456ad1b 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -77,8 +77,9 @@ namespace osu.Game.Overlays.Music }, }; - list.BeatmapSets = BeatmapSets = beatmaps.Database.QueryAndPopulate(b => !b.DeletePending).ToList(); + list.BeatmapSets = BeatmapSets = beatmaps.GetAllUsableBeatmapSets(); + // todo: these should probably be above the query. beatmaps.BeatmapSetAdded += s => list.AddBeatmapSet(s); beatmaps.BeatmapSetRemoved += s => list.RemoveBeatmapSet(s); diff --git a/osu.Game/Rulesets/Scoring/ScoreDatabase.cs b/osu.Game/Rulesets/Scoring/ScoreDatabase.cs index 84a532ec14..19dbf30b28 100644 --- a/osu.Game/Rulesets/Scoring/ScoreDatabase.cs +++ b/osu.Game/Rulesets/Scoring/ScoreDatabase.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Database; @@ -54,7 +53,7 @@ namespace osu.Game.Rulesets.Scoring var version = sr.ReadInt32(); /* score.FileChecksum = */ var beatmapHash = sr.ReadString(); - score.Beatmap = beatmaps.Database.Query().FirstOrDefault(b => b.Hash == beatmapHash); + score.Beatmap = beatmaps.QueryBeatmap(b => b.Hash == beatmapHash); /* score.PlayerName = */ sr.ReadString(); /* var localScoreChecksum = */ diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index b0f067d6ee..d05ef8af65 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -76,13 +76,9 @@ namespace osu.Game.Screens.Menu if (!menuMusic) { - var query = beatmaps.Database.Query(b => !b.DeletePending); - int count = query.Count(); - if (count > 0) - { - setInfo = query.ElementAt(RNG.Next(0, count - 1)); - beatmaps.Database.Populate(setInfo); - } + var sets = beatmaps.GetAllUsableBeatmapSets(false); + if (sets.Count > 0) + setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID); } if (setInfo == null) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 1d87080958..fb7653ed7d 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -180,7 +180,7 @@ namespace osu.Game.Screens.Select initialAddSetsTask = new CancellationTokenSource(); - carousel.Beatmaps = store.Database.QueryAndPopulate(b => !b.DeletePending); + carousel.Beatmaps = store.GetAllUsableBeatmapSets(); Beatmap.ValueChanged += beatmap_ValueChanged; From fdc6666c711ba9bc745d0d08a5c6667cbad2c986 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 15:50:34 +0900 Subject: [PATCH 087/132] Simplify hashing method Also exit the import process before importing files to the file store to avoid incorrect reference count increments. --- osu.Game/Beatmaps/BeatmapStore.cs | 51 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 092846170e..facb68e808 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -246,40 +246,39 @@ namespace osu.Game.Beatmaps /// The imported beatmap, or an existing instance if it is already present. private BeatmapSetInfo importToStorage(ArchiveReader reader) { + // for now, concatenate all .osu files in the set to create a unique hash. + MemoryStream hashable = new MemoryStream(); + foreach (string file in reader.Filenames.Where(f => f.EndsWith(".osu"))) + using (Stream s = reader.GetStream(file)) + s.CopyTo(hashable); + + var hash = hashable.GetMd5Hash(); + + // check if this beatmap has already been imported and exit early if so. + var beatmapSet = beatmaps.QueryAndPopulate().FirstOrDefault(b => b.Hash == hash); + if (beatmapSet != null) + { + Undelete(beatmapSet); + return beatmapSet; + } + + List fileInfos = new List(); + + // import files to store + foreach (string file in reader.Filenames) + using (Stream s = reader.GetStream(file)) + fileInfos.Add(files.Add(s, file)); + BeatmapMetadata metadata; using (var stream = new StreamReader(reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))))) metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; - MemoryStream hashable = new MemoryStream(); - - List fileInfos = new List(); - - foreach (string file in reader.Filenames) - { - using (Stream s = reader.GetStream(file)) - { - fileInfos.Add(files.Add(s, file)); - s.CopyTo(hashable); - } - } - - var overallHash = hashable.GetMd5Hash(); - - var existing = beatmaps.Query().FirstOrDefault(b => b.Hash == overallHash); - - if (existing != null) - { - beatmaps.Populate(existing); - Undelete(existing); - return existing; - } - - var beatmapSet = new BeatmapSetInfo + beatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = metadata.OnlineBeatmapSetID, Beatmaps = new List(), - Hash = overallHash, + Hash = hash, Files = fileInfos, Metadata = metadata }; From 5f53426a9a75b2a1390e602116957830526e48e0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 16:56:41 +0900 Subject: [PATCH 088/132] *Database -> *Store Welcome back BeatmapManager --- .../Tests/TestCaseDirect.cs | 4 +- .../Tests/TestCaseDrawableRoom.cs | 4 +- .../Tests/TestCaseGamefield.cs | 4 +- osu.Desktop.VisualTests/Tests/TestCaseMods.cs | 4 +- .../Tests/TestCasePlaySongSelect.cs | 12 +- .../Tests/TestCasePlayer.cs | 4 +- .../Tests/TestCaseResults.cs | 4 +- .../Tests/TestCaseRoomInspector.cs | 4 +- osu.Desktop/OsuGameDesktop.cs | 4 +- .../Beatmaps/IO/ImportBeatmapTest.cs | 10 +- osu.Game/Beatmaps/BeatmapDatabase.cs | 116 ------ osu.Game/Beatmaps/BeatmapManager.cs | 394 ++++++++++++++++++ osu.Game/Beatmaps/BeatmapStore.cs | 379 ++++------------- .../Beatmaps/BeatmapStoreWorkingBeatmap.cs | 72 ---- osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 4 +- ...atabaseStore.cs => DatabaseBackedStore.cs} | 6 +- osu.Game/IO/{FileDatabase.cs => FileStore.cs} | 4 +- osu.Game/IPC/BeatmapIPCChannel.cs | 4 +- osu.Game/IPC/ScoreIPCChannel.cs | 4 +- .../API/Requests/GetBeatmapSetsRequest.cs | 4 +- osu.Game/OsuGame.cs | 6 +- osu.Game/OsuGameBase.cs | 18 +- osu.Game/Overlays/Direct/FilterControl.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 4 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/Music/PlaylistOverlay.cs | 4 +- .../Settings/Sections/GameplaySection.cs | 2 +- osu.Game/Overlays/Settings/SettingsFooter.cs | 2 +- .../Overlays/Toolbar/ToolbarModeSelector.cs | 2 +- .../{RulesetDatabase.cs => RulesetStore.cs} | 6 +- .../{ScoreDatabase.cs => ScoreStore.cs} | 8 +- osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 8 +- .../Screens/Select/BeatmapDeleteDialog.cs | 8 +- osu.Game/Screens/Select/SongSelect.cs | 22 +- osu.Game/osu.Game.csproj | 13 +- 36 files changed, 570 insertions(+), 580 deletions(-) delete mode 100644 osu.Game/Beatmaps/BeatmapDatabase.cs create mode 100644 osu.Game/Beatmaps/BeatmapManager.cs delete mode 100644 osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs rename osu.Game/Database/{DatabaseStore.cs => DatabaseBackedStore.cs} (90%) rename osu.Game/IO/{FileDatabase.cs => FileStore.cs} (91%) rename osu.Game/Rulesets/{RulesetDatabase.cs => RulesetStore.cs} (90%) rename osu.Game/Rulesets/Scoring/{ScoreDatabase.cs => ScoreStore.cs} (91%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs index 0bda3c013f..4a5ff1b576 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -15,7 +15,7 @@ namespace osu.Desktop.VisualTests.Tests public override string Description => @"osu!direct overlay"; private DirectOverlay direct; - private RulesetDatabase rulesets; + private RulesetStore rulesets; protected override void LoadComplete() { @@ -29,7 +29,7 @@ namespace osu.Desktop.VisualTests.Tests } [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets) + private void load(RulesetStore rulesets) { this.rulesets = rulesets; } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 20c8156a33..38cf03d60e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -17,7 +17,7 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Select your favourite room"; - private RulesetDatabase rulesets; + private RulesetStore rulesets; protected override void LoadComplete() { @@ -125,7 +125,7 @@ namespace osu.Desktop.VisualTests.Tests } [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets) + private void load(RulesetStore rulesets) { this.rulesets = rulesets; } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index c7af7550b9..0b08065241 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -24,12 +24,12 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseGamefield : TestCase { - private RulesetDatabase rulesets; + private RulesetStore rulesets; public override string Description => @"Showing hitobjects and what not."; [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets) + private void load(RulesetStore rulesets) { this.rulesets = rulesets; } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMods.cs b/osu.Desktop.VisualTests/Tests/TestCaseMods.cs index f9dc2caa56..1604be603a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMods.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMods.cs @@ -18,11 +18,11 @@ namespace osu.Desktop.VisualTests.Tests private ModSelectOverlay modSelect; private ModDisplay modDisplay; - private RulesetDatabase rulesets; + private RulesetStore rulesets; [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets) + private void load(RulesetStore rulesets) { this.rulesets = rulesets; } diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 2fb720c03e..61e87a6621 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -14,27 +14,27 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCasePlaySongSelect : TestCase { - private readonly BeatmapStore store; + private readonly BeatmapManager manager; public override string Description => @"with fake data"; - private readonly RulesetDatabase rulesets; + private readonly RulesetStore rulesets; public TestCasePlaySongSelect() { PlaySongSelect songSelect; - if (store == null) + if (manager == null) { var storage = new TestStorage(@"TestCasePlaySongSelect"); var backingDatabase = storage.GetDatabase(@"client"); - rulesets = new RulesetDatabase(backingDatabase); - store = new BeatmapStore(storage, null, backingDatabase, rulesets); + rulesets = new RulesetStore(backingDatabase); + manager = new BeatmapManager(storage, null, backingDatabase, rulesets); for (int i = 0; i < 100; i += 10) - store.Import(createTestBeatmapSet(i)); + manager.Import(createTestBeatmapSet(i)); } Add(songSelect = new PlaySongSelect()); diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index c72c014d09..f38cabd618 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -20,12 +20,12 @@ namespace osu.Desktop.VisualTests.Tests internal class TestCasePlayer : TestCase { protected Player Player; - private RulesetDatabase rulesets; + private RulesetStore rulesets; public override string Description => @"Showing everything to play the game."; [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets) + private void load(RulesetStore rulesets) { this.rulesets = rulesets; } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index f0a8a8394c..288fff346f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -14,12 +14,12 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseResults : TestCase { - private BeatmapStore beatmaps; + private BeatmapManager beatmaps; public override string Description => @"Results after playing."; [BackgroundDependencyLoader] - private void load(BeatmapStore beatmaps) + private void load(BeatmapManager beatmaps) { this.beatmaps = beatmaps; } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index 232d7bf6e3..043f072b25 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -16,7 +16,7 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"from the multiplayer lobby"; - private RulesetDatabase rulesets; + private RulesetStore rulesets; protected override void LoadComplete() { @@ -136,7 +136,7 @@ namespace osu.Desktop.VisualTests.Tests } [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets) + private void load(RulesetStore rulesets) { this.rulesets = rulesets; } diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index ccedcc07d5..bd5c6c6790 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -65,11 +65,11 @@ namespace osu.Desktop var filePaths = dropData.Select(f => f.ToString()).ToArray(); if (filePaths.All(f => Path.GetExtension(f) == @".osz")) - Task.Run(() => BeatmapStore.Import(filePaths)); + Task.Run(() => BeatmapManager.Import(filePaths)); else if (filePaths.All(f => Path.GetExtension(f) == @".osr")) Task.Run(() => { - var score = ScoreDatabase.ReadReplayFile(filePaths.First()); + var score = ScoreStore.ReadReplayFile(filePaths.First()); Schedule(() => LoadScore(score)); }); } diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 4582f5b2fb..ecaf0db096 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -34,7 +34,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(File.Exists(temp)); - osu.Dependencies.Get().Import(temp); + osu.Dependencies.Get().Import(temp); ensureLoaded(osu); @@ -80,7 +80,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(File.Exists(temp), "Temporary file copy never substantiated"); using (File.OpenRead(temp)) - osu.Dependencies.Get().Import(temp); + osu.Dependencies.Get().Import(temp); ensureLoaded(osu); @@ -105,8 +105,8 @@ namespace osu.Game.Tests.Beatmaps.IO Thread.Sleep(1); //reset beatmap database (sqlite and storage backing) - osu.Dependencies.Get().Reset(); - osu.Dependencies.Get().Reset(); + osu.Dependencies.Get().Reset(); + osu.Dependencies.Get().Reset(); return osu; } @@ -115,7 +115,7 @@ namespace osu.Game.Tests.Beatmaps.IO { IEnumerable resultSets = null; - var store = osu.Dependencies.Get(); + var store = osu.Dependencies.Get(); Action waitAction = () => { diff --git a/osu.Game/Beatmaps/BeatmapDatabase.cs b/osu.Game/Beatmaps/BeatmapDatabase.cs deleted file mode 100644 index 5906e72f50..0000000000 --- a/osu.Game/Beatmaps/BeatmapDatabase.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using osu.Framework.Logging; -using osu.Game.Database; -using SQLite.Net; -using SQLiteNetExtensions.Extensions; - -namespace osu.Game.Beatmaps -{ - /// - /// Handles the storage and retrieval of Beatmaps/BeatmapSets to the database backing - /// - public class BeatmapDatabase : DatabaseStore - { - public event Action BeatmapSetAdded; - public event Action BeatmapSetRemoved; - - public BeatmapDatabase(SQLiteConnection connection) - : base(connection) - { - } - - protected override Type[] ValidTypes => new[] - { - typeof(BeatmapSetInfo), - typeof(BeatmapInfo), - typeof(BeatmapMetadata), - typeof(BeatmapDifficulty), - }; - - protected override void Prepare(bool reset = false) - { - if (reset) - { - Connection.DropTable(); - Connection.DropTable(); - Connection.DropTable(); - Connection.DropTable(); - Connection.DropTable(); - } - - Connection.CreateTable(); - Connection.CreateTable(); - Connection.CreateTable(); - Connection.CreateTable(); - Connection.CreateTable(); - - cleanupPendingDeletions(); - } - - /// - /// Add a to the database. - /// - /// The beatmap to add. - public void Add(BeatmapSetInfo beatmapSet) - { - Connection.InsertOrReplaceWithChildren(beatmapSet, true); - BeatmapSetAdded?.Invoke(beatmapSet); - } - - /// - /// Delete a to the database. - /// - /// The beatmap to delete. - /// Whether the beatmap's was changed. - public bool Delete(BeatmapSetInfo beatmapSet) - { - if (beatmapSet.DeletePending) return false; - - beatmapSet.DeletePending = true; - Connection.Update(beatmapSet); - - BeatmapSetRemoved?.Invoke(beatmapSet); - return true; - } - - /// - /// Restore a previously deleted . - /// - /// The beatmap to restore. - /// Whether the beatmap's was changed. - public bool Undelete(BeatmapSetInfo beatmapSet) - { - if (!beatmapSet.DeletePending) return false; - - beatmapSet.DeletePending = false; - Connection.Update(beatmapSet); - - BeatmapSetAdded?.Invoke(beatmapSet); - return true; - } - - private void cleanupPendingDeletions() - { - foreach (var b in QueryAndPopulate(b => b.DeletePending && !b.Protected)) - { - try - { - // many-to-many join table entries are not automatically tidied. - Connection.Table().Delete(f => f.BeatmapSetInfoID == b.ID); - Connection.Delete(b, true); - } - catch (Exception e) - { - Logger.Error(e, $@"Could not delete beatmap {b}"); - } - } - - //this is required because sqlite migrations don't work, initially inserting nulls into this field. - //see https://github.com/praeclarum/sqlite-net/issues/326 - Connection.Query("UPDATE BeatmapSetInfo SET DeletePending = 0 WHERE DeletePending IS NULL"); - } - } -} diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs new file mode 100644 index 0000000000..4ec8be3f36 --- /dev/null +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -0,0 +1,394 @@ +// 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.IO; +using System.Linq; +using System.Linq.Expressions; +using Ionic.Zip; +using osu.Framework.Audio.Track; +using osu.Framework.Extensions; +using osu.Framework.Graphics.Textures; +using osu.Framework.IO.Stores; +using osu.Framework.Logging; +using osu.Framework.Platform; +using osu.Game.Beatmaps.Formats; +using osu.Game.Beatmaps.IO; +using osu.Game.IO; +using osu.Game.IPC; +using osu.Game.Rulesets; +using SQLite.Net; +using FileInfo = osu.Game.IO.FileInfo; + +namespace osu.Game.Beatmaps +{ + /// + /// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps. + /// + public class BeatmapManager + { + /// + /// Fired when a new becomes available in the database. + /// + public event Action BeatmapSetAdded; + + /// + /// Fired when a is removed from the database. + /// + public event Action BeatmapSetRemoved; + + /// + /// A default representation of a WorkingBeatmap to use when no beatmap is available. + /// + public WorkingBeatmap DefaultBeatmap { private get; set; } + + private readonly Storage storage; + + private readonly FileStore files; + + private readonly RulesetStore rulesets; + + private readonly BeatmapStore beatmaps; + + // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) + private BeatmapIPCChannel ipc; + + public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, IIpcHost importHost = null) + { + beatmaps = new BeatmapStore(connection); + beatmaps.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); + beatmaps.BeatmapSetRemoved += s => BeatmapSetRemoved?.Invoke(s); + + this.storage = storage; + this.files = files; + this.rulesets = rulesets; + + if (importHost != null) + ipc = new BeatmapIPCChannel(importHost, this); + } + + /// + /// Import multiple from filesystem . + /// + /// Multiple locations on disk. + public void Import(params string[] paths) + { + foreach (string path in paths) + { + try + { + using (ArchiveReader reader = getReaderFrom(path)) + Import(reader); + + // We may or may not want to delete the file depending on where it is stored. + // e.g. reconstructing/repairing database with beatmaps from default storage. + // Also, not always a single file, i.e. for LegacyFilesystemReader + // TODO: Add a check to prevent files from storage to be deleted. + try + { + File.Delete(path); + } + catch (Exception e) + { + Logger.Error(e, $@"Could not delete file at {path}"); + } + } + catch (Exception e) + { + e = e.InnerException ?? e; + Logger.Error(e, @"Could not import beatmap set"); + } + } + } + + /// + /// Import a beatmap from an . + /// + /// The beatmap to be imported. + public BeatmapSetInfo Import(ArchiveReader archiveReader) + { + BeatmapSetInfo set = importToStorage(archiveReader); + Import(set); + return set; + } + + /// + /// Import a beatmap from a . + /// + /// The beatmap to be imported. + public void Import(BeatmapSetInfo beatmapSetInfo) + { + // If we have an ID then we already exist in the database. + if (beatmapSetInfo.ID != 0) return; + + beatmaps.Add(beatmapSetInfo); + } + + /// + /// Delete a beatmap from the manager. + /// Is a no-op for already deleted beatmaps. + /// + /// The beatmap to delete. + public void Delete(BeatmapSetInfo beatmapSet) + { + if (!beatmaps.Delete(beatmapSet)) return; + + if (!beatmapSet.Protected) + files.Dereference(beatmapSet.Files); + } + + /// + /// Returns a to a usable state if it has previously been deleted but not yet purged. + /// Is a no-op for already usable beatmaps. + /// + /// The beatmap to restore. + public void Undelete(BeatmapSetInfo beatmapSet) + { + if (!beatmaps.Undelete(beatmapSet)) return; + + files.Reference(beatmapSet.Files); + } + + /// + /// Retrieve a instance for the provided + /// + /// The beatmap to lookup. + /// The currently loaded . Allows for optimisation where elements are shared with the new beatmap. + /// A instance correlating to the provided . + public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) + { + if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) + return DefaultBeatmap; + + beatmaps.Populate(beatmapInfo); + + if (beatmapInfo.BeatmapSet == null) + throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); + + if (beatmapInfo.Metadata == null) + beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; + + WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(files.Store, beatmapInfo); + + previous?.TransferTo(working); + + return working; + } + + /// + /// Reset the manager to an empty state. + /// + public void Reset() + { + beatmaps.Reset(); + } + + /// + /// Perform a lookup query on available s. + /// + /// The query. + /// The first result for the provided query, or null if no results were found. + public BeatmapSetInfo QueryBeatmapSet(Func query) + { + BeatmapSetInfo set = beatmaps.Query().FirstOrDefault(query); + + if (set != null) + beatmaps.Populate(set); + + return set; + } + + /// + /// Perform a lookup query on available s. + /// + /// The query. + /// Results from the provided query. + public List QueryBeatmapSets(Expression> query) => beatmaps.QueryAndPopulate(query); + + /// + /// Perform a lookup query on available s. + /// + /// The query. + /// The first result for the provided query, or null if no results were found. + public BeatmapInfo QueryBeatmap(Func query) + { + BeatmapInfo set = beatmaps.Query().FirstOrDefault(query); + + if (set != null) + beatmaps.Populate(set); + + return set; + } + + /// + /// Perform a lookup query on available s. + /// + /// The query. + /// Results from the provided query. + public List QueryBeatmaps(Expression> query) => beatmaps.QueryAndPopulate(query); + + /// + /// Creates an from a valid storage path. + /// + /// A file or folder path resolving the beatmap content. + /// A reader giving access to the beatmap's content. + private ArchiveReader getReaderFrom(string path) + { + if (ZipFile.IsZipFile(path)) + return new OszArchiveReader(storage.GetStream(path)); + else + return new LegacyFilesystemReader(path); + } + + /// + /// Import a beamap into our local storage. + /// If the beatmap is already imported, the existing instance will be returned. + /// + /// The beatmap archive to be read. + /// The imported beatmap, or an existing instance if it is already present. + private BeatmapSetInfo importToStorage(ArchiveReader reader) + { + // for now, concatenate all .osu files in the set to create a unique hash. + MemoryStream hashable = new MemoryStream(); + foreach (string file in reader.Filenames.Where(f => f.EndsWith(".osu"))) + using (Stream s = reader.GetStream(file)) + s.CopyTo(hashable); + + var hash = hashable.GetMd5Hash(); + + // check if this beatmap has already been imported and exit early if so. + var beatmapSet = beatmaps.QueryAndPopulate().FirstOrDefault(b => b.Hash == hash); + if (beatmapSet != null) + { + Undelete(beatmapSet); + return beatmapSet; + } + + List fileInfos = new List(); + + // import files to manager + foreach (string file in reader.Filenames) + using (Stream s = reader.GetStream(file)) + fileInfos.Add(files.Add(s, file)); + + BeatmapMetadata metadata; + + using (var stream = new StreamReader(reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))))) + metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; + + beatmapSet = new BeatmapSetInfo + { + OnlineBeatmapSetID = metadata.OnlineBeatmapSetID, + Beatmaps = new List(), + Hash = hash, + Files = fileInfos, + Metadata = metadata + }; + + var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu")); + + foreach (var name in mapNames) + { + using (var raw = reader.GetStream(name)) + using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit + using (var sr = new StreamReader(ms)) + { + raw.CopyTo(ms); + ms.Position = 0; + + var decoder = BeatmapDecoder.GetDecoder(sr); + Beatmap beatmap = decoder.Decode(sr); + + beatmap.BeatmapInfo.Path = name; + beatmap.BeatmapInfo.Hash = ms.GetMd5Hash(); + + // TODO: Diff beatmap metadata with set metadata and leave it here if necessary + beatmap.BeatmapInfo.Metadata = null; + + // TODO: this should be done in a better place once we actually need to dynamically update it. + beatmap.BeatmapInfo.Ruleset = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID); + beatmap.BeatmapInfo.StarDifficulty = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap) + .Calculate() ?? 0; + + beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); + } + } + + return beatmapSet; + } + + /// + /// Returns a list of all usable s. + /// + /// Whether returned objects should be pre-populated with all data. + /// A list of available . + public List GetAllUsableBeatmapSets(bool populate = true) + { + if (populate) + return beatmaps.QueryAndPopulate(b => !b.DeletePending).ToList(); + else + return beatmaps.Query(b => !b.DeletePending).ToList(); + } + + protected class BeatmapManagerWorkingBeatmap : WorkingBeatmap + { + private readonly IResourceStore store; + + public BeatmapManagerWorkingBeatmap(IResourceStore store, BeatmapInfo beatmapInfo) + : base(beatmapInfo) + { + this.store = store; + } + + protected override Beatmap GetBeatmap() + { + try + { + Beatmap beatmap; + + BeatmapDecoder decoder; + using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo.Path)))) + { + decoder = BeatmapDecoder.GetDecoder(stream); + beatmap = decoder.Decode(stream); + } + + if (beatmap == null || BeatmapSetInfo.StoryboardFile == null) + return beatmap; + + using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapSetInfo.StoryboardFile)))) + decoder.Decode(stream, beatmap); + + + return beatmap; + } + catch { return null; } + } + + private string getPathForFile(string filename) => BeatmapSetInfo.Files.First(f => f.Filename == filename).StoragePath; + + protected override Texture GetBackground() + { + if (Metadata?.BackgroundFile == null) + return null; + + try + { + return new TextureStore(new RawTextureLoaderStore(store), false).Get(getPathForFile(Metadata.BackgroundFile)); + } + catch { return null; } + } + + protected override Track GetTrack() + { + try + { + var trackData = store.GetStream(getPathForFile(Metadata.AudioFile)); + return trackData == null ? null : new TrackBass(trackData); + } + catch { return new TrackVirtual(); } + } + } + } +} diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index facb68e808..4a7336535e 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -1,331 +1,116 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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.IO; -using System.Linq; -using System.Linq.Expressions; -using Ionic.Zip; -using osu.Framework.Extensions; using osu.Framework.Logging; -using osu.Framework.Platform; -using osu.Game.Beatmaps.Formats; -using osu.Game.Beatmaps.IO; -using osu.Game.IO; -using osu.Game.IPC; -using osu.Game.Rulesets; +using osu.Game.Database; using SQLite.Net; -using FileInfo = osu.Game.IO.FileInfo; +using SQLiteNetExtensions.Extensions; namespace osu.Game.Beatmaps { /// - /// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps. + /// Handles the storage and retrieval of Beatmaps/BeatmapSets to the database backing /// - public class BeatmapStore + public class BeatmapStore : DatabaseBackedStore { - /// - /// Fired when a new becomes available in the database. - /// public event Action BeatmapSetAdded; - - /// - /// Fired when a is removed from the database. - /// public event Action BeatmapSetRemoved; - /// - /// A default representation of a WorkingBeatmap to use when no beatmap is available. - /// - public WorkingBeatmap DefaultBeatmap { private get; set; } - - private readonly Storage storage; - - private readonly FileDatabase files; - - private readonly RulesetDatabase rulesets; - - private readonly BeatmapDatabase beatmaps; - - // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) - private BeatmapIPCChannel ipc; - - public BeatmapStore(Storage storage, FileDatabase files, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) + public BeatmapStore(SQLiteConnection connection) + : base(connection) { - beatmaps = new BeatmapDatabase(connection); - beatmaps.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); - beatmaps.BeatmapSetRemoved += s => BeatmapSetRemoved?.Invoke(s); + } - this.storage = storage; - this.files = files; - this.rulesets = rulesets; + protected override Type[] ValidTypes => new[] + { + typeof(BeatmapSetInfo), + typeof(BeatmapInfo), + typeof(BeatmapMetadata), + typeof(BeatmapDifficulty), + }; - if (importHost != null) - ipc = new BeatmapIPCChannel(importHost, this); + protected override void Prepare(bool reset = false) + { + if (reset) + { + Connection.DropTable(); + Connection.DropTable(); + Connection.DropTable(); + Connection.DropTable(); + Connection.DropTable(); + } + + Connection.CreateTable(); + Connection.CreateTable(); + Connection.CreateTable(); + Connection.CreateTable(); + Connection.CreateTable(); + + cleanupPendingDeletions(); } /// - /// Import multiple from filesystem . + /// Add a to the database. /// - /// Multiple locations on disk. - public void Import(params string[] paths) + /// The beatmap to add. + public void Add(BeatmapSetInfo beatmapSet) { - foreach (string path in paths) + Connection.InsertOrReplaceWithChildren(beatmapSet, true); + BeatmapSetAdded?.Invoke(beatmapSet); + } + + /// + /// Delete a to the database. + /// + /// The beatmap to delete. + /// Whether the beatmap's was changed. + public bool Delete(BeatmapSetInfo beatmapSet) + { + if (beatmapSet.DeletePending) return false; + + beatmapSet.DeletePending = true; + Connection.Update(beatmapSet); + + BeatmapSetRemoved?.Invoke(beatmapSet); + return true; + } + + /// + /// Restore a previously deleted . + /// + /// The beatmap to restore. + /// Whether the beatmap's was changed. + public bool Undelete(BeatmapSetInfo beatmapSet) + { + if (!beatmapSet.DeletePending) return false; + + beatmapSet.DeletePending = false; + Connection.Update(beatmapSet); + + BeatmapSetAdded?.Invoke(beatmapSet); + return true; + } + + private void cleanupPendingDeletions() + { + foreach (var b in QueryAndPopulate(b => b.DeletePending && !b.Protected)) { try { - using (ArchiveReader reader = getReaderFrom(path)) - Import(reader); - - // We may or may not want to delete the file depending on where it is stored. - // e.g. reconstructing/repairing database with beatmaps from default storage. - // Also, not always a single file, i.e. for LegacyFilesystemReader - // TODO: Add a check to prevent files from storage to be deleted. - try - { - File.Delete(path); - } - catch (Exception e) - { - Logger.Error(e, $@"Could not delete file at {path}"); - } + // many-to-many join table entries are not automatically tidied. + Connection.Table().Delete(f => f.BeatmapSetInfoID == b.ID); + Connection.Delete(b, true); } catch (Exception e) { - e = e.InnerException ?? e; - Logger.Error(e, @"Could not import beatmap set"); - } - } - } - - /// - /// Import a beatmap from an . - /// - /// The beatmap to be imported. - public BeatmapSetInfo Import(ArchiveReader archiveReader) - { - BeatmapSetInfo set = importToStorage(archiveReader); - Import(set); - return set; - } - - /// - /// Import a beatmap from a . - /// - /// The beatmap to be imported. - public void Import(BeatmapSetInfo beatmapSetInfo) - { - // If we have an ID then we already exist in the database. - if (beatmapSetInfo.ID != 0) return; - - beatmaps.Add(beatmapSetInfo); - } - - /// - /// Delete a beatmap from the store. - /// Is a no-op for already deleted beatmaps. - /// - /// The beatmap to delete. - public void Delete(BeatmapSetInfo beatmapSet) - { - if (!beatmaps.Delete(beatmapSet)) return; - - if (!beatmapSet.Protected) - files.Dereference(beatmapSet.Files); - } - - /// - /// Returns a to a usable state if it has previously been deleted but not yet purged. - /// Is a no-op for already usable beatmaps. - /// - /// The beatmap to restore. - public void Undelete(BeatmapSetInfo beatmapSet) - { - if (!beatmaps.Undelete(beatmapSet)) return; - - files.Reference(beatmapSet.Files); - } - - /// - /// Retrieve a instance for the provided - /// - /// The beatmap to lookup. - /// The currently loaded . Allows for optimisation where elements are shared with the new beatmap. - /// A instance correlating to the provided . - public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) - { - if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) - return DefaultBeatmap; - - beatmaps.Populate(beatmapInfo); - - if (beatmapInfo.BeatmapSet == null) - throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); - - if (beatmapInfo.Metadata == null) - beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; - - WorkingBeatmap working = new BeatmapStoreWorkingBeatmap(files.Store, beatmapInfo); - - previous?.TransferTo(working); - - return working; - } - - /// - /// Reset the store to an empty state. - /// - public void Reset() - { - beatmaps.Reset(); - } - - /// - /// Perform a lookup query on available s. - /// - /// The query. - /// The first result for the provided query, or null if no results were found. - public BeatmapSetInfo QueryBeatmapSet(Func query) - { - BeatmapSetInfo set = beatmaps.Query().FirstOrDefault(query); - - if (set != null) - beatmaps.Populate(set); - - return set; - } - - /// - /// Perform a lookup query on available s. - /// - /// The query. - /// Results from the provided query. - public List QueryBeatmapSets(Expression> query) => beatmaps.QueryAndPopulate(query); - - /// - /// Perform a lookup query on available s. - /// - /// The query. - /// The first result for the provided query, or null if no results were found. - public BeatmapInfo QueryBeatmap(Func query) - { - BeatmapInfo set = beatmaps.Query().FirstOrDefault(query); - - if (set != null) - beatmaps.Populate(set); - - return set; - } - - /// - /// Perform a lookup query on available s. - /// - /// The query. - /// Results from the provided query. - public List QueryBeatmaps(Expression> query) => beatmaps.QueryAndPopulate(query); - - /// - /// Creates an from a valid storage path. - /// - /// A file or folder path resolving the beatmap content. - /// A reader giving access to the beatmap's content. - private ArchiveReader getReaderFrom(string path) - { - if (ZipFile.IsZipFile(path)) - return new OszArchiveReader(storage.GetStream(path)); - else - return new LegacyFilesystemReader(path); - } - - /// - /// Import a beamap into our local storage. - /// If the beatmap is already imported, the existing instance will be returned. - /// - /// The beatmap archive to be read. - /// The imported beatmap, or an existing instance if it is already present. - private BeatmapSetInfo importToStorage(ArchiveReader reader) - { - // for now, concatenate all .osu files in the set to create a unique hash. - MemoryStream hashable = new MemoryStream(); - foreach (string file in reader.Filenames.Where(f => f.EndsWith(".osu"))) - using (Stream s = reader.GetStream(file)) - s.CopyTo(hashable); - - var hash = hashable.GetMd5Hash(); - - // check if this beatmap has already been imported and exit early if so. - var beatmapSet = beatmaps.QueryAndPopulate().FirstOrDefault(b => b.Hash == hash); - if (beatmapSet != null) - { - Undelete(beatmapSet); - return beatmapSet; - } - - List fileInfos = new List(); - - // import files to store - foreach (string file in reader.Filenames) - using (Stream s = reader.GetStream(file)) - fileInfos.Add(files.Add(s, file)); - - BeatmapMetadata metadata; - - using (var stream = new StreamReader(reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))))) - metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; - - beatmapSet = new BeatmapSetInfo - { - OnlineBeatmapSetID = metadata.OnlineBeatmapSetID, - Beatmaps = new List(), - Hash = hash, - Files = fileInfos, - Metadata = metadata - }; - - var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu")); - - foreach (var name in mapNames) - { - using (var raw = reader.GetStream(name)) - using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit - using (var sr = new StreamReader(ms)) - { - raw.CopyTo(ms); - ms.Position = 0; - - var decoder = BeatmapDecoder.GetDecoder(sr); - Beatmap beatmap = decoder.Decode(sr); - - beatmap.BeatmapInfo.Path = name; - beatmap.BeatmapInfo.Hash = ms.GetMd5Hash(); - - // TODO: Diff beatmap metadata with set metadata and leave it here if necessary - beatmap.BeatmapInfo.Metadata = null; - - // TODO: this should be done in a better place once we actually need to dynamically update it. - beatmap.BeatmapInfo.Ruleset = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID); - beatmap.BeatmapInfo.StarDifficulty = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap) - .Calculate() ?? 0; - - beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); + Logger.Error(e, $@"Could not delete beatmap {b}"); } } - return beatmapSet; - } - - /// - /// Returns a list of all usable s. - /// - /// Whether returned objects should be pre-populated with all data. - /// A list of available . - public List GetAllUsableBeatmapSets(bool populate = true) - { - if (populate) - return beatmaps.QueryAndPopulate(b => !b.DeletePending).ToList(); - else - return beatmaps.Query(b => !b.DeletePending).ToList(); + //this is required because sqlite migrations don't work, initially inserting nulls into this field. + //see https://github.com/praeclarum/sqlite-net/issues/326 + Connection.Query("UPDATE BeatmapSetInfo SET DeletePending = 0 WHERE DeletePending IS NULL"); } } } diff --git a/osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs deleted file mode 100644 index 3ddd7eecd6..0000000000 --- a/osu.Game/Beatmaps/BeatmapStoreWorkingBeatmap.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.IO; -using System.Linq; -using osu.Framework.Audio.Track; -using osu.Framework.Graphics.Textures; -using osu.Framework.IO.Stores; -using osu.Game.Beatmaps.Formats; - -namespace osu.Game.Beatmaps -{ - internal class BeatmapStoreWorkingBeatmap : WorkingBeatmap - { - private readonly IResourceStore store; - - public BeatmapStoreWorkingBeatmap(IResourceStore store, BeatmapInfo beatmapInfo) - : base(beatmapInfo) - { - this.store = store; - } - - protected override Beatmap GetBeatmap() - { - try - { - Beatmap beatmap; - - BeatmapDecoder decoder; - using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo.Path)))) - { - decoder = BeatmapDecoder.GetDecoder(stream); - beatmap = decoder.Decode(stream); - } - - if (beatmap == null || BeatmapSetInfo.StoryboardFile == null) - return beatmap; - - using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapSetInfo.StoryboardFile)))) - decoder.Decode(stream, beatmap); - - - return beatmap; - } - catch { return null; } - } - - private string getPathForFile(string filename) => BeatmapSetInfo.Files.First(f => f.Filename == filename).StoragePath; - - protected override Texture GetBackground() - { - if (Metadata?.BackgroundFile == null) - return null; - - try - { - return new TextureStore(new RawTextureLoaderStore(store), false).Get(getPathForFile(Metadata.BackgroundFile)); - } - catch { return null; } - } - - protected override Track GetTrack() - { - try - { - var trackData = store.GetStream(getPathForFile(Metadata.AudioFile)); - return trackData == null ? null : new TrackBass(trackData); - } - catch { return new TrackVirtual(); } - } - } -} diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index 89ba9133c1..ad9a0a787b 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -58,10 +58,10 @@ namespace osu.Game.Beatmaps.Drawables } } - public BeatmapGroup(BeatmapSetInfo beatmapSet, BeatmapStore store) + public BeatmapGroup(BeatmapSetInfo beatmapSet, BeatmapManager manager) { BeatmapSet = beatmapSet; - WorkingBeatmap beatmap = store.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault()); + WorkingBeatmap beatmap = manager.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault()); Header = new BeatmapSetHeader(beatmap) { diff --git a/osu.Game/Database/DatabaseStore.cs b/osu.Game/Database/DatabaseBackedStore.cs similarity index 90% rename from osu.Game/Database/DatabaseStore.cs rename to osu.Game/Database/DatabaseBackedStore.cs index 8e884f062a..8366775483 100644 --- a/osu.Game/Database/DatabaseStore.cs +++ b/osu.Game/Database/DatabaseBackedStore.cs @@ -12,12 +12,12 @@ using SQLiteNetExtensions.Extensions; namespace osu.Game.Database { - public abstract class DatabaseStore + public abstract class DatabaseBackedStore { protected readonly Storage Storage; protected readonly SQLiteConnection Connection; - protected DatabaseStore(SQLiteConnection connection, Storage storage = null) + protected DatabaseBackedStore(SQLiteConnection connection, Storage storage = null) { Storage = storage; Connection = connection; @@ -84,7 +84,7 @@ namespace osu.Game.Database private void checkType(Type type) { if (!ValidTypes.Contains(type)) - throw new InvalidOperationException($"The requested operation specified a type of {type}, which is invalid for this {nameof(DatabaseStore)}."); + throw new InvalidOperationException($"The requested operation specified a type of {type}, which is invalid for this {nameof(DatabaseBackedStore)}."); } protected abstract Type[] ValidTypes { get; } diff --git a/osu.Game/IO/FileDatabase.cs b/osu.Game/IO/FileStore.cs similarity index 91% rename from osu.Game/IO/FileDatabase.cs rename to osu.Game/IO/FileStore.cs index 2fb43f9a57..95d32785ec 100644 --- a/osu.Game/IO/FileDatabase.cs +++ b/osu.Game/IO/FileStore.cs @@ -17,13 +17,13 @@ namespace osu.Game.IO /// /// Handles the Store and retrieval of Files/FileSets to the database backing /// - public class FileDatabase : DatabaseStore + public class FileStore : DatabaseBackedStore { private const string prefix = "files"; public readonly ResourceStore Store; - public FileDatabase(SQLiteConnection connection, Storage storage) : base(connection, storage) + public FileStore(SQLiteConnection connection, Storage storage) : base(connection, storage) { Store = new NamespacedResourceStore(new StorageBackedResourceStore(storage), prefix); } diff --git a/osu.Game/IPC/BeatmapIPCChannel.cs b/osu.Game/IPC/BeatmapIPCChannel.cs index f42e750a6f..6a9019251c 100644 --- a/osu.Game/IPC/BeatmapIPCChannel.cs +++ b/osu.Game/IPC/BeatmapIPCChannel.cs @@ -10,9 +10,9 @@ namespace osu.Game.IPC { public class BeatmapIPCChannel : IpcChannel { - private readonly BeatmapStore beatmaps; + private readonly BeatmapManager beatmaps; - public BeatmapIPCChannel(IIpcHost host, BeatmapStore beatmaps = null) + public BeatmapIPCChannel(IIpcHost host, BeatmapManager beatmaps = null) : base(host) { this.beatmaps = beatmaps; diff --git a/osu.Game/IPC/ScoreIPCChannel.cs b/osu.Game/IPC/ScoreIPCChannel.cs index cfc74c4824..ae44250e8d 100644 --- a/osu.Game/IPC/ScoreIPCChannel.cs +++ b/osu.Game/IPC/ScoreIPCChannel.cs @@ -10,9 +10,9 @@ namespace osu.Game.IPC { public class ScoreIPCChannel : IpcChannel { - private readonly ScoreDatabase scores; + private readonly ScoreStore scores; - public ScoreIPCChannel(IIpcHost host, ScoreDatabase scores = null) + public ScoreIPCChannel(IIpcHost host, ScoreStore scores = null) : base(host) { this.scores = scores; diff --git a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs index 3b7711677e..ca984d3511 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs @@ -49,7 +49,7 @@ namespace osu.Game.Online.API.Requests [JsonProperty(@"beatmaps")] private IEnumerable beatmaps { get; set; } - public BeatmapSetInfo ToBeatmapSet(RulesetDatabase rulesets) + public BeatmapSetInfo ToBeatmapSet(RulesetStore rulesets) { return new BeatmapSetInfo { @@ -79,7 +79,7 @@ namespace osu.Game.Online.API.Requests [JsonProperty(@"difficulty_rating")] private double starDifficulty { get; set; } - public BeatmapInfo ToBeatmap(RulesetDatabase rulesets) + public BeatmapInfo ToBeatmap(RulesetStore rulesets) { return new BeatmapInfo { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 44af591cc8..4f4c2e2883 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -99,13 +99,13 @@ namespace osu.Game if (args?.Length > 0) { var paths = args.Where(a => !a.StartsWith(@"-")); - Task.Run(() => BeatmapStore.Import(paths.ToArray())); + Task.Run(() => BeatmapManager.Import(paths.ToArray())); } dependencies.Cache(this); configRuleset = LocalConfig.GetBindable(OsuSetting.Ruleset); - Ruleset.Value = RulesetDatabase.GetRuleset(configRuleset.Value); + Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value); Ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0; } @@ -140,7 +140,7 @@ namespace osu.Game return; } - Beatmap.Value = BeatmapStore.GetWorkingBeatmap(s.Beatmap); + Beatmap.Value = BeatmapManager.GetWorkingBeatmap(s.Beatmap); menu.Push(new PlayerLoader(new ReplayPlayer(s.Replay))); } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 8ad07cd7bc..b507aa2315 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -28,13 +28,13 @@ namespace osu.Game { protected OsuConfigManager LocalConfig; - protected BeatmapStore BeatmapStore; + protected BeatmapManager BeatmapManager; - protected RulesetDatabase RulesetDatabase; + protected RulesetStore RulesetStore; - protected FileDatabase FileDatabase; + protected FileStore FileStore; - protected ScoreDatabase ScoreDatabase; + protected ScoreStore ScoreStore; protected override string MainResourceFile => @"osu.Game.Resources.dll"; @@ -97,10 +97,10 @@ namespace osu.Game SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); - dependencies.Cache(RulesetDatabase = new RulesetDatabase(connection)); - dependencies.Cache(FileDatabase = new FileDatabase(connection, Host.Storage)); - dependencies.Cache(BeatmapStore = new BeatmapStore(Host.Storage, FileDatabase, connection, RulesetDatabase, Host)); - dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapStore)); + dependencies.Cache(RulesetStore = new RulesetStore(connection)); + dependencies.Cache(FileStore = new FileStore(connection, Host.Storage)); + dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host)); + dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, connection, Host, BeatmapManager)); dependencies.Cache(new OsuColour()); //this completely overrides the framework default. will need to change once we make a proper FontStore. @@ -132,7 +132,7 @@ namespace osu.Game var defaultBeatmap = new DummyWorkingBeatmap(this); Beatmap = new NonNullableBindable(defaultBeatmap); - BeatmapStore.DefaultBeatmap = defaultBeatmap; + BeatmapManager.DefaultBeatmap = defaultBeatmap; dependencies.Cache(API = new APIAccess { diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 24a878da1d..4f815f220c 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Direct } [BackgroundDependencyLoader(true)] - private void load(OsuGame game, RulesetDatabase rulesets, OsuColour colours) + private void load(OsuGame game, RulesetStore rulesets, OsuColour colours) { DisplayStyleControl.Dropdown.AccentColour = colours.BlueDark; diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 3724c3e191..b1c7dab778 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays private const float panel_padding = 10f; private APIAccess api; - private RulesetDatabase rulesets; + private RulesetStore rulesets; private readonly FillFlowContainer resultCountsContainer; private readonly OsuSpriteText resultCountsText; @@ -161,7 +161,7 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(OsuColour colours, APIAccess api, RulesetDatabase rulesets) + private void load(OsuColour colours, APIAccess api, RulesetStore rulesets) { this.api = api; this.rulesets = rulesets; diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 6324b9ac3d..eb643f390f 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Mods } [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours, OsuGame osu, RulesetDatabase rulesets) + private void load(OsuColour colours, OsuGame osu, RulesetStore rulesets) { lowMultiplierColour = colours.Red; highMultiplierColour = colours.Green; diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 395456ad1b..31fe755d2b 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Music private FilterControl filter; private PlaylistList list; - private BeatmapStore beatmaps; + private BeatmapManager beatmaps; private readonly Bindable beatmapBacking = new Bindable(); @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Music private InputManager inputManager; [BackgroundDependencyLoader] - private void load(OsuGameBase game, BeatmapStore beatmaps, OsuColour colours, UserInputManager inputManager) + private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours, UserInputManager inputManager) { this.inputManager = inputManager; this.beatmaps = beatmaps; diff --git a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs index 32cc0fcca5..326cb582e2 100644 --- a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs +++ b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Settings.Sections } [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets) + private void load(RulesetStore rulesets) { foreach(Ruleset ruleset in rulesets.AllRulesets.Select(info => info.CreateInstance())) { diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index f5f7fe0ace..6c25b146a1 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Settings public class SettingsFooter : FillFlowContainer { [BackgroundDependencyLoader] - private void load(OsuGameBase game, OsuColour colours, RulesetDatabase rulesets) + private void load(OsuGameBase game, OsuColour colours, RulesetStore rulesets) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index f6d7a05f61..60c1261190 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -65,7 +65,7 @@ namespace osu.Game.Overlays.Toolbar } [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets, OsuGame game) + private void load(RulesetStore rulesets, OsuGame game) { foreach (var r in rulesets.AllRulesets) { diff --git a/osu.Game/Rulesets/RulesetDatabase.cs b/osu.Game/Rulesets/RulesetStore.cs similarity index 90% rename from osu.Game/Rulesets/RulesetDatabase.cs rename to osu.Game/Rulesets/RulesetStore.cs index be2ba19c0c..88aee2bffc 100644 --- a/osu.Game/Rulesets/RulesetDatabase.cs +++ b/osu.Game/Rulesets/RulesetStore.cs @@ -12,13 +12,13 @@ using SQLite.Net; namespace osu.Game.Rulesets { /// - /// Todo: All of this needs to be moved to a RulesetDatabase. + /// Todo: All of this needs to be moved to a RulesetStore. /// - public class RulesetDatabase : DatabaseStore + public class RulesetStore : DatabaseBackedStore { public IEnumerable AllRulesets => Query().Where(r => r.Available); - public RulesetDatabase(SQLiteConnection connection) : base(connection) + public RulesetStore(SQLiteConnection connection) : base(connection) { } diff --git a/osu.Game/Rulesets/Scoring/ScoreDatabase.cs b/osu.Game/Rulesets/Scoring/ScoreStore.cs similarity index 91% rename from osu.Game/Rulesets/Scoring/ScoreDatabase.cs rename to osu.Game/Rulesets/Scoring/ScoreStore.cs index 19dbf30b28..e69fec4b54 100644 --- a/osu.Game/Rulesets/Scoring/ScoreDatabase.cs +++ b/osu.Game/Rulesets/Scoring/ScoreStore.cs @@ -15,19 +15,19 @@ using SQLite.Net; namespace osu.Game.Rulesets.Scoring { - public class ScoreDatabase : DatabaseStore + public class ScoreStore : DatabaseBackedStore { private readonly Storage storage; - private readonly BeatmapStore beatmaps; - private readonly RulesetDatabase rulesets; + private readonly BeatmapManager beatmaps; + private readonly RulesetStore rulesets; private const string replay_folder = @"replays"; // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private ScoreIPCChannel ipc; - public ScoreDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapStore beatmaps = null, RulesetDatabase rulesets = null) : base(connection) + public ScoreStore(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(connection) { this.storage = storage; this.beatmaps = beatmaps; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index d05ef8af65..a0cf6eec66 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Menu private Track track; [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuConfigManager config, BeatmapStore beatmaps, Framework.Game game) + private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game) { menuVoice = config.GetBindable(OsuSetting.MenuVoice); menuMusic = config.GetBindable(OsuSetting.MenuMusic); diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 736ed0c1d8..743a0a0f63 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Select /// /// Required for now unfortunately. /// - private BeatmapStore store; + private BeatmapManager manager; private readonly Container scrollableContent; @@ -289,7 +289,7 @@ namespace osu.Game.Screens.Select b.Metadata = beatmapSet.Metadata; } - return new BeatmapGroup(beatmapSet, store) + return new BeatmapGroup(beatmapSet, manager) { SelectionChanged = (g, p) => selectGroup(g, p), StartRequested = b => StartRequested?.Invoke(), @@ -298,9 +298,9 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapStore store, OsuConfigManager config) + private void load(BeatmapManager manager, OsuConfigManager config) { - this.store = store; + this.manager = manager; randomType = config.GetBindable(OsuSetting.SelectionRandomType); } diff --git a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs index a605691ec5..96caf2f236 100644 --- a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs +++ b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs @@ -11,12 +11,12 @@ namespace osu.Game.Screens.Select { public class BeatmapDeleteDialog : PopupDialog { - private BeatmapStore store; + private BeatmapManager manager; [BackgroundDependencyLoader] - private void load(BeatmapStore beatmapStore) + private void load(BeatmapManager beatmapManager) { - store = beatmapStore; + manager = beatmapManager; } public BeatmapDeleteDialog(WorkingBeatmap beatmap) @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Select Action = () => { beatmap.Dispose(); - store.Delete(beatmap.BeatmapSetInfo); + manager.Delete(beatmap.BeatmapSetInfo); }, }, new PopupDialogCancelButton diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index fb7653ed7d..bbd292870e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select public abstract class SongSelect : OsuScreen { private readonly Bindable ruleset = new Bindable(); - private BeatmapStore store; + private BeatmapManager manager; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(); private readonly BeatmapCarousel carousel; @@ -154,7 +154,7 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapStore beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, UserInputManager input) + private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, UserInputManager input) { if (Footer != null) { @@ -164,14 +164,14 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue); } - if (store == null) - store = beatmaps; + if (manager == null) + manager = beatmaps; if (osu != null) ruleset.BindTo(osu.Ruleset); - store.BeatmapSetAdded += onBeatmapSetAdded; - store.BeatmapSetRemoved += onBeatmapSetRemoved; + manager.BeatmapSetAdded += onBeatmapSetAdded; + manager.BeatmapSetRemoved += onBeatmapSetRemoved; dialogOverlay = dialog; @@ -180,7 +180,7 @@ namespace osu.Game.Screens.Select initialAddSetsTask = new CancellationTokenSource(); - carousel.Beatmaps = store.GetAllUsableBeatmapSets(); + carousel.Beatmaps = manager.GetAllUsableBeatmapSets(); Beatmap.ValueChanged += beatmap_ValueChanged; @@ -230,7 +230,7 @@ namespace osu.Game.Screens.Select { bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID; - Beatmap.Value = store.GetWorkingBeatmap(beatmap, Beatmap); + Beatmap.Value = manager.GetWorkingBeatmap(beatmap, Beatmap); ensurePlayingSelected(preview); } @@ -341,10 +341,10 @@ namespace osu.Game.Screens.Select { base.Dispose(isDisposing); - if (store != null) + if (manager != null) { - store.BeatmapSetAdded -= onBeatmapSetAdded; - store.BeatmapSetRemoved -= onBeatmapSetRemoved; + manager.BeatmapSetAdded -= onBeatmapSetAdded; + manager.BeatmapSetRemoved -= onBeatmapSetRemoved; } initialAddSetsTask?.Cancel(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 13c4056bba..f8509314be 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -74,7 +74,7 @@ - + @@ -91,7 +91,7 @@ - + @@ -131,9 +131,9 @@ - + - + @@ -220,7 +220,7 @@ - + @@ -389,7 +389,7 @@ - + @@ -399,7 +399,6 @@ - From 996e5e8b4ae252a22b23e3b94ccde99fc0866ad2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 17:38:40 +0900 Subject: [PATCH 089/132] Use SHA2 for hashing --- osu-framework | 2 +- osu.Game/Beatmaps/BeatmapManager.cs | 4 ++-- osu.Game/IO/FileStore.cs | 2 +- osu.sln.DotSettings | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osu-framework b/osu-framework index 05a8b26376..5a9ca94fc3 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 05a8b2637623bd8ac6c1619b728ea9b4cca35b8a +Subproject commit 5a9ca94fc31bc796b45572eb3d0b27b46556c586 diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 4ec8be3f36..99117afe35 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -255,7 +255,7 @@ namespace osu.Game.Beatmaps using (Stream s = reader.GetStream(file)) s.CopyTo(hashable); - var hash = hashable.GetMd5Hash(); + var hash = hashable.ComputeSHA2Hash(); // check if this beatmap has already been imported and exit early if so. var beatmapSet = beatmaps.QueryAndPopulate().FirstOrDefault(b => b.Hash == hash); @@ -301,7 +301,7 @@ namespace osu.Game.Beatmaps Beatmap beatmap = decoder.Decode(sr); beatmap.BeatmapInfo.Path = name; - beatmap.BeatmapInfo.Hash = ms.GetMd5Hash(); + beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash(); // TODO: Diff beatmap metadata with set metadata and leave it here if necessary beatmap.BeatmapInfo.Metadata = null; diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index 95d32785ec..e3728ab16d 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -44,7 +44,7 @@ namespace osu.Game.IO public FileInfo Add(Stream data, string filename = null) { - string hash = data.GetMd5Hash(); + string hash = data.GetSHA2Hash(); var info = new FileInfo { diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index f6a6e4bf9b..e3eae96ca8 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -189,7 +189,9 @@ IP IPC LTRB + MD5 RNG + SHA SRGB TK SS From b64fe68233da2bfec7a2da925d74e61ab03185b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 18:03:24 +0900 Subject: [PATCH 090/132] Allow OsuColour.FromHex to support prefix #. Coincides with https://github.com/ppy/osu-web/pull/1373 --- osu.Game/Graphics/OsuColour.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index d2f4d4768c..70017d3c6e 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -13,6 +13,9 @@ namespace osu.Game.Graphics public static Color4 FromHex(string hex) { + if (hex[0] == '#') + hex = hex.Substring(1); + switch (hex.Length) { default: From 3a6f3cdd8afbe7de2195dcbac2041ed443b8d849 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 20:38:35 +0900 Subject: [PATCH 091/132] Add the ability to create migrations on a per-store level Now stores store versions to the database itself. --- osu.Game/Beatmaps/BeatmapStore.cs | 33 ++++++++++++++++++++++++ osu.Game/Database/DatabaseBackedStore.cs | 24 +++++++++++++++++ osu.Game/Database/StoreVersion.cs | 15 +++++++++++ osu.Game/OsuGameBase.cs | 3 +++ osu.Game/osu.Game.csproj | 1 + 5 files changed, 76 insertions(+) create mode 100644 osu.Game/Database/StoreVersion.cs diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 4a7336535e..f9019537a0 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -17,6 +17,12 @@ namespace osu.Game.Beatmaps public event Action BeatmapSetAdded; public event Action BeatmapSetRemoved; + /// + /// The current version of this store. Used for migrations (see ). + /// The initial version is 1. + /// + protected override int StoreVersion => 1; + public BeatmapStore(SQLiteConnection connection) : base(connection) { @@ -50,6 +56,33 @@ namespace osu.Game.Beatmaps cleanupPendingDeletions(); } + /// + /// Perform migrations between two store versions. + /// + /// The current store version. This will be zero on a fresh database initialisation. + /// The target version which we are migrating to (equal to the current ). + protected override void PerformMigration(int currentVersion, int newVersion) + { + base.PerformMigration(currentVersion, newVersion); + + while (currentVersion++ < newVersion) + { + switch (currentVersion) + { + case 1: + // initialising from a version before we had versioning (or a fresh install). + + // force adding of Protected column (not automatically migrated). + Connection.MigrateTable(); + + // remove all existing beatmaps. + foreach (var b in Connection.GetAllWithChildren(null, true)) + Connection.Delete(b, true); + break; + } + } + } + /// /// Add a to the database. /// diff --git a/osu.Game/Database/DatabaseBackedStore.cs b/osu.Game/Database/DatabaseBackedStore.cs index 8366775483..bb61fc1870 100644 --- a/osu.Game/Database/DatabaseBackedStore.cs +++ b/osu.Game/Database/DatabaseBackedStore.cs @@ -17,6 +17,8 @@ namespace osu.Game.Database protected readonly Storage Storage; protected readonly SQLiteConnection Connection; + protected virtual int StoreVersion => 1; + protected DatabaseBackedStore(SQLiteConnection connection, Storage storage = null) { Storage = storage; @@ -31,6 +33,28 @@ namespace osu.Game.Database Logger.Error(e, $@"Failed to initialise the {GetType()}! Trying again with a clean database..."); Prepare(true); } + + checkMigrations(); + } + + private void checkMigrations() + { + var storeName = GetType().Name; + + var reportedVersion = Connection.Table().FirstOrDefault(s => s.StoreName == storeName) ?? new StoreVersion + { + StoreName = storeName, + Version = 0 + }; + + if (reportedVersion.Version != StoreVersion) + PerformMigration(reportedVersion.Version, reportedVersion.Version = StoreVersion); + + Connection.InsertOrReplace(reportedVersion); + } + + protected virtual void PerformMigration(int currentVersion, int newVersion) + { } /// diff --git a/osu.Game/Database/StoreVersion.cs b/osu.Game/Database/StoreVersion.cs new file mode 100644 index 0000000000..00314875a6 --- /dev/null +++ b/osu.Game/Database/StoreVersion.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using SQLite.Net.Attributes; + +namespace osu.Game.Database +{ + public class StoreVersion + { + [PrimaryKey] + public string StoreName { get; set; } + + public int Version { get; set; } + } +} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index b507aa2315..0dec4228de 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -18,6 +18,7 @@ using osu.Game.Graphics.Processing; using osu.Game.Online.API; using SQLite.Net; using osu.Framework.Graphics.Performance; +using osu.Game.Database; using osu.Game.IO; using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; @@ -97,6 +98,8 @@ namespace osu.Game SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); + connection.CreateTable(); + dependencies.Cache(RulesetStore = new RulesetStore(connection)); dependencies.Cache(FileStore = new FileStore(connection, Host.Storage)); dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host)); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f8509314be..5ac76ed00e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -80,6 +80,7 @@ + From cd22ff11e9c75cafa9f7f9d79dd0b1a16458b314 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 20:50:26 +0900 Subject: [PATCH 092/132] Fix VisualTests --- osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 61e87a6621..51c78ff442 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -6,6 +6,7 @@ using osu.Desktop.VisualTests.Platform; using osu.Framework.Testing; using osu.Framework.MathUtils; using osu.Game.Beatmaps; +using osu.Game.Database; using osu.Game.Rulesets; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; @@ -29,6 +30,7 @@ namespace osu.Desktop.VisualTests.Tests var storage = new TestStorage(@"TestCasePlaySongSelect"); var backingDatabase = storage.GetDatabase(@"client"); + backingDatabase.CreateTable(); rulesets = new RulesetStore(backingDatabase); manager = new BeatmapManager(storage, null, backingDatabase, rulesets); From eb4880cdd51418d0004a832cf657191bd0127900 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 27 Jul 2017 16:33:10 +0300 Subject: [PATCH 093/132] Applied suggestions --- osu.Game/Overlays/ChatOverlay.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index f29565a03d..7107d2568e 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -192,13 +192,13 @@ namespace osu.Game.Overlays } private double startDragChatHeight; - private bool canBeResized; + private bool isDragging; protected override bool OnDragStart(InputState state) { - canBeResized = tabsArea.IsHovered; + isDragging = tabsArea.IsHovered; - if (!channelTabs.IsHovered) + if (!isDragging) return base.OnDragStart(state); startDragChatHeight = chatHeight.Value; @@ -207,7 +207,7 @@ namespace osu.Game.Overlays protected override bool OnDrag(InputState state) { - if (canBeResized) + if (isDragging) { Trace.Assert(state.Mouse.PositionMouseDown != null); @@ -220,7 +220,7 @@ namespace osu.Game.Overlays protected override bool OnDragEnd(InputState state) { - canBeResized = false; + isDragging = false; return base.OnDragEnd(state); } From 3263aa2ca7f0abb262a037d1df81008cd7fe7857 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 27 Jul 2017 17:02:23 +0300 Subject: [PATCH 094/132] Always return true while dragging --- osu.Game/Overlays/ChatOverlay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 7107d2568e..29b7548ada 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -212,7 +212,6 @@ namespace osu.Game.Overlays Trace.Assert(state.Mouse.PositionMouseDown != null); chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; - return base.OnDrag(state); } return true; From 6a36fa78097be3794956f5a8218e52563aa5c7aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 12:50:04 +0900 Subject: [PATCH 095/132] Make OsuButtons visually disable when not enabled --- osu.Game/Graphics/UserInterface/OsuButton.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index ecbf51f8b9..3c454f2af2 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -68,6 +68,14 @@ namespace osu.Game.Graphics.UserInterface sampleClick = audio.Sample.Get(@"UI/generic-click"); sampleHover = audio.Sample.Get(@"UI/generic-hover"); + + Enabled.ValueChanged += enabled_ValueChanged; + Enabled.TriggerChange(); + } + + private void enabled_ValueChanged(bool enabled) + { + this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); } protected override bool OnClick(InputState state) From 9ee59dd63703a7549d651f7b189a24c6fafef5f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 20:38:35 +0900 Subject: [PATCH 096/132] Add the ability to create migrations on a per-store level Now stores store versions to the database itself. --- osu.Game/Beatmaps/BeatmapStore.cs | 33 ++++++++++++++++++++++++ osu.Game/Database/DatabaseBackedStore.cs | 24 +++++++++++++++++ osu.Game/Database/StoreVersion.cs | 15 +++++++++++ osu.Game/OsuGameBase.cs | 3 +++ osu.Game/osu.Game.csproj | 1 + 5 files changed, 76 insertions(+) create mode 100644 osu.Game/Database/StoreVersion.cs diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 4a7336535e..f9019537a0 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -17,6 +17,12 @@ namespace osu.Game.Beatmaps public event Action BeatmapSetAdded; public event Action BeatmapSetRemoved; + /// + /// The current version of this store. Used for migrations (see ). + /// The initial version is 1. + /// + protected override int StoreVersion => 1; + public BeatmapStore(SQLiteConnection connection) : base(connection) { @@ -50,6 +56,33 @@ namespace osu.Game.Beatmaps cleanupPendingDeletions(); } + /// + /// Perform migrations between two store versions. + /// + /// The current store version. This will be zero on a fresh database initialisation. + /// The target version which we are migrating to (equal to the current ). + protected override void PerformMigration(int currentVersion, int newVersion) + { + base.PerformMigration(currentVersion, newVersion); + + while (currentVersion++ < newVersion) + { + switch (currentVersion) + { + case 1: + // initialising from a version before we had versioning (or a fresh install). + + // force adding of Protected column (not automatically migrated). + Connection.MigrateTable(); + + // remove all existing beatmaps. + foreach (var b in Connection.GetAllWithChildren(null, true)) + Connection.Delete(b, true); + break; + } + } + } + /// /// Add a to the database. /// diff --git a/osu.Game/Database/DatabaseBackedStore.cs b/osu.Game/Database/DatabaseBackedStore.cs index 8366775483..bb61fc1870 100644 --- a/osu.Game/Database/DatabaseBackedStore.cs +++ b/osu.Game/Database/DatabaseBackedStore.cs @@ -17,6 +17,8 @@ namespace osu.Game.Database protected readonly Storage Storage; protected readonly SQLiteConnection Connection; + protected virtual int StoreVersion => 1; + protected DatabaseBackedStore(SQLiteConnection connection, Storage storage = null) { Storage = storage; @@ -31,6 +33,28 @@ namespace osu.Game.Database Logger.Error(e, $@"Failed to initialise the {GetType()}! Trying again with a clean database..."); Prepare(true); } + + checkMigrations(); + } + + private void checkMigrations() + { + var storeName = GetType().Name; + + var reportedVersion = Connection.Table().FirstOrDefault(s => s.StoreName == storeName) ?? new StoreVersion + { + StoreName = storeName, + Version = 0 + }; + + if (reportedVersion.Version != StoreVersion) + PerformMigration(reportedVersion.Version, reportedVersion.Version = StoreVersion); + + Connection.InsertOrReplace(reportedVersion); + } + + protected virtual void PerformMigration(int currentVersion, int newVersion) + { } /// diff --git a/osu.Game/Database/StoreVersion.cs b/osu.Game/Database/StoreVersion.cs new file mode 100644 index 0000000000..00314875a6 --- /dev/null +++ b/osu.Game/Database/StoreVersion.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using SQLite.Net.Attributes; + +namespace osu.Game.Database +{ + public class StoreVersion + { + [PrimaryKey] + public string StoreName { get; set; } + + public int Version { get; set; } + } +} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index b507aa2315..0dec4228de 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -18,6 +18,7 @@ using osu.Game.Graphics.Processing; using osu.Game.Online.API; using SQLite.Net; using osu.Framework.Graphics.Performance; +using osu.Game.Database; using osu.Game.IO; using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; @@ -97,6 +98,8 @@ namespace osu.Game SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); + connection.CreateTable(); + dependencies.Cache(RulesetStore = new RulesetStore(connection)); dependencies.Cache(FileStore = new FileStore(connection, Host.Storage)); dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host)); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f8509314be..5ac76ed00e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -80,6 +80,7 @@ + From e5306997dd816c4dbb7fff6fb2fa42bf1586d97d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 20:50:26 +0900 Subject: [PATCH 097/132] Fix VisualTests --- osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 61e87a6621..51c78ff442 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -6,6 +6,7 @@ using osu.Desktop.VisualTests.Platform; using osu.Framework.Testing; using osu.Framework.MathUtils; using osu.Game.Beatmaps; +using osu.Game.Database; using osu.Game.Rulesets; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; @@ -29,6 +30,7 @@ namespace osu.Desktop.VisualTests.Tests var storage = new TestStorage(@"TestCasePlaySongSelect"); var backingDatabase = storage.GetDatabase(@"client"); + backingDatabase.CreateTable(); rulesets = new RulesetStore(backingDatabase); manager = new BeatmapManager(storage, null, backingDatabase, rulesets); From 7d4218ea6c9c90142b7ac22c418259cac5810658 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 12:46:38 +0900 Subject: [PATCH 098/132] Add option to import from osu-stable Also adds an option to delete all beatmaps for testing purposes. --- osu.Game/Beatmaps/BeatmapManager.cs | 16 ++++++ .../Sections/Maintenance/GeneralSettings.cs | 51 +++++++++++++++++++ .../Settings/Sections/MaintenanceSection.cs | 2 + osu.Game/osu.Game.csproj | 1 + 4 files changed, 70 insertions(+) create mode 100644 osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 99117afe35..97031547c0 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -390,5 +390,21 @@ namespace osu.Game.Beatmaps catch { return new TrackVirtual(); } } } + + public void ImportFromStable() + { + + string stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!", "Songs"); + if (!Directory.Exists(stableInstallPath)) + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu", "Songs"); + + if (!Directory.Exists(stableInstallPath)) + { + Logger.Log("Couldn't find an osu!stable installation!", LoggingTarget.Information, LogLevel.Error); + return; + } + + Import(Directory.GetDirectories(stableInstallPath)); + } } } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs new file mode 100644 index 0000000000..684bfcb39d --- /dev/null +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Threading.Tasks; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Settings.Sections.Maintenance +{ + public class GeneralSettings : SettingsSubsection + { + private OsuButton importButton; + private OsuButton deleteButton; + + protected override string Header => "General"; + + [BackgroundDependencyLoader] + private void load(BeatmapManager beatmaps) + { + Children = new Drawable[] + { + importButton = new OsuButton + { + RelativeSizeAxes = Axes.X, + Text = "Import beatmaps from stable", + Action = () => + { + importButton.Enabled.Value = false; + Task.Run(() => beatmaps.ImportFromStable()).ContinueWith(t => Schedule(() => importButton.Enabled.Value = true)); + } + }, + deleteButton = new OsuButton + { + RelativeSizeAxes = Axes.X, + Text = "Delete ALL beatmaps", + Action = () => + { + deleteButton.Enabled.Value = false; + Task.Run(() => + { + foreach (var b in beatmaps.GetAllUsableBeatmapSets()) + beatmaps.Delete(b); + }).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true)); + } + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs index 529cec79c1..b42c64d324 100644 --- a/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs @@ -3,6 +3,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics; +using osu.Game.Overlays.Settings.Sections.Maintenance; using OpenTK; namespace osu.Game.Overlays.Settings.Sections @@ -17,6 +18,7 @@ namespace osu.Game.Overlays.Settings.Sections FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { + new GeneralSettings() }; } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5ac76ed00e..b3ed0d2b28 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -104,6 +104,7 @@ + From d51ce896f94db37c8cd050bc8624907373c5d600 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 12:46:54 +0900 Subject: [PATCH 099/132] Add locking to all BeatmapManager operations --- osu.Game/Beatmaps/BeatmapManager.cs | 60 ++++++++++++++++++----------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 97031547c0..e62fd2fc5d 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -108,9 +108,13 @@ namespace osu.Game.Beatmaps /// The beatmap to be imported. public BeatmapSetInfo Import(ArchiveReader archiveReader) { - BeatmapSetInfo set = importToStorage(archiveReader); - Import(set); - return set; + // let's only allow one concurrent import at a time for now. + lock (this) + { + BeatmapSetInfo set = importToStorage(archiveReader); + Import(set); + return set; + } } /// @@ -132,10 +136,13 @@ namespace osu.Game.Beatmaps /// The beatmap to delete. public void Delete(BeatmapSetInfo beatmapSet) { - if (!beatmaps.Delete(beatmapSet)) return; + lock (this) + { + if (!beatmaps.Delete(beatmapSet)) return; - if (!beatmapSet.Protected) - files.Dereference(beatmapSet.Files); + if (!beatmapSet.Protected) + files.Dereference(beatmapSet.Files); + } } /// @@ -145,9 +152,12 @@ namespace osu.Game.Beatmaps /// The beatmap to restore. public void Undelete(BeatmapSetInfo beatmapSet) { - if (!beatmaps.Undelete(beatmapSet)) return; + lock (this) + { + if (!beatmaps.Undelete(beatmapSet)) return; - files.Reference(beatmapSet.Files); + files.Reference(beatmapSet.Files); + } } /// @@ -158,22 +168,25 @@ namespace osu.Game.Beatmaps /// A instance correlating to the provided . public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) { - if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) - return DefaultBeatmap; + lock (this) + { + if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) + return DefaultBeatmap; - beatmaps.Populate(beatmapInfo); + beatmaps.Populate(beatmapInfo); - if (beatmapInfo.BeatmapSet == null) - throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); + if (beatmapInfo.BeatmapSet == null) + throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); - if (beatmapInfo.Metadata == null) - beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; + if (beatmapInfo.Metadata == null) + beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; - WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(files.Store, beatmapInfo); + WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(files.Store, beatmapInfo); - previous?.TransferTo(working); + previous?.TransferTo(working); - return working; + return working; + } } /// @@ -325,10 +338,13 @@ namespace osu.Game.Beatmaps /// A list of available . public List GetAllUsableBeatmapSets(bool populate = true) { - if (populate) - return beatmaps.QueryAndPopulate(b => !b.DeletePending).ToList(); - else - return beatmaps.Query(b => !b.DeletePending).ToList(); + lock (this) + { + if (populate) + return beatmaps.QueryAndPopulate(b => !b.DeletePending).ToList(); + else + return beatmaps.Query(b => !b.DeletePending).ToList(); + } } protected class BeatmapManagerWorkingBeatmap : WorkingBeatmap From e448f79154a6d9c33b9f240c65b14051fda0bc59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 12:47:23 +0900 Subject: [PATCH 100/132] Fix deleted beatmaps not correctly being removed from the playlist --- osu.Game/Overlays/Music/PlaylistList.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 88f499f9a6..3dd514edeb 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Music public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) { - PlaylistItem itemToRemove = items.Children.FirstOrDefault(item => item.BeatmapSetInfo == beatmapSet); + PlaylistItem itemToRemove = items.Children.FirstOrDefault(item => item.BeatmapSetInfo.ID == beatmapSet.ID); if (itemToRemove != null) items.Remove(itemToRemove); } From f705589bf2b9664b87ed31b6992c9d832d6f025d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 14:51:49 +0900 Subject: [PATCH 101/132] Rename NotificationManager to NotificationOverlay --- ...cationManager.cs => TestCaseNotificationOverlay.cs} | 8 ++++---- osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj | 2 +- osu.Desktop/Overlays/VersionManager.cs | 8 ++++---- osu.Game/Online/API/APIAccess.cs | 4 ++-- osu.Game/OsuGame.cs | 10 +++++----- .../{NotificationManager.cs => NotificationOverlay.cs} | 4 ++-- osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs | 4 ++-- osu.Game/Screens/Play/HUDOverlay.cs | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 9 files changed, 23 insertions(+), 23 deletions(-) rename osu.Desktop.VisualTests/Tests/{TestCaseNotificationManager.cs => TestCaseNotificationOverlay.cs} (91%) rename osu.Game/Overlays/{NotificationManager.cs => NotificationOverlay.cs} (95%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationOverlay.cs similarity index 91% rename from osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs rename to osu.Desktop.VisualTests/Tests/TestCaseNotificationOverlay.cs index 849df1263e..3b9c251670 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationOverlay.cs @@ -12,17 +12,17 @@ using osu.Framework.Graphics.Containers; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseNotificationManager : TestCase + internal class TestCaseNotificationOverlay : TestCase { public override string Description => @"I handle notifications"; - private readonly NotificationManager manager; + private readonly NotificationOverlay manager; - public TestCaseNotificationManager() + public TestCaseNotificationOverlay() { progressingNotifications.Clear(); - Content.Add(manager = new NotificationManager + Content.Add(manager = new NotificationOverlay { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 4974f0c0d1..1f4fd80ca6 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -198,7 +198,7 @@ - + diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 71ae5a6697..6983c51c7d 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -25,16 +25,16 @@ namespace osu.Desktop.Overlays public class VersionManager : OverlayContainer { private UpdateManager updateManager; - private NotificationManager notificationManager; + private NotificationOverlay notificationOverlay; protected override bool HideOnEscape => false; public override bool HandleInput => false; [BackgroundDependencyLoader] - private void load(NotificationManager notification, OsuColour colours, TextureStore textures, OsuGameBase game) + private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game) { - notificationManager = notification; + notificationOverlay = notification; AutoSizeAxes = Axes.Both; Anchor = Anchor.BottomCentre; @@ -116,7 +116,7 @@ namespace osu.Desktop.Overlays if (notification == null) { notification = new UpdateProgressNotification { State = ProgressNotificationState.Active }; - Schedule(() => notificationManager.Post(notification)); + Schedule(() => notificationOverlay.Post(notification)); } Schedule(() => diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 7e3bb44465..57f5c54a18 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -117,7 +117,7 @@ namespace osu.Game.Online.API if (!authentication.HasValidAccessToken && !authentication.AuthenticateWithLogin(Username, Password)) { //todo: this fails even on network-related issues. we should probably handle those differently. - //NotificationManager.ShowMessage("Login failed!"); + //NotificationOverlay.ShowMessage("Login failed!"); log.Add(@"Login failed!"); Password = null; continue; @@ -254,7 +254,7 @@ namespace osu.Game.Online.API { //OsuGame.Scheduler.Add(delegate { - //NotificationManager.ShowMessage($@"We just went {newState}!", newState == APIState.Online ? Color4.YellowGreen : Color4.OrangeRed, 5000); + //NotificationOverlay.ShowMessage($@"We just went {newState}!", newState == APIState.Online ? Color4.YellowGreen : Color4.OrangeRed, 5000); log.Add($@"We just went {newState}!"); Scheduler.Add(delegate { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4f4c2e2883..fe6d2dbb41 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -37,7 +37,7 @@ namespace osu.Game private MusicController musicController; - private NotificationManager notificationManager; + private NotificationOverlay notificationOverlay; private DialogOverlay dialogOverlay; @@ -132,7 +132,7 @@ namespace osu.Game if (s.Beatmap == null) { - notificationManager.Post(new SimpleNotification + notificationOverlay.Post(new SimpleNotification { Text = @"Tried to load a score for a beatmap we don't have!", Icon = FontAwesome.fa_life_saver, @@ -189,7 +189,7 @@ namespace osu.Game Origin = Anchor.TopRight, }, overlayContent.Add); - LoadComponentAsync(notificationManager = new NotificationManager + LoadComponentAsync(notificationOverlay = new NotificationOverlay { Depth = -3, Anchor = Anchor.TopRight, @@ -205,7 +205,7 @@ namespace osu.Game { if (entry.Level < LogLevel.Important) return; - notificationManager.Post(new SimpleNotification + notificationOverlay.Post(new SimpleNotification { Text = $@"{entry.Level}: {entry.Message}" }); @@ -216,7 +216,7 @@ namespace osu.Game dependencies.Cache(chat); dependencies.Cache(userProfile); dependencies.Cache(musicController); - dependencies.Cache(notificationManager); + dependencies.Cache(notificationOverlay); dependencies.Cache(dialogOverlay); // ensure both overlays aren't presented at the same time diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationOverlay.cs similarity index 95% rename from osu.Game/Overlays/NotificationManager.cs rename to osu.Game/Overlays/NotificationOverlay.cs index ad0236ae1f..4c381fae0e 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -13,7 +13,7 @@ using osu.Game.Graphics.Containers; namespace osu.Game.Overlays { - public class NotificationManager : OsuFocusedOverlayContainer + public class NotificationOverlay : OsuFocusedOverlayContainer { private const float width = 320; @@ -109,4 +109,4 @@ namespace osu.Game.Overlays this.FadeTo(0, TRANSITION_LENGTH / 2); } } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index 5126f6a2a4..dcadc4bf56 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -19,9 +19,9 @@ namespace osu.Game.Overlays.Toolbar } [BackgroundDependencyLoader] - private void load(NotificationManager notificationManager) + private void load(NotificationOverlay notificationOverlay) { - StateContainer = notificationManager; + StateContainer = notificationOverlay; } } } \ No newline at end of file diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 70093a1407..ea75c140db 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader(true)] - private void load(OsuConfigManager config, NotificationManager notificationManager, OsuColour colours) + private void load(OsuConfigManager config, NotificationOverlay notificationOverlay, OsuColour colours) { showHud = config.GetBindable(OsuSetting.ShowInterface); showHud.ValueChanged += hudVisibility => content.FadeTo(hudVisibility ? 1 : 0, duration); @@ -71,7 +71,7 @@ namespace osu.Game.Screens.Play { hasShownNotificationOnce = true; - notificationManager?.Post(new SimpleNotification + notificationOverlay?.Post(new SimpleNotification { Text = @"The score overlay is currently disabled. You can toggle this by pressing Shift+Tab." }); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f8509314be..a81c5e2fc4 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -249,7 +249,7 @@ - + From 02a04afb294545bd44552fa1883fb9f4f7a7fe81 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 15:03:08 +0900 Subject: [PATCH 102/132] Ensure notification posts are always scheduled to local thread Posts can be triggered by Logger.Log events which are not guaranteed to be on the update thread. --- osu.Game/Overlays/NotificationOverlay.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 4c381fae0e..6f5d4bc6fc 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -72,17 +72,20 @@ namespace osu.Game.Overlays public void Post(Notification notification) { - State = Visibility.Visible; + Schedule(() => + { + State = Visibility.Visible; - ++runningDepth; - notification.Depth = notification.DisplayOnTop ? runningDepth : -runningDepth; + ++runningDepth; + notification.Depth = notification.DisplayOnTop ? runningDepth : -runningDepth; - var hasCompletionTarget = notification as IHasCompletionTarget; - if (hasCompletionTarget != null) - hasCompletionTarget.CompletionTarget = Post; + var hasCompletionTarget = notification as IHasCompletionTarget; + if (hasCompletionTarget != null) + hasCompletionTarget.CompletionTarget = Post; - var ourType = notification.GetType(); - sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType)))?.Add(notification); + var ourType = notification.GetType(); + sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType)))?.Add(notification); + }); } protected override void PopIn() From a55586f2ad26f4a37ac3f5b5a420f73a9dd90282 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 13:54:43 +0900 Subject: [PATCH 103/132] FIx potential sequence of execution issues in PlaylistOverlay --- osu.Game/Overlays/Music/PlaylistOverlay.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 31fe755d2b..100b397890 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -77,11 +77,11 @@ namespace osu.Game.Overlays.Music }, }; + beatmaps.BeatmapSetAdded += s => Schedule(() => list.AddBeatmapSet(s)); + beatmaps.BeatmapSetRemoved += s => Schedule(() => list.RemoveBeatmapSet(s)); + list.BeatmapSets = BeatmapSets = beatmaps.GetAllUsableBeatmapSets(); - // todo: these should probably be above the query. - beatmaps.BeatmapSetAdded += s => list.AddBeatmapSet(s); - beatmaps.BeatmapSetRemoved += s => list.RemoveBeatmapSet(s); beatmapBacking.BindTo(game.Beatmap); From e691dd12c527132ca80276336cf86a7b364179c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 14:22:14 +0900 Subject: [PATCH 104/132] Fix potential sequen of execution issues in BeatmapCarousel --- osu.Game/Screens/Select/BeatmapCarousel.cs | 10 ++++++++-- osu.Game/Screens/Select/SongSelect.cs | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 743a0a0f63..63992915aa 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -107,6 +107,14 @@ namespace osu.Game.Screens.Select }); } + public void RemoveBeatmap(BeatmapSetInfo beatmapSet) + { + Schedule(delegate + { + removeGroup(groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID)); + }); + } + public void SelectBeatmap(BeatmapInfo beatmap, bool animated = true) { if (beatmap == null) @@ -128,8 +136,6 @@ namespace osu.Game.Screens.Select } } - public void RemoveBeatmap(BeatmapSetInfo info) => removeGroup(groups.Find(b => b.BeatmapSet.ID == info.ID)); - public Action SelectionChanged; public Action StartRequested; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index bbd292870e..d2aec8d919 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -280,7 +280,7 @@ namespace osu.Game.Screens.Select carousel.Filter(criteria, debounce); } - private void onBeatmapSetAdded(BeatmapSetInfo s) => carousel.AddBeatmap(s); + private void onBeatmapSetAdded(BeatmapSetInfo s) => Schedule(() => addBeatmapSet(s)); private void onBeatmapSetRemoved(BeatmapSetInfo s) => Schedule(() => removeBeatmapSet(s)); @@ -375,6 +375,11 @@ namespace osu.Game.Screens.Select } } + private void addBeatmapSet(BeatmapSetInfo beatmapSet) + { + carousel.AddBeatmap(beatmapSet); + } + private void removeBeatmapSet(BeatmapSetInfo beatmapSet) { carousel.RemoveBeatmap(beatmapSet); From 6616721e3721ef37e562c54b84185bedae938712 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 14:42:04 +0900 Subject: [PATCH 105/132] Don't block imports and BeatmapStore operations using the same lock --- osu.Game/Beatmaps/BeatmapManager.cs | 43 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index e62fd2fc5d..16a1268e88 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -102,6 +102,8 @@ namespace osu.Game.Beatmaps } } + private object ImportLock = new object(); + /// /// Import a beatmap from an . /// @@ -109,7 +111,7 @@ namespace osu.Game.Beatmaps public BeatmapSetInfo Import(ArchiveReader archiveReader) { // let's only allow one concurrent import at a time for now. - lock (this) + lock (ImportLock) { BeatmapSetInfo set = importToStorage(archiveReader); Import(set); @@ -126,7 +128,8 @@ namespace osu.Game.Beatmaps // If we have an ID then we already exist in the database. if (beatmapSetInfo.ID != 0) return; - beatmaps.Add(beatmapSetInfo); + lock (beatmaps) + beatmaps.Add(beatmapSetInfo); } /// @@ -136,13 +139,11 @@ namespace osu.Game.Beatmaps /// The beatmap to delete. public void Delete(BeatmapSetInfo beatmapSet) { - lock (this) - { + lock (beatmaps) if (!beatmaps.Delete(beatmapSet)) return; - if (!beatmapSet.Protected) - files.Dereference(beatmapSet.Files); - } + if (!beatmapSet.Protected) + files.Dereference(beatmapSet.Files); } /// @@ -152,12 +153,10 @@ namespace osu.Game.Beatmaps /// The beatmap to restore. public void Undelete(BeatmapSetInfo beatmapSet) { - lock (this) - { + lock (beatmaps) if (!beatmaps.Undelete(beatmapSet)) return; - files.Reference(beatmapSet.Files); - } + files.Reference(beatmapSet.Files); } /// @@ -168,25 +167,23 @@ namespace osu.Game.Beatmaps /// A instance correlating to the provided . public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) { - lock (this) - { - if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) - return DefaultBeatmap; + if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) + return DefaultBeatmap; + lock (beatmaps) beatmaps.Populate(beatmapInfo); - if (beatmapInfo.BeatmapSet == null) - throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); + if (beatmapInfo.BeatmapSet == null) + throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); - if (beatmapInfo.Metadata == null) - beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; + if (beatmapInfo.Metadata == null) + beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; - WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(files.Store, beatmapInfo); + WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(files.Store, beatmapInfo); - previous?.TransferTo(working); + previous?.TransferTo(working); - return working; - } + return working; } /// From d93d9e619019ab0b34f1a3a618ea9de8f2f8e47c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 15:08:56 +0900 Subject: [PATCH 106/132] Tidy up file deletion after import --- osu.Game/Beatmaps/BeatmapManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 16a1268e88..646ae3fae9 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -87,11 +87,12 @@ namespace osu.Game.Beatmaps // TODO: Add a check to prevent files from storage to be deleted. try { - File.Delete(path); + if (File.Exists(path)) + File.Delete(path); } catch (Exception e) { - Logger.Error(e, $@"Could not delete file at {path}"); + Logger.Error(e, $@"Could not delete original file after import ({Path.GetFileName(path)})"); } } catch (Exception e) From f5b0253e8234f142f61981bffa17b84acd5ae6ed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 15:36:23 +0900 Subject: [PATCH 107/132] Apply CI fixes --- osu.Game/Beatmaps/BeatmapManager.cs | 41 +++++++++++++++++++---------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 646ae3fae9..de65db1a5a 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -103,7 +103,7 @@ namespace osu.Game.Beatmaps } } - private object ImportLock = new object(); + private readonly object importLock = new object(); /// /// Import a beatmap from an . @@ -112,7 +112,7 @@ namespace osu.Game.Beatmaps public BeatmapSetInfo Import(ArchiveReader archiveReader) { // let's only allow one concurrent import at a time for now. - lock (ImportLock) + lock (importLock) { BeatmapSetInfo set = importToStorage(archiveReader); Import(set); @@ -192,7 +192,8 @@ namespace osu.Game.Beatmaps /// public void Reset() { - beatmaps.Reset(); + lock (beatmaps) + beatmaps.Reset(); } /// @@ -202,12 +203,15 @@ namespace osu.Game.Beatmaps /// The first result for the provided query, or null if no results were found. public BeatmapSetInfo QueryBeatmapSet(Func query) { - BeatmapSetInfo set = beatmaps.Query().FirstOrDefault(query); + lock (beatmaps) + { + BeatmapSetInfo set = beatmaps.Query().FirstOrDefault(query); - if (set != null) - beatmaps.Populate(set); + if (set != null) + beatmaps.Populate(set); - return set; + return set; + } } /// @@ -215,7 +219,10 @@ namespace osu.Game.Beatmaps /// /// The query. /// Results from the provided query. - public List QueryBeatmapSets(Expression> query) => beatmaps.QueryAndPopulate(query); + public List QueryBeatmapSets(Expression> query) + { + lock (beatmaps) return beatmaps.QueryAndPopulate(query); + } /// /// Perform a lookup query on available s. @@ -224,12 +231,15 @@ namespace osu.Game.Beatmaps /// The first result for the provided query, or null if no results were found. public BeatmapInfo QueryBeatmap(Func query) { - BeatmapInfo set = beatmaps.Query().FirstOrDefault(query); + lock (beatmaps) + { + BeatmapInfo set = beatmaps.Query().FirstOrDefault(query); - if (set != null) - beatmaps.Populate(set); + if (set != null) + beatmaps.Populate(set); - return set; + return set; + } } /// @@ -237,7 +247,10 @@ namespace osu.Game.Beatmaps /// /// The query. /// Results from the provided query. - public List QueryBeatmaps(Expression> query) => beatmaps.QueryAndPopulate(query); + public List QueryBeatmaps(Expression> query) + { + lock (beatmaps) return beatmaps.QueryAndPopulate(query); + } /// /// Creates an from a valid storage path. @@ -336,7 +349,7 @@ namespace osu.Game.Beatmaps /// A list of available . public List GetAllUsableBeatmapSets(bool populate = true) { - lock (this) + lock (beatmaps) { if (populate) return beatmaps.QueryAndPopulate(b => !b.DeletePending).ToList(); From c48bf3940e163df31e5291f8da5348ca02317f48 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 16:55:58 +0900 Subject: [PATCH 108/132] Add a progress notification when importing beatmaps --- osu.Game/Beatmaps/BeatmapManager.cs | 29 ++++++++++++++++++++++++++--- osu.Game/OsuGameBase.cs | 2 +- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index de65db1a5a..f32dbc8322 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -17,6 +17,7 @@ using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.IO; using osu.Game.IO; using osu.Game.IPC; +using osu.Game.Overlays.Notifications; using osu.Game.Rulesets; using SQLite.Net; using FileInfo = osu.Game.IO.FileInfo; @@ -48,13 +49,14 @@ namespace osu.Game.Beatmaps private readonly FileStore files; private readonly RulesetStore rulesets; + private readonly Action postNotification; private readonly BeatmapStore beatmaps; // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private BeatmapIPCChannel ipc; - public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, IIpcHost importHost = null) + public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, IIpcHost importHost = null, Action postNotification = null) { beatmaps = new BeatmapStore(connection); beatmaps.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); @@ -63,24 +65,43 @@ namespace osu.Game.Beatmaps this.storage = storage; this.files = files; this.rulesets = rulesets; + this.postNotification = postNotification; if (importHost != null) ipc = new BeatmapIPCChannel(importHost, this); } /// - /// Import multiple from filesystem . + /// Import one or more from filesystem . + /// This will post a notification tracking import progress. /// - /// Multiple locations on disk. + /// One or more beatmap locations on disk. public void Import(params string[] paths) { + var notification = new ProgressNotification + { + Text = "Beatmap import is initialising...", + Progress = 0, + State = ProgressNotificationState.Active, + }; + + postNotification?.Invoke(notification); + + int i = 0; foreach (string path in paths) { + if (notification.State == ProgressNotificationState.Cancelled) + // user requested abort + return; + try { + notification.Text = $"Importing ({i} of {paths.Length})\n{Path.GetFileName(path)}"; using (ArchiveReader reader = getReaderFrom(path)) Import(reader); + notification.Progress = (float)++i / paths.Length; + // We may or may not want to delete the file depending on where it is stored. // e.g. reconstructing/repairing database with beatmaps from default storage. // Also, not always a single file, i.e. for LegacyFilesystemReader @@ -101,6 +122,8 @@ namespace osu.Game.Beatmaps Logger.Error(e, @"Could not import beatmap set"); } } + + notification.State = ProgressNotificationState.Completed; } private readonly object importLock = new object(); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 0dec4228de..8a09c7aac7 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -102,7 +102,7 @@ namespace osu.Game dependencies.Cache(RulesetStore = new RulesetStore(connection)); dependencies.Cache(FileStore = new FileStore(connection, Host.Storage)); - dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host)); + dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host, PostNotification)); dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, connection, Host, BeatmapManager)); dependencies.Cache(new OsuColour()); From 0d332d4754d867ade6b7f8aa1c5d636bd403c09a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 16:54:29 +0900 Subject: [PATCH 109/132] Fix NotificationOverlay no longer automatically displaying --- osu.Game/Overlays/NotificationOverlay.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 6f5d4bc6fc..7eabb592c6 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -28,6 +28,8 @@ namespace osu.Game.Overlays Width = width; RelativeSizeAxes = Axes.Y; + AlwaysPresent = true; + Children = new Drawable[] { new Box From 5dfed1dba5afa0c740cc6f8884f08a49d78bf5ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 16:52:29 +0900 Subject: [PATCH 110/132] Add word-wrap functionality of ProgressNotification Fixes a potential threading issue when updating Text. --- .../Notifications/ProgressNotification.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 98aac3a02d..aa65f09ece 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -6,9 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; @@ -18,10 +16,9 @@ namespace osu.Game.Overlays.Notifications { public string Text { - get { return textDrawable.Text; } set { - textDrawable.Text = value; + Schedule(() => textDrawable.Text = value); } } @@ -90,7 +87,7 @@ namespace osu.Game.Overlays.Notifications protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification { Activated = CompletionClickAction, - Text = $"Task \"{Text}\" has completed!" + Text = "Task has completed!" }; protected virtual void Completed() @@ -106,7 +103,7 @@ namespace osu.Game.Overlays.Notifications private Color4 colourActive; private Color4 colourCancelled; - private readonly SpriteText textDrawable; + private readonly TextFlowContainer textDrawable; public ProgressNotification() { @@ -115,9 +112,11 @@ namespace osu.Game.Overlays.Notifications RelativeSizeAxes = Axes.Both, }); - Content.Add(textDrawable = new OsuSpriteText + Content.Add(textDrawable = new TextFlowContainer(t => + { + t.TextSize = 16; + }) { - TextSize = 16, Colour = OsuColour.Gray(128), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, From b3e3c4a2260f9fd9eae36848701c0d7f728fe0c9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 16:53:37 +0900 Subject: [PATCH 111/132] Fix setting a ProgressNotification's progress too early crashing --- .../Notifications/ProgressNotification.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index aa65f09ece..43a0a5f7a3 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -166,7 +166,7 @@ namespace osu.Game.Overlays.Notifications private class ProgressBar : Container { - private Box box; + private readonly Box box; private Color4 colourActive; private Color4 colourInactive; @@ -196,15 +196,8 @@ namespace osu.Game.Overlays.Notifications } } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) + public ProgressBar() { - colourActive = colours.Blue; - Colour = colourInactive = OsuColour.Gray(0.5f); - - Height = 5; - Children = new[] { box = new Box @@ -214,6 +207,15 @@ namespace osu.Game.Overlays.Notifications } }; } + + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + colourActive = colours.Blue; + Colour = colourInactive = OsuColour.Gray(0.5f); + Height = 5; + } } } From 74044baefff03e64731707e5007313871f4260ef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 16:53:49 +0900 Subject: [PATCH 112/132] Don't cancel a ProgressNotification when clicking by default --- osu.Game/Overlays/Notifications/ProgressNotification.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 43a0a5f7a3..f42b4b6cb3 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -130,6 +130,9 @@ namespace osu.Game.Overlays.Notifications }); State = ProgressNotificationState.Queued; + + // don't close on click by default. + Activated = () => false; } [BackgroundDependencyLoader] From 4bb8f40b49bd3606ea9ec6138c3adc5d07603009 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 16:54:09 +0900 Subject: [PATCH 113/132] AutoSize notifications (and add animation) --- osu.Game/Overlays/Notifications/Notification.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index a590507f41..49b2823531 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -63,6 +63,8 @@ namespace osu.Game.Overlays.Notifications Masking = true, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + AutoSizeDuration = 400, + AutoSizeEasing = Easing.OutQuint, Children = new Drawable[] { new Box @@ -74,7 +76,7 @@ namespace osu.Game.Overlays.Notifications { RelativeSizeAxes = Axes.X, Padding = new MarginPadding(5), - Height = 60, + AutoSizeAxes = Axes.Y, Children = new Drawable[] { IconContent = new Container From 6807caa752b1410f3ceda67e0ea5f685363ffab3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2017 17:31:13 +0900 Subject: [PATCH 114/132] Use a transaction when adding a beatmap Fixes flakey unit test. --- osu.Game/Beatmaps/BeatmapStore.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 4a7336535e..2c3ffe25b4 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -56,7 +56,11 @@ namespace osu.Game.Beatmaps /// The beatmap to add. public void Add(BeatmapSetInfo beatmapSet) { - Connection.InsertOrReplaceWithChildren(beatmapSet, true); + Connection.RunInTransaction(() => + { + Connection.InsertOrReplaceWithChildren(beatmapSet, true); + }); + BeatmapSetAdded?.Invoke(beatmapSet); } From 8458622c4d4b82754004be7832e7e120309d16ee Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 29 Jul 2017 16:03:17 +0300 Subject: [PATCH 115/132] Add ScrollToSelected method --- osu.Game/Screens/Select/BeatmapCarousel.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 743a0a0f63..1177d820c3 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -281,6 +281,12 @@ namespace osu.Game.Screens.Select perform(); } + public void ScrollToSelected(bool animated = true) + { + float selectedY = computeYPositions(animated); + ScrollTo(selectedY, animated); + } + private BeatmapGroup createGroup(BeatmapSetInfo beatmapSet) { foreach (var b in beatmapSet.Beatmaps) @@ -420,8 +426,7 @@ namespace osu.Game.Screens.Select } finally { - float selectedY = computeYPositions(animated); - ScrollTo(selectedY, animated); + ScrollToSelected(animated); } } From e121b119be21d896b8754c43e5fdf3daf2433d0c Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 29 Jul 2017 17:33:20 +0300 Subject: [PATCH 116/132] Added "scroll to" container --- osu.Game/Screens/Select/SongSelect.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index bbd292870e..57e2183853 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -31,6 +31,7 @@ namespace osu.Game.Screens.Select private BeatmapManager manager; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(); + private readonly ActionContainer actionContainer; private readonly BeatmapCarousel carousel; private DialogOverlay dialogOverlay; @@ -129,6 +130,12 @@ namespace osu.Game.Screens.Select Right = left_area_padding, }, }); + Add(actionContainer = new ActionContainer + { + RelativeSizeAxes = Axes.Y, + Width = 250, + OnHoverAction = () => carousel.ScrollToSelected(), + }); if (ShowFooter) { @@ -409,5 +416,16 @@ namespace osu.Game.Screens.Select return base.OnKeyDown(state, args); } + + private class ActionContainer : Container + { + public Action OnHoverAction; + + protected override bool OnHover(InputState state) + { + OnHoverAction?.Invoke(); + return base.OnHover(state); + } + } } } From 6b3a81f5671b064e9ab067819f94a6c4ac675673 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 29 Jul 2017 17:42:32 +0300 Subject: [PATCH 117/132] Fix hard crash when pressing random if no beatmaps avaliable --- osu.Game/Screens/Select/BeatmapCarousel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 1177d820c3..9e5446a573 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -181,12 +181,12 @@ namespace osu.Game.Screens.Select if (groups.Count == 0) return; - randomSelectedBeatmaps.Push(new KeyValuePair(selectedGroup, selectedGroup.SelectedPanel)); - var visibleGroups = getVisibleGroups(); if (!visibleGroups.Any()) return; + randomSelectedBeatmaps.Push(new KeyValuePair(selectedGroup, selectedGroup.SelectedPanel)); + BeatmapGroup group; if (randomType == SelectionRandomType.RandomPermutation) From 62365090add453e1120d21090e100d605f3f7d01 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 29 Jul 2017 17:51:11 +0300 Subject: [PATCH 118/132] Removed useless variable --- osu.Game/Screens/Select/SongSelect.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 57e2183853..94740c0216 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -31,7 +31,6 @@ namespace osu.Game.Screens.Select private BeatmapManager manager; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(); - private readonly ActionContainer actionContainer; private readonly BeatmapCarousel carousel; private DialogOverlay dialogOverlay; @@ -130,7 +129,7 @@ namespace osu.Game.Screens.Select Right = left_area_padding, }, }); - Add(actionContainer = new ActionContainer + Add(new ActionContainer { RelativeSizeAxes = Axes.Y, Width = 250, From df5094c0d4aab957f4894de87de27f77542e1b13 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 31 Jul 2017 18:03:55 +0900 Subject: [PATCH 119/132] Rework how notifications are distributed --- osu.Game/Beatmaps/BeatmapManager.cs | 11 +++++++---- osu.Game/OsuGame.cs | 3 +++ osu.Game/OsuGameBase.cs | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index f32dbc8322..c471502d88 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -49,14 +49,18 @@ namespace osu.Game.Beatmaps private readonly FileStore files; private readonly RulesetStore rulesets; - private readonly Action postNotification; private readonly BeatmapStore beatmaps; // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private BeatmapIPCChannel ipc; - public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, IIpcHost importHost = null, Action postNotification = null) + /// + /// Set an endpoint for notifications to be posted to. + /// + public Action PostNotification { private get; set; } + + public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, IIpcHost importHost = null) { beatmaps = new BeatmapStore(connection); beatmaps.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); @@ -65,7 +69,6 @@ namespace osu.Game.Beatmaps this.storage = storage; this.files = files; this.rulesets = rulesets; - this.postNotification = postNotification; if (importHost != null) ipc = new BeatmapIPCChannel(importHost, this); @@ -85,7 +88,7 @@ namespace osu.Game.Beatmaps State = ProgressNotificationState.Active, }; - postNotification?.Invoke(notification); + PostNotification?.Invoke(notification); int i = 0; foreach (string path in paths) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index fe6d2dbb41..4082ed4ecd 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -149,6 +149,9 @@ namespace osu.Game { base.LoadComplete(); + // hook up notifications to components. + BeatmapManager.PostNotification = n => notificationOverlay?.Post(n); + AddRange(new Drawable[] { new VolumeControlReceptor { diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 8a09c7aac7..0dec4228de 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -102,7 +102,7 @@ namespace osu.Game dependencies.Cache(RulesetStore = new RulesetStore(connection)); dependencies.Cache(FileStore = new FileStore(connection, Host.Storage)); - dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host, PostNotification)); + dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host)); dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, connection, Host, BeatmapManager)); dependencies.Cache(new OsuColour()); From 92b3c7ac08c260fc0c1f5afa3306cbba4157fed2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 31 Jul 2017 18:38:42 +0900 Subject: [PATCH 120/132] Fix the whole database being retrieved when importing each beatmap --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index c471502d88..8cced2d5f4 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -308,7 +308,7 @@ namespace osu.Game.Beatmaps var hash = hashable.ComputeSHA2Hash(); // check if this beatmap has already been imported and exit early if so. - var beatmapSet = beatmaps.QueryAndPopulate().FirstOrDefault(b => b.Hash == hash); + var beatmapSet = beatmaps.QueryAndPopulate(b => b.Hash == hash).FirstOrDefault(); if (beatmapSet != null) { Undelete(beatmapSet); From bc8f8de0495e6b8702e800b73456128ecc3f0a2f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 31 Jul 2017 18:41:54 +0900 Subject: [PATCH 121/132] Make QueryAndPopulate's filter non-optional (you basically *never* want this missing) --- osu.Game/Database/DatabaseBackedStore.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/DatabaseBackedStore.cs b/osu.Game/Database/DatabaseBackedStore.cs index bb61fc1870..bd25acc41b 100644 --- a/osu.Game/Database/DatabaseBackedStore.cs +++ b/osu.Game/Database/DatabaseBackedStore.cs @@ -83,9 +83,9 @@ namespace osu.Game.Database /// /// Query and populate results. /// - /// An optional filter to refine results. + /// An filter to refine results. /// - public List QueryAndPopulate(Expression> filter = null) + public List QueryAndPopulate(Expression> filter) where T : class { checkType(typeof(T)); From f67822a59b9256f221de0461806df238073f8063 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 31 Jul 2017 18:52:59 +0900 Subject: [PATCH 122/132] Add progress for deleting all maps --- osu.Game/Beatmaps/BeatmapManager.cs | 30 +++++++++++++++++++ .../Sections/Maintenance/GeneralSettings.cs | 6 +--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 8cced2d5f4..3890abd341 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -459,5 +459,35 @@ namespace osu.Game.Beatmaps Import(Directory.GetDirectories(stableInstallPath)); } + + public void DeleteAll() + { + var maps = GetAllUsableBeatmapSets().ToArray(); + + if (maps.Length == 0) return; + + var notification = new ProgressNotification + { + Progress = 0, + State = ProgressNotificationState.Active, + }; + + PostNotification?.Invoke(notification); + + int i = 0; + + foreach (var b in maps) + { + if (notification.State == ProgressNotificationState.Cancelled) + // user requested abort + return; + + notification.Text = $"Deleting ({i} of {maps.Length})"; + notification.Progress = (float)++i / maps.Length; + Delete(b); + } + + notification.State = ProgressNotificationState.Completed; + } } } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index 684bfcb39d..9d13a2ae2f 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -38,11 +38,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { deleteButton.Enabled.Value = false; - Task.Run(() => - { - foreach (var b in beatmaps.GetAllUsableBeatmapSets()) - beatmaps.Delete(b); - }).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true)); + Task.Run(() => beatmaps.DeleteAll()).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true)); } }, }; From 700c7753c3d2096741aeefa9718506fb8a3196a9 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 31 Jul 2017 14:20:12 +0300 Subject: [PATCH 123/132] Applied suggestions --- osu.Game/Screens/Select/SongSelect.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 94740c0216..fd314e1559 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -129,11 +129,10 @@ namespace osu.Game.Screens.Select Right = left_area_padding, }, }); - Add(new ActionContainer + Add(new ResetScrollContainer(() => carousel.ScrollToSelected()) { RelativeSizeAxes = Axes.Y, Width = 250, - OnHoverAction = () => carousel.ScrollToSelected(), }); if (ShowFooter) @@ -416,13 +415,18 @@ namespace osu.Game.Screens.Select return base.OnKeyDown(state, args); } - private class ActionContainer : Container + private class ResetScrollContainer : Container { - public Action OnHoverAction; + private readonly Action onHoverAction; + + public ResetScrollContainer(Action onHoverAction) + { + this.onHoverAction = onHoverAction; + } protected override bool OnHover(InputState state) { - OnHoverAction?.Invoke(); + onHoverAction?.Invoke(); return base.OnHover(state); } } From 404497fa101504da2488331e6160346fda145caf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 31 Jul 2017 21:48:03 +0900 Subject: [PATCH 124/132] Allow a single beatmap to reference the same file multiple times This fixes incorrect reference counts causing database desync. --- osu.Game/Beatmaps/BeatmapManager.cs | 16 +++++++---- osu.Game/Beatmaps/BeatmapSetFileInfo.cs | 14 +++++++-- osu.Game/Beatmaps/BeatmapSetInfo.cs | 5 ++-- osu.Game/Database/DatabaseBackedStore.cs | 1 - osu.Game/IO/FileInfo.cs | 2 -- osu.Game/IO/FileStore.cs | 36 +++++++++++++++--------- 6 files changed, 46 insertions(+), 28 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 99117afe35..15225fe821 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -19,7 +19,6 @@ using osu.Game.IO; using osu.Game.IPC; using osu.Game.Rulesets; using SQLite.Net; -using FileInfo = osu.Game.IO.FileInfo; namespace osu.Game.Beatmaps { @@ -135,7 +134,7 @@ namespace osu.Game.Beatmaps if (!beatmaps.Delete(beatmapSet)) return; if (!beatmapSet.Protected) - files.Dereference(beatmapSet.Files); + files.Dereference(beatmapSet.Files.Select(f => f.FileInfo)); } /// @@ -147,7 +146,8 @@ namespace osu.Game.Beatmaps { if (!beatmaps.Undelete(beatmapSet)) return; - files.Reference(beatmapSet.Files); + if (!beatmapSet.Protected) + files.Reference(beatmapSet.Files.Select(f => f.FileInfo)); } /// @@ -265,12 +265,16 @@ namespace osu.Game.Beatmaps return beatmapSet; } - List fileInfos = new List(); + List fileInfos = new List(); // import files to manager foreach (string file in reader.Filenames) using (Stream s = reader.GetStream(file)) - fileInfos.Add(files.Add(s, file)); + fileInfos.Add(new BeatmapSetFileInfo + { + Filename = file, + FileInfo = files.Add(s) + }); BeatmapMetadata metadata; @@ -366,7 +370,7 @@ namespace osu.Game.Beatmaps catch { return null; } } - private string getPathForFile(string filename) => BeatmapSetInfo.Files.First(f => f.Filename == filename).StoragePath; + private string getPathForFile(string filename) => BeatmapSetInfo.Files.First(f => f.Filename == filename).FileInfo.StoragePath; protected override Texture GetBackground() { diff --git a/osu.Game/Beatmaps/BeatmapSetFileInfo.cs b/osu.Game/Beatmaps/BeatmapSetFileInfo.cs index d18b1e833b..a05362b32d 100644 --- a/osu.Game/Beatmaps/BeatmapSetFileInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetFileInfo.cs @@ -2,16 +2,26 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.IO; +using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; namespace osu.Game.Beatmaps { public class BeatmapSetFileInfo { - [ForeignKey(typeof(BeatmapSetInfo))] + [PrimaryKey, AutoIncrement] + public int ID { get; set; } + + [ForeignKey(typeof(BeatmapSetInfo)), NotNull] public int BeatmapSetInfoID { get; set; } - [ForeignKey(typeof(FileInfo))] + [ForeignKey(typeof(FileInfo)), NotNull] public int FileInfoID { get; set; } + + [OneToOne(CascadeOperations = CascadeOperation.CascadeRead)] + public FileInfo FileInfo { get; set; } + + [NotNull] + public string Filename { get; set; } } } \ No newline at end of file diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index a99ba94e9a..f47affcab8 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; -using osu.Game.IO; using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; @@ -37,8 +36,8 @@ namespace osu.Game.Beatmaps public string StoryboardFile => Files.FirstOrDefault(f => f.Filename.EndsWith(".osb"))?.Filename; - [ManyToMany(typeof(BeatmapSetFileInfo), CascadeOperations = CascadeOperation.CascadeRead)] - public List Files { get; set; } + [OneToMany(CascadeOperations = CascadeOperation.All)] + public List Files { get; set; } public bool Protected { get; set; } } diff --git a/osu.Game/Database/DatabaseBackedStore.cs b/osu.Game/Database/DatabaseBackedStore.cs index bb61fc1870..5214372a8b 100644 --- a/osu.Game/Database/DatabaseBackedStore.cs +++ b/osu.Game/Database/DatabaseBackedStore.cs @@ -101,7 +101,6 @@ namespace osu.Game.Database public void Populate(T item, bool recursive = true) { checkType(item.GetType()); - Connection.GetChildren(item, recursive); } diff --git a/osu.Game/IO/FileInfo.cs b/osu.Game/IO/FileInfo.cs index 6f4c4b26e8..367fd68f7b 100644 --- a/osu.Game/IO/FileInfo.cs +++ b/osu.Game/IO/FileInfo.cs @@ -11,8 +11,6 @@ namespace osu.Game.IO [PrimaryKey, AutoIncrement] public int ID { get; set; } - public string Filename { get; set; } - [Indexed(Unique = true)] public string Hash { get; set; } diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index e8cabafe17..2132037559 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -42,15 +42,11 @@ namespace osu.Game.IO deletePending(); } - public FileInfo Add(Stream data, string filename = null) + public FileInfo Add(Stream data) { string hash = data.ComputeSHA2Hash(); - var info = new FileInfo - { - Filename = filename, - Hash = hash, - }; + var info = new FileInfo { Hash = hash }; var existing = Connection.Table().FirstOrDefault(f => f.Hash == info.Hash); @@ -79,20 +75,32 @@ namespace osu.Game.IO public void Reference(IEnumerable files) { - foreach (var f in files) + Connection.RunInTransaction(() => { - f.ReferenceCount++; - Connection.Update(f); - } + var incrementedFiles = files.GroupBy(f => f.ID).Select(f => + { + var accurateRefCount = Connection.Get(f.First().ID); + accurateRefCount.ReferenceCount += f.Count(); + return accurateRefCount; + }); + + Connection.UpdateAll(incrementedFiles); + }); } public void Dereference(IEnumerable files) { - foreach (var f in files) + Connection.RunInTransaction(() => { - f.ReferenceCount--; - Connection.Update(f); - } + var incrementedFiles = files.GroupBy(f => f.ID).Select(f => + { + var accurateRefCount = Connection.Get(f.First().ID); + accurateRefCount.ReferenceCount -= f.Count(); + return accurateRefCount; + }); + + Connection.UpdateAll(incrementedFiles); + }); } private void deletePending() From 6af0629cc0ea8db5b86018a5d51e3374e531bbe6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 1 Aug 2017 09:37:33 +0900 Subject: [PATCH 125/132] Remove unnecessary newline --- osu.Game/Beatmaps/BeatmapManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 3890abd341..784d440584 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -446,7 +446,6 @@ namespace osu.Game.Beatmaps public void ImportFromStable() { - string stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!", "Songs"); if (!Directory.Exists(stableInstallPath)) stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu", "Songs"); From ed3e78452e6e01ef7d0a82dbd4687ce259b3932b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 1 Aug 2017 09:38:43 +0900 Subject: [PATCH 126/132] Lock beatmaps for good measure --- osu.Game/Beatmaps/BeatmapManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 784d440584..a23fab5393 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -308,7 +308,10 @@ namespace osu.Game.Beatmaps var hash = hashable.ComputeSHA2Hash(); // check if this beatmap has already been imported and exit early if so. - var beatmapSet = beatmaps.QueryAndPopulate(b => b.Hash == hash).FirstOrDefault(); + BeatmapSetInfo beatmapSet; + lock (beatmaps) + beatmapSet = beatmaps.QueryAndPopulate(b => b.Hash == hash).FirstOrDefault(); + if (beatmapSet != null) { Undelete(beatmapSet); From c060d32765d486f49e7ac9b1d02b71c3579809ad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 1 Aug 2017 10:08:05 +0900 Subject: [PATCH 127/132] Separate out startup tasks to ensure they run after migrations --- osu.Game/Beatmaps/BeatmapStore.cs | 12 ++++++++---- osu.Game/Database/DatabaseBackedStore.cs | 20 ++++++++++++++++++-- osu.Game/IO/FileStore.cs | 4 ++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 102900ae81..d1c33d1151 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -52,7 +52,11 @@ namespace osu.Game.Beatmaps Connection.CreateTable(); Connection.CreateTable(); Connection.CreateTable(); + } + protected override void StartupTasks() + { + base.StartupTasks(); cleanupPendingDeletions(); } @@ -60,12 +64,12 @@ namespace osu.Game.Beatmaps /// Perform migrations between two store versions. /// /// The current store version. This will be zero on a fresh database initialisation. - /// The target version which we are migrating to (equal to the current ). - protected override void PerformMigration(int currentVersion, int newVersion) + /// The target version which we are migrating to (equal to the current ). + protected override void PerformMigration(int currentVersion, int targetVersion) { - base.PerformMigration(currentVersion, newVersion); + base.PerformMigration(currentVersion, targetVersion); - while (currentVersion++ < newVersion) + while (currentVersion++ < targetVersion) { switch (currentVersion) { diff --git a/osu.Game/Database/DatabaseBackedStore.cs b/osu.Game/Database/DatabaseBackedStore.cs index 5214372a8b..ae3409bbcf 100644 --- a/osu.Game/Database/DatabaseBackedStore.cs +++ b/osu.Game/Database/DatabaseBackedStore.cs @@ -51,14 +51,30 @@ namespace osu.Game.Database PerformMigration(reportedVersion.Version, reportedVersion.Version = StoreVersion); Connection.InsertOrReplace(reportedVersion); + + StartupTasks(); } - protected virtual void PerformMigration(int currentVersion, int newVersion) + /// + /// Called when the database version of this store doesn't match the local version. + /// Any manual migration operations should be performed in this. + /// + /// The current store version. This will be zero on a fresh database initialisation. + /// The target version which we are migrating to (equal to the current ). + protected virtual void PerformMigration(int currentVersion, int targetVersion) { } /// - /// Prepare this database for use. + /// Perform any common startup tasks. Runs after and . + /// + protected virtual void StartupTasks() + { + + } + + /// + /// Prepare this database for use. Tables should be created here. /// protected abstract void Prepare(bool reset = false); diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index 2132037559..e35382ea8c 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -38,7 +38,11 @@ namespace osu.Game.IO Connection.DropTable(); Connection.CreateTable(); + } + protected override void StartupTasks() + { + base.StartupTasks(); deletePending(); } From c73e139954e42c03d627b22ef6924ecead8140df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 1 Aug 2017 10:16:48 +0900 Subject: [PATCH 128/132] Add "migration" Also simplify initial migration for BeatmapStore by just nuking everything. --- osu.Game/Beatmaps/BeatmapStore.cs | 13 ++++------- osu.Game/IO/FileStore.cs | 36 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index d1c33d1151..97cfdcf31b 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -21,7 +21,7 @@ namespace osu.Game.Beatmaps /// The current version of this store. Used for migrations (see ). /// The initial version is 1. /// - protected override int StoreVersion => 1; + protected override int StoreVersion => 2; public BeatmapStore(SQLiteConnection connection) : base(connection) @@ -74,14 +74,9 @@ namespace osu.Game.Beatmaps switch (currentVersion) { case 1: - // initialising from a version before we had versioning (or a fresh install). - - // force adding of Protected column (not automatically migrated). - Connection.MigrateTable(); - - // remove all existing beatmaps. - foreach (var b in Connection.GetAllWithChildren(null, true)) - Connection.Delete(b, true); + case 2: + // cannot migrate; breaking underlying changes. + Reset(); break; } } diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index e35382ea8c..94c9697922 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -23,6 +23,8 @@ namespace osu.Game.IO public readonly ResourceStore Store; + protected override int StoreVersion => 2; + public FileStore(SQLiteConnection connection, Storage storage) : base(connection, storage) { Store = new NamespacedResourceStore(new StorageBackedResourceStore(storage), prefix); @@ -35,7 +37,19 @@ namespace osu.Game.IO protected override void Prepare(bool reset = false) { if (reset) + { + try + { + foreach (var f in Query()) + Storage.Delete(Path.Combine(prefix, f.Hash)); + } + catch + { + // we don't want to ever crash as a result of a reset operation. + } + Connection.DropTable(); + } Connection.CreateTable(); } @@ -46,6 +60,28 @@ namespace osu.Game.IO deletePending(); } + /// + /// Perform migrations between two store versions. + /// + /// The current store version. This will be zero on a fresh database initialisation. + /// The target version which we are migrating to (equal to the current ). + protected override void PerformMigration(int currentVersion, int targetVersion) + { + base.PerformMigration(currentVersion, targetVersion); + + while (currentVersion++ < targetVersion) + { + switch (currentVersion) + { + case 1: + case 2: + // cannot migrate; breaking underlying changes. + Reset(); + break; + } + } + } + public FileInfo Add(Stream data) { string hash = data.ComputeSHA2Hash(); From 821f65c381ac2bcb9a41589df3b781285ca3e2fd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 1 Aug 2017 10:20:28 +0900 Subject: [PATCH 129/132] Actually delete files --- osu.Game/IO/FileStore.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index 94c9697922..191c97e272 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -41,7 +41,7 @@ namespace osu.Game.IO try { foreach (var f in Query()) - Storage.Delete(Path.Combine(prefix, f.Hash)); + Storage.Delete(Path.Combine(prefix, f.StoragePath)); } catch { @@ -150,7 +150,7 @@ namespace osu.Game.IO try { Connection.Delete(f); - Storage.Delete(Path.Combine(prefix, f.Hash)); + Storage.Delete(Path.Combine(prefix, f.StoragePath)); } catch (Exception e) { From 9d630e446eec6205e773064a2d2d17a1d5059535 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 1 Aug 2017 10:57:46 +0900 Subject: [PATCH 130/132] Use new storage methods to reset FileStore Guarantees that backing files are cleaned up correctly. Also handles lingering "beatmaps" directory from older builds. --- osu.Game/IO/FileStore.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index 191c97e272..e55af2e23a 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -38,15 +38,12 @@ namespace osu.Game.IO { if (reset) { - try - { - foreach (var f in Query()) - Storage.Delete(Path.Combine(prefix, f.StoragePath)); - } - catch - { - // we don't want to ever crash as a result of a reset operation. - } + // in earlier versions we stored beatmaps as solid archives, but not any more. + if (Storage.ExistsDirectory("beatmaps")) + Storage.DeleteDirectory("beatmaps"); + + if (Storage.ExistsDirectory(prefix)) + Storage.DeleteDirectory(prefix); Connection.DropTable(); } From 9db4caafba5eca07b59a75d803be17e91cdfb16b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 1 Aug 2017 11:05:33 +0900 Subject: [PATCH 131/132] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 5a9ca94fc3..2204764944 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 5a9ca94fc31bc796b45572eb3d0b27b46556c586 +Subproject commit 2204764944ff693e857649253547054cc91764a0 From bb3a8a29eacc2b2643c91d84a41ffad8582c6938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Park=20=28=EB=B0=95=EC=83=81=ED=9D=AC=29?= Date: Tue, 1 Aug 2017 11:31:11 +0900 Subject: [PATCH 132/132] Hide Notification when playing osu Hide Notification Overlay when playing osu --- osu.Game/OsuGame.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4082ed4ecd..a70a7b7d97 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -334,6 +334,7 @@ namespace osu.Game direct.State = Visibility.Hidden; social.State = Visibility.Hidden; userProfile.State = Visibility.Hidden; + notificationOverlay.State = Visibility.Hidden; } else {