From 4045083dcd9b836b31502c68ad39db4884336063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 11 Jul 2017 21:21:58 +0300 Subject: [PATCH 1/5] Update sorting comparers in line with framework changes --- osu-framework | 2 +- .../ReverseDepthFillFlowContainer.cs | 5 +- .../Objects/HitObjectStartTimeComparer.cs | 55 ------------------- .../Rulesets/Timing/DrawableTimingSection.cs | 17 +++++- .../Timing/SpeedAdjustmentCollection.cs | 37 +++++-------- .../Screens/Menu/FlowContainerWithOrigin.cs | 2 +- osu.Game/Screens/Play/HUD/ModDisplay.cs | 2 +- .../Select/Options/BeatmapOptionsOverlay.cs | 2 +- osu.Game/osu.Game.csproj | 1 - 9 files changed, 37 insertions(+), 86 deletions(-) delete mode 100644 osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs diff --git a/osu-framework b/osu-framework index 6f7528255c..40dc967472 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 6f7528255c5d6cde72f1e92de539983bc4bce502 +Subproject commit 40dc96747288fab4ae137e74b0af7452dc8be792 diff --git a/osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs b/osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs index 0b38bf5fe0..781e149078 100644 --- a/osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs +++ b/osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs @@ -8,9 +8,10 @@ using osu.Framework.Graphics.Containers; namespace osu.Game.Graphics.Containers { - public class ReverseDepthFillFlowContainer : FillFlowContainer where T : Drawable + public class ReverseChildIDFillFlowContainer : FillFlowContainer where T : Drawable { - protected override IComparer DepthComparer => new ReverseCreationOrderDepthComparer(); + protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y); + protected override IEnumerable FlowingChildren => base.FlowingChildren.Reverse(); } } diff --git a/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs b/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs deleted file mode 100644 index b089856dcb..0000000000 --- a/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs +++ /dev/null @@ -1,55 +0,0 @@ -// 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.Game.Rulesets.Objects.Drawables; - -namespace osu.Game.Rulesets.Objects -{ - /// - /// Compares two hit objects by their start time, falling back to creation order if their start time is equal. - /// - public class HitObjectStartTimeComparer : Drawable.CreationOrderDepthComparer - { - public override int Compare(Drawable x, Drawable y) - { - var hitObjectX = x as DrawableHitObject; - var hitObjectY = y as DrawableHitObject; - - // If either of the two drawables are not hit objects, fall back to the base comparer - if (hitObjectX?.HitObject == null || hitObjectY?.HitObject == null) - return base.Compare(x, y); - - // Compare by start time - int i = hitObjectX.HitObject.StartTime.CompareTo(hitObjectY.HitObject.StartTime); - if (i != 0) - return i; - - return base.Compare(x, y); - } - } - - /// - /// Compares two hit objects by their start time, falling back to creation order if their start time is equal. - /// This will compare the two hit objects in reverse order. - /// - public class HitObjectReverseStartTimeComparer : Drawable.ReverseCreationOrderDepthComparer - { - public override int Compare(Drawable x, Drawable y) - { - var hitObjectX = x as DrawableHitObject; - var hitObjectY = y as DrawableHitObject; - - // If either of the two drawables are not hit objects, fall back to the base comparer - if (hitObjectX?.HitObject == null || hitObjectY?.HitObject == null) - return base.Compare(x, y); - - // Compare by start time - int i = hitObjectY.HitObject.StartTime.CompareTo(hitObjectX.HitObject.StartTime); - if (i != 0) - return i; - - return base.Compare(x, y); - } - } -} \ No newline at end of file diff --git a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs index 589ee9991d..74ff721d50 100644 --- a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs +++ b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs @@ -55,7 +55,22 @@ namespace osu.Game.Rulesets.Timing /// internal MultiplierControlPoint ControlPoint; - protected override IComparer DepthComparer => new HitObjectReverseStartTimeComparer(); + protected override int Compare(Drawable x, Drawable y) + { + var xHitObject = x as DrawableHitObject; + var yHitObject = y as DrawableHitObject; + + // If either of the two drawables are not hit objects, fall back to the base comparer + if (xHitObject?.HitObject == null || yHitObject?.HitObject == null) + return base.Compare(x, y); + + // Compare by start time + int i = yHitObject.HitObject.StartTime.CompareTo(xHitObject.HitObject.StartTime); + if (i != 0) + return i; + + return base.Compare(x, y); + } /// /// Creates a new . diff --git a/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs b/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs index 1323bb14a1..22213be740 100644 --- a/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs +++ b/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs @@ -33,7 +33,20 @@ namespace osu.Game.Rulesets.Timing set { visibleTimeRange.BindTo(value); } } - protected override IComparer DepthComparer => new SpeedAdjustmentContainerReverseStartTimeComparer(); + protected override int Compare(Drawable x, Drawable y) + { + var xSpeedAdjust = x as SpeedAdjustmentContainer; + var ySpeedAdjust = y as SpeedAdjustmentContainer; + + // If either of the two drawables are not hit objects, fall back to the base comparer + if (xSpeedAdjust?.ControlPoint == null || ySpeedAdjust?.ControlPoint == null) + return CompareReverseChildID(x, y); + + // Compare by start time + int i = ySpeedAdjust.ControlPoint.StartTime.CompareTo(xSpeedAdjust.ControlPoint.StartTime); + + return i != 0 ? i : CompareReverseChildID(x, y); + } /// /// Hit objects that are to be re-processed on the next update. @@ -116,27 +129,5 @@ namespace osu.Game.Rulesets.Timing /// The time to find the active at. /// The active at . Null if there are no speed adjustments. private SpeedAdjustmentContainer adjustmentContainerAt(double time) => Children.FirstOrDefault(c => c.CanContain(time)) ?? Children.LastOrDefault(); - - /// - /// Compares two speed adjustment containers by their control point start time, falling back to creation order - // if their control point start time is equal. This will compare the two speed adjustment containers in reverse order. - /// - private class SpeedAdjustmentContainerReverseStartTimeComparer : ReverseCreationOrderDepthComparer - { - public override int Compare(Drawable x, Drawable y) - { - var speedAdjustmentX = x as SpeedAdjustmentContainer; - var speedAdjustmentY = y as SpeedAdjustmentContainer; - - // If either of the two drawables are not hit objects, fall back to the base comparer - if (speedAdjustmentX?.ControlPoint == null || speedAdjustmentY?.ControlPoint == null) - return base.Compare(x, y); - - // Compare by start time - int i = speedAdjustmentY.ControlPoint.StartTime.CompareTo(speedAdjustmentX.ControlPoint.StartTime); - - return i != 0 ? i : base.Compare(x, y); - } - } } } diff --git a/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs b/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs index d0972ea84b..071de99209 100644 --- a/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs +++ b/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Menu /// public Drawable CentreTarget; - protected override IComparer DepthComparer => new ReverseCreationOrderDepthComparer(); + protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y); protected override IEnumerable FlowingChildren => base.FlowingChildren.Reverse(); diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 921accf6ac..4cbea43ac5 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Play.HUD { Children = new Drawable[] { - iconsContainer = new ReverseDepthFillFlowContainer + iconsContainer = new ReverseChildIDFillFlowContainer { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index f18080d6f5..6345807ea3 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Select.Options Scale = new Vector2(1, 0), Colour = Color4.Black.Opacity(0.5f), }, - buttonsContainer = new ReverseDepthFillFlowContainer + buttonsContainer = new ReverseChildIDFillFlowContainer { Height = height, RelativePositionAxes = Axes.X, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 06d4da663e..0b5bab2b45 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -190,7 +190,6 @@ - From 9d523ea012625f98484bb61b2e4cd671b8ec1aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 11 Jul 2017 16:58:06 +0300 Subject: [PATCH 2/5] Update framework --- osu-framework | 2 +- .../Tests/TestCaseGamefield.cs | 2 +- .../Tests/TestCaseScoreCounter.cs | 12 +++++----- .../Tests/TestCaseScrollingHitObjects.cs | 2 +- osu.Desktop/Overlays/VersionManager.cs | 2 +- .../Objects/Drawables/DrawableHoldNote.cs | 2 +- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 +- .../Objects/Drawables/Pieces/CirclePiece.cs | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 2 +- .../Graphics/Containers/SectionsContainer.cs | 2 +- osu.Game/Graphics/UserInterface/BarGraph.cs | 2 +- osu.Game/Graphics/UserInterface/OsuButton.cs | 2 +- .../Graphics/UserInterface/SearchTextBox.cs | 2 +- .../Graphics/UserInterface/StarCounter.cs | 22 +++++++++---------- osu.Game/OsuGame.cs | 2 +- osu.Game/Overlays/Chat/DrawableChannel.cs | 2 +- osu.Game/Overlays/Mods/ModButton.cs | 2 +- .../Overlays/Notifications/Notification.cs | 2 +- .../Notifications/NotificationSection.cs | 2 +- .../Notifications/SimpleNotification.cs | 2 +- osu.Game/Overlays/Settings/SettingsSection.cs | 2 +- .../Overlays/Settings/SettingsSubsection.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 4 ++-- osu.Game/Screens/Play/KeyCounter.cs | 16 +++++++------- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Ranking/ResultsPage.cs | 2 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 9 ++------ osu.Game/Screens/Select/BeatmapDetailArea.cs | 4 ++-- 29 files changed, 54 insertions(+), 59 deletions(-) diff --git a/osu-framework b/osu-framework index 6f7528255c..46a56e0e11 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 6f7528255c5d6cde72f1e92de539983bc4bce502 +Subproject commit 46a56e0e11d56c788ff8db089582718a606ed158 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index 00d7e8b5c8..0c5f21a185 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -76,7 +76,7 @@ namespace osu.Desktop.VisualTests.Tests ControlPointInfo = controlPointInfo }); - Add(new Drawable[] + AddRange(new Drawable[] { new Container { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index e8fc2956b4..fc29e8481e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -50,7 +50,7 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Position = new Vector2(20, -160), - Count = 5, + CountStars = 5, }; Add(stars); @@ -59,7 +59,7 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Position = new Vector2(20, -190), - Text = stars.Count.ToString("0.00"), + Text = stars.CountStars.ToString("0.00"), }; Add(starsLabel); @@ -69,8 +69,8 @@ namespace osu.Desktop.VisualTests.Tests comboCounter.Current.Value = 0; numerator = denominator = 0; accuracyCounter.SetFraction(0, 0); - stars.Count = 0; - starsLabel.Text = stars.Count.ToString("0.00"); + stars.CountStars = 0; + starsLabel.Text = stars.CountStars.ToString("0.00"); }); AddStep(@"Hit! :D", delegate @@ -91,8 +91,8 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"Alter stars", delegate { - stars.Count = RNG.NextSingle() * (stars.StarCount + 1); - starsLabel.Text = stars.Count.ToString("0.00"); + stars.CountStars = RNG.NextSingle() * (stars.StarCount + 1); + starsLabel.Text = stars.CountStars.ToString("0.00"); }); AddStep(@"Stop counters", delegate diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index 9f439fe193..8e5cf8687c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -55,7 +55,7 @@ namespace osu.Desktop.VisualTests.Tests timeRangeBindable.ValueChanged += v => timeRangeText.Text = $"Visible Range: {v:#,#.#}"; timeRangeBindable.ValueChanged += v => bottomLabel.Text = $"t minus {v:#,#}"; - Add(new Drawable[] + AddRange(new Drawable[] { new Container { diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 9182f925e1..0a10a60dca 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -202,7 +202,7 @@ namespace osu.Desktop.Overlays { this.game = game; - IconContent.Add(new Drawable[] + IconContent.AddRange(new Drawable[] { new Box { diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index e52fb1362f..17b0b0a607 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables RelativeSizeAxes = Axes.Both; Height = (float)HitObject.Duration; - Add(new Drawable[] + AddRange(new Drawable[] { // For now the body piece covers the entire height of the container // whereas possibly in the future we don't want to extend under the head/tail. diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 53eedea073..e80ac933c8 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.UI Anchor = Anchor.Centre; Origin = Anchor.Centre; - Add(new Drawable[] + AddRange(new Drawable[] { connectionLayer = new FollowPointRenderer { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 709343d086..3f8249f5a9 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { EarlyActivationMilliseconds = pre_beat_transition_time; - AddInternal(new Drawable[] + AddRangeInternal(new Drawable[] { background = new CircularContainer { diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 0ad7969c78..bb679e5150 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Taiko.UI public TaikoPlayfield() { - AddInternal(new Drawable[] + AddRangeInternal(new Drawable[] { new ScaleFixContainer { diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index f4ac01c0f1..cfa98da3c8 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -140,7 +140,7 @@ namespace osu.Game.Beatmaps.Drawables }, starCounter = new StarCounter { - Count = (float)beatmap.StarDifficulty, + CountStars = (float)beatmap.StarDifficulty, Scale = new Vector2(0.8f), } } diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 5fdb5e869e..1d792f1b78 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -93,7 +93,7 @@ namespace osu.Game.Graphics.Containers sections = value.ToList(); if (sections.Count == 0) return; - sectionsContainer.Add(sections); + sectionsContainer.AddRange(sections); SelectedSection.Value = sections[0]; lastKnownScroll = float.NaN; } diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index e4a471bbba..87b4ab9e40 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -58,7 +58,7 @@ namespace osu.Game.Graphics.UserInterface Direction = Direction, }); //I'm using ToList() here because Where() returns an Enumerable which can change it's elements afterwards - Remove(Children.Where((bar, index) => index >= value.Count()).ToList()); + RemoveRange(Children.Where((bar, index) => index >= value.Count()).ToList()); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 6814308cb4..18156f8e76 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -49,7 +49,7 @@ namespace osu.Game.Graphics.UserInterface Content.Masking = true; Content.CornerRadius = 5; - Add(new Drawable[] + AddRange(new Drawable[] { new Triangles { diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 39db8d8be7..0d852e4276 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -17,7 +17,7 @@ namespace osu.Game.Graphics.UserInterface public SearchTextBox() { Height = 35; - Add(new Drawable[] + AddRange(new Drawable[] { new TextAwesome { diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index 295cdac81d..490ea6e64a 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -33,25 +33,25 @@ namespace osu.Game.Graphics.UserInterface private const float star_size = 20; private const float star_spacing = 4; - private float count; + private float countStars; /// /// Amount of stars represented. /// - public float Count + public float CountStars { get { - return count; + return countStars; } set { - if (count == value) return; + if (countStars == value) return; if (IsLoaded) transformCount(value); - count = value; + countStars = value; } } @@ -94,15 +94,15 @@ namespace osu.Game.Graphics.UserInterface public void ResetCount() { - count = 0; + countStars = 0; StopAnimation(); } public void ReplayAnimation() { - var t = count; + var t = countStars; ResetCount(); - Count = t; + CountStars = t; } public void StopAnimation() @@ -111,8 +111,8 @@ namespace osu.Game.Graphics.UserInterface foreach (var star in stars.Children) { star.ClearTransforms(true); - star.FadeTo(i < count ? 1.0f : minStarAlpha); - star.Icon.ScaleTo(getStarScale(i, count)); + star.FadeTo(i < countStars ? 1.0f : minStarAlpha); + star.Icon.ScaleTo(getStarScale(i, countStars)); i++; } } @@ -132,7 +132,7 @@ namespace osu.Game.Graphics.UserInterface { star.ClearTransforms(true); - var delay = (count <= newValue ? Math.Max(i - count, 0) : Math.Max(count - 1 - i, 0)) * animationDelay; + var delay = (countStars <= newValue ? Math.Max(i - countStars, 0) : Math.Max(countStars - 1 - i, 0)) * animationDelay; using (BeginDelayedSequence(delay, true)) { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7e5b913d10..961e296050 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -141,7 +141,7 @@ namespace osu.Game { base.LoadComplete(); - Add(new Drawable[] { + AddRange(new Drawable[] { new VolumeControlReceptor { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index e8bde11a3c..f8b7c7e581 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Chat var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MAX_HISTORY)); //up to last Channel.MAX_HISTORY messages - flow.Add(displayMessages.Select(m => new ChatLine(m))); + flow.AddRange(displayMessages.Select(m => new ChatLine(m))); if (!IsLoaded) return; diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index a7e7bb53b5..aca73d2828 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -199,7 +199,7 @@ namespace osu.Game.Overlays.Mods iconsContainer.Clear(); if (Mods.Length > 1) { - iconsContainer.Add(new[] + iconsContainer.AddRange(new[] { backgroundIcon = new ModIcon(Mods[1]) { diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 74cced5ee9..f5613d6656 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -49,7 +49,7 @@ namespace osu.Game.Overlays.Notifications RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - AddInternal(new Drawable[] + AddRangeInternal(new Drawable[] { Light = new NotificationLight { diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index b4f35be733..831b09e7e9 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -69,7 +69,7 @@ namespace osu.Game.Overlays.Notifications Left = 20, }; - AddInternal(new Drawable[] + AddRangeInternal(new Drawable[] { new Container { diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index 2ac93b2ada..42604658de 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Notifications public SimpleNotification() { - IconContent.Add(new Drawable[] + IconContent.AddRange(new Drawable[] { IconBackgound = new Box { diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 2e3dc1ada2..77bf87f718 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Settings const int header_size = 26; const int header_margin = 25; const int border_size = 2; - AddInternal(new Drawable[] + AddRangeInternal(new Drawable[] { new Box { diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 14082aa4db..0a9f7ba5d0 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Settings RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; - AddInternal(new Drawable[] + AddRangeInternal(new Drawable[] { new OsuSpriteText { diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index fd87fd1b38..24fee10195 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -114,8 +114,8 @@ namespace osu.Game.Screens.Menu buttonsTopLevel.Add(new Button(@"osu!direct", string.Empty, FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D)); buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), onExit, 0, Key.Q)); - buttonFlow.Add(buttonsPlay); - buttonFlow.Add(buttonsTopLevel); + buttonFlow.AddRange(buttonsPlay); + buttonFlow.AddRange(buttonsTopLevel); } [BackgroundDependencyLoader(true)] diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 20a8f73104..e507055d5f 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -20,15 +20,15 @@ namespace osu.Game.Screens.Play private SpriteText countSpriteText; public bool IsCounting { get; set; } - private int count; - public int Count + private int countPresses; + public int CountPresses { - get { return count; } + get { return countPresses; } private set { - if (count != value) + if (countPresses != value) { - count = value; + countPresses = value; countSpriteText.Text = value.ToString(@"#,0"); } } @@ -45,7 +45,7 @@ namespace osu.Game.Screens.Play isLit = value; updateGlowSprite(value); if (value && IsCounting) - Count++; + CountPresses++; } } } @@ -98,7 +98,7 @@ namespace osu.Game.Screens.Play }, countSpriteText = new OsuSpriteText { - Text = Count.ToString(@"#,0"), + Text = CountPresses.ToString(@"#,0"), Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativePositionAxes = Axes.Both, @@ -128,6 +128,6 @@ namespace osu.Game.Screens.Play } } - public void ResetCount() => Count = 0; + public void ResetCount() => CountPresses = 0; } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d0ffe1de1c..b0d3a99603 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -200,7 +200,7 @@ namespace osu.Game.Screens.Play scoreProcessor = HitRenderer.CreateScoreProcessor(); - hudOverlay.KeyCounter.Add(rulesetInstance.CreateGameplayKeys()); + hudOverlay.KeyCounter.AddRange(rulesetInstance.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor); hudOverlay.BindHitRenderer(HitRenderer); diff --git a/osu.Game/Screens/Ranking/ResultsPage.cs b/osu.Game/Screens/Ranking/ResultsPage.cs index d0a1c49119..59173748ed 100644 --- a/osu.Game/Screens/Ranking/ResultsPage.cs +++ b/osu.Game/Screens/Ranking/ResultsPage.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Ranking [BackgroundDependencyLoader] private void load(OsuColour colours) { - AddInternal(new Drawable[] + AddRangeInternal(new Drawable[] { fill = new Box { diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index f9064c4963..647cac5bbe 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -12,7 +12,6 @@ using osu.Game.Beatmaps.Drawables; using osu.Game.Configuration; using osu.Framework.Input; using OpenTK.Input; -using System.Collections; using osu.Framework.MathUtils; using System.Diagnostics; using System.Threading.Tasks; @@ -22,7 +21,7 @@ using osu.Framework.Configuration; namespace osu.Game.Screens.Select { - internal class BeatmapCarousel : ScrollContainer, IEnumerable + internal class BeatmapCarousel : ScrollContainer { public BeatmapInfo SelectedBeatmap => selectedPanel?.Beatmap; @@ -265,10 +264,6 @@ namespace osu.Game.Screens.Select perform(); } - public IEnumerator GetEnumerator() => groups.GetEnumerator(); - - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - private BeatmapGroup createGroup(BeatmapSetInfo beatmapSet) { foreach (var b in beatmapSet.Beatmaps) @@ -307,7 +302,7 @@ namespace osu.Game.Screens.Select panels.Remove(p); scrollableContent.Remove(group.Header); - scrollableContent.Remove(group.BeatmapPanels); + scrollableContent.RemoveRange(group.BeatmapPanels); if (selectedGroup == group) SelectNext(); diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index d116e5b159..47d25585ad 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Select public BeatmapDetailArea() { - AddInternal(new Drawable[] + AddRangeInternal(new Drawable[] { new BeatmapDetailAreaTabControl { @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select }, }); - Add(new Drawable[] + AddRange(new Drawable[] { Details = new BeatmapDetails { From 6209f193e39490689f9e7ab84fd2af1fc4ffe899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 11 Jul 2017 21:21:58 +0300 Subject: [PATCH 3/5] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 40dc967472..38363de3d4 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 40dc96747288fab4ae137e74b0af7452dc8be792 +Subproject commit 38363de3d466c60d668159745826df239318f875 From c8c1dcae2853be5ad65b86d8de30aad19c943458 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jul 2017 12:55:40 +0900 Subject: [PATCH 4/5] Fix incorrect filename --- ...hFillFlowContainer.cs => ReverseChildIDFillFlowContainer.cs} | 0 osu.Game/osu.Game.csproj | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename osu.Game/Graphics/Containers/{ReverseDepthFillFlowContainer.cs => ReverseChildIDFillFlowContainer.cs} (100%) diff --git a/osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs b/osu.Game/Graphics/Containers/ReverseChildIDFillFlowContainer.cs similarity index 100% rename from osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs rename to osu.Game/Graphics/Containers/ReverseChildIDFillFlowContainer.cs diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0b5bab2b45..3d84f287f0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -475,7 +475,7 @@ - + From e1e7cb71781ef3a97b2a9eafcbb98049207f3805 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jul 2017 12:55:52 +0900 Subject: [PATCH 5/5] Remove unnecessary using statements --- osu.Game/Rulesets/Timing/DrawableTimingSection.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs index 74ff721d50..6345a566c2 100644 --- a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs +++ b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs @@ -1,13 +1,11 @@ // 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.Linq; using osu.Framework.Caching; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; using osu.Game.Rulesets.Objects.Types;