From a42c67ee9787f0336b8a2f40d27e0217c488c56c Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 1 Jun 2017 20:54:42 +0300 Subject: [PATCH 01/75] Cancel beatmap random selection --- osu.Game/Screens/Select/BeatmapCarousel.cs | 42 ++++++++++++++++++++-- osu.Game/Screens/Select/Footer.cs | 4 ++- osu.Game/Screens/Select/FooterButton.cs | 16 +++++++-- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 9 ++++- 5 files changed, 65 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 26820fc388..07f6a7e5fd 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -77,8 +77,9 @@ namespace osu.Game.Screens.Select private readonly List panels = new List(); - private BeatmapGroup selectedGroup; + private readonly Stack randomSelectedBeatmaps = new Stack(); + private BeatmapGroup selectedGroup; private BeatmapPanel selectedPanel; public BeatmapCarousel() @@ -172,14 +173,17 @@ namespace osu.Game.Screens.Select public void SelectRandom() { - IEnumerable visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden); + randomSelectedBeatmaps.Push(selectedGroup); + + var visibleGroups = getVisibleGroups(); if (!visibleGroups.Any()) return; BeatmapGroup group; + if (randomType == SelectionRandomType.RandomPermutation) { - IEnumerable notSeenGroups = visibleGroups.Except(seenGroups); + var notSeenGroups = visibleGroups.Except(seenGroups); if (!notSeenGroups.Any()) { seenGroups.Clear(); @@ -197,6 +201,38 @@ namespace osu.Game.Screens.Select selectGroup(group, panel); } + public void CancelRandom() + { + if (!randomSelectedBeatmaps.Any()) + return; + + var visibleGroups = getVisibleGroups(); + if (!visibleGroups.Any()) + return; + + // we can avoid selecting deleted beatmaps or beatmaps selected in another gamemode + while (true) + { + if (!randomSelectedBeatmaps.Any()) break; + + if (!visibleGroups.Contains(randomSelectedBeatmaps.FirstOrDefault())) + { + randomSelectedBeatmaps.Pop(); + } + else + { + BeatmapGroup beatmapGroup = randomSelectedBeatmaps.Pop(); + selectGroup(beatmapGroup, beatmapGroup.SelectedPanel); + break; + } + } + } + + private IEnumerable getVisibleGroups() + { + return groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden); + } + private FilterCriteria criteria = new FilterCriteria(); private ScheduledDelegate filterTask; diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 32e09a5f28..0aa86f4d0d 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -38,12 +38,13 @@ namespace osu.Game.Screens.Select /// Text on the button. /// Colour of the button. /// Hotkey of the button. + /// Forbid you to use hotkey with shift pressed. /// Action the button does. /// /// 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, bool excludePressWithShift = false, float depth = 0) { var button = new FooterButton { @@ -54,6 +55,7 @@ namespace osu.Game.Screens.Select SelectedColour = colour, DeselectedColour = colour.Opacity(0.5f), Hotkey = hotkey, + ExcludePressWithShift = excludePressWithShift, }; button.Hovered = () => updateModeLight(button); diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 58df409ca1..98a0b41543 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -84,6 +84,7 @@ namespace osu.Game.Screens.Select public Action Hovered; public Action HoverLost; public Key? Hotkey; + public bool ExcludePressWithShift; protected override bool OnHover(InputState state) { @@ -124,8 +125,19 @@ namespace osu.Game.Screens.Select { if (!args.Repeat && args.Key == Hotkey) { - OnClick(state); - return true; + if (ExcludePressWithShift) + { + if (!state.Keyboard.ShiftPressed) + { + OnClick(state); + return true; + } + } + else + { + OnClick(state); + return true; + } } return base.OnKeyDown(state, args); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index f96fbb87cb..0903184b40 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colours) { - Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, float.MaxValue); + Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, false, float.MaxValue); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 41fa53e8a3..1451d2e4fd 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -158,7 +158,7 @@ namespace osu.Game.Screens.Select { if (Footer != null) { - Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2); + Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2, true); Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3); BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue); @@ -381,6 +381,13 @@ namespace osu.Game.Screens.Select return true; } break; + case Key.F2: + if (state.Keyboard.ShiftPressed) + { + carousel.CancelRandom(); + return true; + } + break; } return base.OnKeyDown(state, args); From 78500eec21b8039ef5b5959a885c26dca55738ef Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 5 Jun 2017 12:24:28 +0300 Subject: [PATCH 02/75] Applied suggested changes --- osu.Game/Screens/Select/BeatmapCarousel.cs | 19 ++++++------------- osu.Game/Screens/Select/Footer.cs | 4 +--- osu.Game/Screens/Select/FooterButton.cs | 16 ++-------------- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 19 +++++++++---------- 5 files changed, 19 insertions(+), 41 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 07f6a7e5fd..88c57853df 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -171,7 +171,7 @@ namespace osu.Game.Screens.Select } while (index != startIndex); } - public void SelectRandom() + public void SelectNextRandom() { randomSelectedBeatmaps.Push(selectedGroup); @@ -201,7 +201,7 @@ namespace osu.Game.Screens.Select selectGroup(group, panel); } - public void CancelRandom() + public void SelectPreviousRandom() { if (!randomSelectedBeatmaps.Any()) return; @@ -210,19 +210,12 @@ namespace osu.Game.Screens.Select if (!visibleGroups.Any()) return; - // we can avoid selecting deleted beatmaps or beatmaps selected in another gamemode - while (true) + while (randomSelectedBeatmaps.Any()) { - if (!randomSelectedBeatmaps.Any()) break; - - if (!visibleGroups.Contains(randomSelectedBeatmaps.FirstOrDefault())) + var group = randomSelectedBeatmaps.Pop(); + if (visibleGroups.Contains(group)) { - randomSelectedBeatmaps.Pop(); - } - else - { - BeatmapGroup beatmapGroup = randomSelectedBeatmaps.Pop(); - selectGroup(beatmapGroup, beatmapGroup.SelectedPanel); + selectGroup(group, group.SelectedPanel); break; } } diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 0aa86f4d0d..32e09a5f28 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -38,13 +38,12 @@ namespace osu.Game.Screens.Select /// Text on the button. /// Colour of the button. /// Hotkey of the button. - /// Forbid you to use hotkey with shift pressed. /// Action the button does. /// /// 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, bool excludePressWithShift = false, float depth = 0) + public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, float depth = 0) { var button = new FooterButton { @@ -55,7 +54,6 @@ namespace osu.Game.Screens.Select SelectedColour = colour, DeselectedColour = colour.Opacity(0.5f), Hotkey = hotkey, - ExcludePressWithShift = excludePressWithShift, }; button.Hovered = () => updateModeLight(button); diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 98a0b41543..58df409ca1 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -84,7 +84,6 @@ namespace osu.Game.Screens.Select public Action Hovered; public Action HoverLost; public Key? Hotkey; - public bool ExcludePressWithShift; protected override bool OnHover(InputState state) { @@ -125,19 +124,8 @@ namespace osu.Game.Screens.Select { if (!args.Repeat && args.Key == Hotkey) { - if (ExcludePressWithShift) - { - if (!state.Keyboard.ShiftPressed) - { - OnClick(state); - return true; - } - } - else - { - OnClick(state); - return true; - } + OnClick(state); + return true; } return base.OnKeyDown(state, args); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 0903184b40..f96fbb87cb 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colours) { - Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, false, float.MaxValue); + Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, float.MaxValue); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 1451d2e4fd..5e6eaadff5 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -154,11 +154,11 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours) + private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, UserInputManager input) { if (Footer != null) { - Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2, true); + Footer.AddButton(@"random", colours.Green, () => triggerRandom(input), Key.F2); Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3); BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue); @@ -209,7 +209,13 @@ namespace osu.Game.Screens.Select OnSelected(); } - public void SelectRandom() => carousel.SelectRandom(); + private void triggerRandom(UserInputManager input) + { + if (input.CurrentState.Keyboard.ShiftPressed) + carousel.SelectPreviousRandom(); + else + carousel.SelectNextRandom(); + } protected abstract void OnSelected(); @@ -381,13 +387,6 @@ namespace osu.Game.Screens.Select return true; } break; - case Key.F2: - if (state.Keyboard.ShiftPressed) - { - carousel.CancelRandom(); - return true; - } - break; } return base.OnKeyDown(state, args); From e552c39444c3439f2120d9ba1e5289f71c812902 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sun, 11 Jun 2017 22:04:35 +0300 Subject: [PATCH 03/75] change function to a property --- osu.Game/Screens/Select/BeatmapCarousel.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index a268096435..05fb4c48bf 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -171,6 +171,8 @@ namespace osu.Game.Screens.Select } while (index != startIndex); } + private IEnumerable getVisibleGroups() => groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden); + public void SelectNextRandom() { randomSelectedBeatmaps.Push(selectedGroup); @@ -221,11 +223,6 @@ namespace osu.Game.Screens.Select } } - private IEnumerable getVisibleGroups() - { - return groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden); - } - private FilterCriteria criteria = new FilterCriteria(); private ScheduledDelegate filterTask; From 5117baae66e0707a2d861f733b420879727ad1ea Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 15 Jun 2017 06:37:20 +0300 Subject: [PATCH 04/75] Make random works with panels too --- osu.Game/Screens/Select/BeatmapCarousel.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 05fb4c48bf..f9064c4963 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Select private readonly List panels = new List(); - private readonly Stack randomSelectedBeatmaps = new Stack(); + private readonly Stack> randomSelectedBeatmaps = new Stack>(); private BeatmapGroup selectedGroup; private BeatmapPanel selectedPanel; @@ -175,7 +175,7 @@ namespace osu.Game.Screens.Select public void SelectNextRandom() { - randomSelectedBeatmaps.Push(selectedGroup); + randomSelectedBeatmaps.Push(new KeyValuePair(selectedGroup, selectedGroup.SelectedPanel)); var visibleGroups = getVisibleGroups(); if (!visibleGroups.Any()) @@ -214,10 +214,11 @@ namespace osu.Game.Screens.Select while (randomSelectedBeatmaps.Any()) { - var group = randomSelectedBeatmaps.Pop(); + var beatmapCoordinates = randomSelectedBeatmaps.Pop(); + var group = beatmapCoordinates.Key; if (visibleGroups.Contains(group)) { - selectGroup(group, group.SelectedPanel); + selectGroup(group, beatmapCoordinates.Value); break; } } From b020fe0d50c82a2eb2d38ff716c4546e90532417 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 08:36:47 +0300 Subject: [PATCH 05/75] Added TestCase --- .../Tests/TestCaseBeatSyncedContainer.cs | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs new file mode 100644 index 0000000000..a8fa8bf218 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -0,0 +1,186 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Framework.Graphics; +using osu.Framework.Timing; +using osu.Game.Overlays; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Containers; +using osu.Framework.Audio.Track; +using osu.Game.Beatmaps.ControlPoints; +using osu.Framework.Graphics.Shapes; +using OpenTK.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Framework.Lists; +using System; +using System.Globalization; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseBeatSyncedContainer : TestCase + { + public override string Description => @"Tests beat synced containers."; + + private MusicController mc; + + public TestCaseBeatSyncedContainer() + { + Clock = new FramedClock(); + } + + public override void Reset() + { + base.Reset(); + Clock.ProcessFrame(); + + Add(new BeatContainer + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }); + + Add(mc = new MusicController + { + Origin = Anchor.TopRight, + Anchor = Anchor.TopRight, + }); + mc.State = Visibility.Visible; + } + + private class BeatContainer : BeatSyncedContainer + { + private const int flash_layer_heigth = 150; + + private readonly InfoString timingPointCount; + private readonly InfoString currentTimingPoint; + private readonly InfoString beatCount; + private readonly InfoString currentBeat; + private readonly InfoString beatsPerMinute; + private readonly InfoString beatLength; + + private readonly Box flashLayer; + + public BeatContainer() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Children = new Drawable[] + { + new FillFlowContainer + { + Name = @"Info Layer", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Bottom = flash_layer_heigth, }, + Children = new Drawable[] + { + timingPointCount = new InfoString(@"Timing points amount: "), + currentTimingPoint = new InfoString(@"Current timing point: "), + beatCount = new InfoString(@"Beats amount (in the current timing point): "), + currentBeat = new InfoString(@"Current beat: "), + beatsPerMinute = new InfoString(@"BPM: "), + beatLength = new InfoString(@"Beat length: "), + } + }, + new Container + { + Name = @"Color indicator", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = flash_layer_heigth, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + flashLayer = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + Alpha = 0, + } + } + } + }; + + Beatmap.ValueChanged += delegate + { + timingPointCount.Value = 0; + currentTimingPoint.Value = 0; + beatCount.Value = 0; + currentBeat.Value = 0; + beatsPerMinute.Value = 0; + beatLength.Value = 0; + }; + } + + private SortedList timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints; + private TimingControlPoint getNextTimingPoint(TimingControlPoint current) + { + if (timingPoints[timingPoints.Count - 1] == current) + return current; + + return timingPoints[timingPoints.IndexOf(current) + 1]; + } + + private int calculateBeatCount(TimingControlPoint current) + { + if (timingPoints.IndexOf(current) + 1 == timingPoints.Count) + return (int)Math.Ceiling((Beatmap.Value.Track.Length - current.Time) / current.BeatLength); + + return (int)Math.Ceiling((getNextTimingPoint(current).Time - current.Time) / current.BeatLength); + } + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + + timingPointCount.Value = timingPoints.Count; + currentTimingPoint.Value = timingPoints.IndexOf(timingPoint) + 1; + beatCount.Value = calculateBeatCount(timingPoint); + currentBeat.Value = beatIndex + 1; + beatsPerMinute.Value = (float)Math.Round(60000 / timingPoint.BeatLength, 1); + beatLength.Value = (float)timingPoint.BeatLength; + + flashLayer.ClearTransforms(); + flashLayer.FadeTo(1); + flashLayer.FadeTo(0, timingPoint.BeatLength); + } + } + + private class InfoString : FillFlowContainer + { + private const int text_size = 20; + private const int margin = 7; + + private readonly OsuSpriteText valueText; + + private float? value; + public float Value + { + set + { + if (value == this.value) return; + this.value = value; + + valueText.Text = value.ToString(CultureInfo.CurrentCulture); + } + } + + public InfoString(string header) + { + AutoSizeAxes = Axes.Both; + Direction = FillDirection.Horizontal; + Add(new OsuSpriteText { Text = header, TextSize = text_size }); + Add(valueText = new OsuSpriteText() { TextSize = text_size }); + Margin = new MarginPadding { Vertical = margin, }; + } + } + } +} From 608f3fe8c5d5744da212d552f7e755d5b9494cab Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 08:41:48 +0300 Subject: [PATCH 06/75] oops --- osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index de84e567d2..bd333c4df9 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -187,6 +187,7 @@ + From a59af5b0054a10c2f5f1f2b89bccaf37c56b8fa6 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 10:01:28 +0300 Subject: [PATCH 07/75] Applied suggested changes --- .../Tests/TestCaseBeatSyncedContainer.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index a8fa8bf218..d70e60cd93 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -57,7 +57,7 @@ namespace osu.Desktop.VisualTests.Tests private readonly InfoString beatCount; private readonly InfoString currentBeat; private readonly InfoString beatsPerMinute; - private readonly InfoString beatLength; + private readonly InfoString adjustedBeatLength; private readonly Box flashLayer; @@ -77,12 +77,12 @@ namespace osu.Desktop.VisualTests.Tests Margin = new MarginPadding { Bottom = flash_layer_heigth, }, Children = new Drawable[] { - timingPointCount = new InfoString(@"Timing points amount: "), - currentTimingPoint = new InfoString(@"Current timing point: "), - beatCount = new InfoString(@"Beats amount (in the current timing point): "), - currentBeat = new InfoString(@"Current beat: "), - beatsPerMinute = new InfoString(@"BPM: "), - beatLength = new InfoString(@"Beat length: "), + timingPointCount = new InfoString(@"Timing points amount"), + currentTimingPoint = new InfoString(@"Current timing point"), + beatCount = new InfoString(@"Beats amount (in the current timing point)"), + currentBeat = new InfoString(@"Current beat"), + beatsPerMinute = new InfoString(@"BPM"), + adjustedBeatLength = new InfoString(@"Beat length"), } }, new Container @@ -116,7 +116,7 @@ namespace osu.Desktop.VisualTests.Tests beatCount.Value = 0; currentBeat.Value = 0; beatsPerMinute.Value = 0; - beatLength.Value = 0; + adjustedBeatLength.Value = 0; }; } @@ -146,7 +146,7 @@ namespace osu.Desktop.VisualTests.Tests beatCount.Value = calculateBeatCount(timingPoint); currentBeat.Value = beatIndex + 1; beatsPerMinute.Value = (float)Math.Round(60000 / timingPoint.BeatLength, 1); - beatLength.Value = (float)timingPoint.BeatLength; + adjustedBeatLength.Value = (float)timingPoint.BeatLength; flashLayer.ClearTransforms(); flashLayer.FadeTo(1); @@ -177,7 +177,7 @@ namespace osu.Desktop.VisualTests.Tests { AutoSizeAxes = Axes.Both; Direction = FillDirection.Horizontal; - Add(new OsuSpriteText { Text = header, TextSize = text_size }); + Add(new OsuSpriteText { Text = header + @": ", TextSize = text_size }); Add(valueText = new OsuSpriteText() { TextSize = text_size }); Margin = new MarginPadding { Vertical = margin, }; } From 3150bdb54b75d33b76a98f92dd1dd8fed63ee7ba Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 14:56:43 +0300 Subject: [PATCH 08/75] Fixed wrong display string --- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index d70e60cd93..c0d2b04bcb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -82,7 +82,7 @@ namespace osu.Desktop.VisualTests.Tests beatCount = new InfoString(@"Beats amount (in the current timing point)"), currentBeat = new InfoString(@"Current beat"), beatsPerMinute = new InfoString(@"BPM"), - adjustedBeatLength = new InfoString(@"Beat length"), + adjustedBeatLength = new InfoString(@"Adjusted beat length"), } }, new Container From f5829860a2241a767a5500de9b31637f19dc8554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 23 Jun 2017 18:02:24 +0200 Subject: [PATCH 09/75] Get rid of AlwaysReceiveInput --- osu-framework | 2 +- .../Objects/Drawables/DrawableSlider.cs | 4 ---- .../Objects/Drawables/DrawableSpinner.cs | 2 -- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 3 ++- osu.Game/Graphics/Containers/ParallaxContainer.cs | 2 -- osu.Game/Graphics/Cursor/CursorTrail.cs | 3 ++- osu.Game/Graphics/Processing/RatioAdjust.cs | 1 - osu.Game/OsuGameBase.cs | 1 - .../Overlays/SearchableList/SearchableListOverlay.cs | 1 - osu.Game/Overlays/Toolbar/Toolbar.cs | 3 --- osu.Game/Overlays/Toolbar/ToolbarUserArea.cs | 2 -- osu.Game/Rulesets/UI/Playfield.cs | 12 ------------ osu.Game/Screens/Play/KeyCounterCollection.cs | 6 +++--- osu.Game/Screens/Play/KeyCounterMouse.cs | 4 +++- osu.Game/Screens/Play/MenuOverlay.cs | 1 - osu.Game/Screens/Play/SkipButton.cs | 2 -- osu.Game/Screens/Select/FilterControl.cs | 2 -- 17 files changed, 11 insertions(+), 40 deletions(-) diff --git a/osu-framework b/osu-framework index 97ff3376d1..6a81d52ba2 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 97ff3376d1bdac3703d442e62f5ee6a36eb3b73f +Subproject commit 6a81d52ba24c4c4bcd83bf1062143ad93d8f4545 diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index b80f1d7178..395e496b61 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -28,10 +28,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSlider(Slider s) : base(s) { - // Since the DrawableSlider itself is just a container without a size we need to - // pass all input through. - AlwaysReceiveInput = true; - SliderBouncer bouncer1; slider = s; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 3722d13ffc..840acb8221 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -38,8 +38,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSpinner(Spinner s) : base(s) { - AlwaysReceiveInput = true; - Origin = Anchor.Centre; Position = s.Position; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 29d6d1f147..86dfe8e95e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { spinner = s; - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; Children = new Drawable[] @@ -40,6 +39,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + private bool tracking; public bool Tracking { diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 2d5952a3ce..19475b00c9 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -19,8 +19,6 @@ namespace osu.Game.Graphics.Containers public ParallaxContainer() { - AlwaysReceiveInput = true; - RelativeSizeAxes = Axes.Both; AddInternal(content = new Container { diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index 183679fbd3..d3386c2bbf 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -65,7 +65,6 @@ namespace osu.Game.Graphics.Cursor // as we are currently very dependent on having a running clock, let's make our own clock for the time being. Clock = new FramedClock(); - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; for (int i = 0; i < max_sprites; i++) @@ -75,6 +74,8 @@ namespace osu.Game.Graphics.Cursor } } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + [BackgroundDependencyLoader] private void load(ShaderManager shaders, TextureStore textures) { diff --git a/osu.Game/Graphics/Processing/RatioAdjust.cs b/osu.Game/Graphics/Processing/RatioAdjust.cs index dd039d5144..640814d8e1 100644 --- a/osu.Game/Graphics/Processing/RatioAdjust.cs +++ b/osu.Game/Graphics/Processing/RatioAdjust.cs @@ -12,7 +12,6 @@ namespace osu.Game.Graphics.Processing { public RatioAdjust() { - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 306cdaddf0..5e73ea55e6 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -152,7 +152,6 @@ namespace osu.Game { new Container { - AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, Depth = float.MinValue, Children = new Drawable[] diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 05ee38153d..25f6b4f60b 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -82,7 +82,6 @@ namespace osu.Game.Overlays.SearchableList RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - AlwaysReceiveInput = true, Children = new Drawable[] { Header = CreateHeader(), diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 16e4f22ec8..a7e5f8dcc4 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -33,8 +33,6 @@ namespace osu.Game.Overlays.Toolbar public Toolbar() { - AlwaysReceiveInput = true; - Children = new Drawable[] { new ToolbarBackground(), @@ -55,7 +53,6 @@ namespace osu.Game.Overlays.Toolbar }, new FillFlowContainer { - AlwaysReceiveInput = true, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Direction = FillDirection.Horizontal, diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs index 1928c0fc1f..c1fd234628 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs @@ -17,8 +17,6 @@ namespace osu.Game.Overlays.Toolbar public ToolbarUserArea() { - AlwaysReceiveInput = true; - RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 612569a9ae..ff321a18a5 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -37,8 +37,6 @@ namespace osu.Game.Rulesets.UI /// Whether we want our internal coordinate system to be scaled to a specified width. protected Playfield(float? customWidth = null) { - AlwaysReceiveInput = true; - // Default height since we force relative size axes Size = Vector2.One; @@ -50,7 +48,6 @@ namespace osu.Game.Rulesets.UI { content = new Container { - AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, } } @@ -100,19 +97,10 @@ namespace osu.Game.Rulesets.UI //dividing by the customwidth will effectively scale our content to the required container size. protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale; - - public ScaledContainer() - { - AlwaysReceiveInput = true; - } } public class HitObjectContainer : Container where U : Drawable { - public HitObjectContainer() - { - AlwaysReceiveInput = true; - } } } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 25cbfc14b7..8d70a0f1a9 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -9,6 +9,7 @@ using osu.Framework.Input; using osu.Framework.Configuration; using osu.Framework.Allocation; using osu.Game.Configuration; +using OpenTK; namespace osu.Game.Screens.Play { @@ -20,8 +21,6 @@ namespace osu.Game.Screens.Play public KeyCounterCollection() { - AlwaysReceiveInput = true; - Direction = FillDirection.Horizontal; AutoSizeAxes = Axes.Both; } @@ -124,11 +123,12 @@ namespace osu.Game.Screens.Play public Receptor(KeyCounterCollection target) { - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; this.target = target; } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool HandleInput => true; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerOnKeyDown(state, args)); diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 744cb905d9..49d669aef9 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -3,6 +3,7 @@ using osu.Framework.Input; using OpenTK.Input; +using OpenTK; namespace osu.Game.Screens.Play { @@ -12,10 +13,11 @@ namespace osu.Game.Screens.Play public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button)) { - AlwaysReceiveInput = true; Button = button; } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + private static string getStringRepresentation(MouseButton button) { switch (button) diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index 1d557269c4..adfa1a736b 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -186,7 +186,6 @@ namespace osu.Game.Screens.Play protected MenuOverlay() { - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index d110f8ecac..b38a9b4934 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -34,8 +34,6 @@ namespace osu.Game.Screens.Play public SkipButton(double startTime) { - AlwaysReceiveInput = true; - this.startTime = startTime; RelativePositionAxes = Axes.Both; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 51937df189..531c78c17e 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -82,7 +82,6 @@ namespace osu.Game.Screens.Select new Container { Padding = new MarginPadding(20), - AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, Width = 0.5f, Anchor = Anchor.TopRight, @@ -109,7 +108,6 @@ namespace osu.Game.Screens.Select Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - AlwaysReceiveInput = true, Children = new Drawable[] { groupTabs = new OsuTabControl From 817d2c3da1996fdc816a15b9329097c282b4e6e0 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 23:57:57 +0300 Subject: [PATCH 10/75] Fixed logo heartbeat playing even without beating --- osu.Game/Screens/Menu/OsuLogo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 78bcbc5c63..12b6b994d0 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -227,9 +227,6 @@ namespace osu.Game.Screens.Menu { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); - if (Hovering) - sampleBeat.Play(); - lastBeatIndex = beatIndex; var beatLength = timingPoint.BeatLength; @@ -238,6 +235,9 @@ namespace osu.Game.Screens.Menu if (beatIndex < 0) return; + if (Hovering) + sampleBeat.Play(); + logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, beat_in_time, EasingTypes.Out); using (logoBeatContainer.BeginDelayedSequence(beat_in_time)) logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); From e3489928b788e26ee7228f27f16d69291f3507c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 24 Jun 2017 09:21:08 +0200 Subject: [PATCH 11/75] Remove now obsolete InternalContains --- osu-framework | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game/Graphics/Cursor/CursorTrail.cs | 2 +- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 2 +- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 2 +- osu.Game/Screens/Menu/OsuLogo.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 2 +- osu.Game/Screens/Play/KeyCounterMouse.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 2 +- osu.Game/Screens/Select/Footer.cs | 2 +- osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/osu-framework b/osu-framework index 6a81d52ba2..f832f77c04 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 6a81d52ba24c4c4bcd83bf1062143ad93d8f4545 +Subproject commit f832f77c04dd2c64063763a4283831ff95854aab diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 86dfe8e95e..234aa8d055 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } - protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool Contains(Vector2 screenSpacePos) => true; private bool tracking; public bool Tracking diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index d3386c2bbf..bbebc7e1b1 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -74,7 +74,7 @@ namespace osu.Game.Graphics.Cursor } } - protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool Contains(Vector2 screenSpacePos) => true; [BackgroundDependencyLoader] private void load(ShaderManager shaders, TextureStore textures) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 8d113f4918..c284398240 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -38,7 +38,7 @@ namespace osu.Game.Graphics.UserInterface public readonly TextAwesome Chevron; //don't allow clicking between transitions and don't make the chevron clickable - protected override bool InternalContains(Vector2 screenSpacePos) => Alpha == 1f && Text.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => Alpha == 1f && Text.Contains(screenSpacePos); public override bool HandleInput => State == Visibility.Visible; private Visibility state; diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 10c821e9bd..47f628f96c 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -93,7 +93,7 @@ namespace osu.Game.Graphics.UserInterface private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking - protected override bool InternalContains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos); protected override bool OnClick(Framework.Input.InputState state) { diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 37bf30646d..c60a937440 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -23,7 +23,7 @@ namespace osu.Game.Graphics.UserInterface protected override TabItem CreateTabItem(T value) => new OsuTabItem(value); - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || Dropdown.Contains(screenSpacePos); private bool isEnumType => typeof(T).IsEnum; diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index b504c70be7..b188e782e2 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -171,7 +171,7 @@ namespace osu.Game.Graphics.UserInterface } } - protected override bool InternalContains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos); protected override bool OnHover(InputState state) { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 23b8aac6a7..97c7907874 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays private readonly Container channelSelectionContainer; private readonly ChannelSelectionOverlay channelSelection; - protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos); public ChatOverlay() { diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index d5f7683257..b5ec70b9e2 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.SearchableList protected abstract T DefaultTab { get; } protected virtual Drawable CreateSupplementaryControls() => null; - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || DisplayStyleControl.Dropdown.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || DisplayStyleControl.Dropdown.Contains(screenSpacePos); protected SearchableListFilterControl() { diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 19bb084af4..cdff79c94f 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Menu private readonly Key triggerKey; private SampleChannel sampleClick; - protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown) { diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 78bcbc5c63..f6eaae01b3 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -57,7 +57,7 @@ namespace osu.Game.Screens.Menu set { colourAndTriangles.Alpha = value ? 1 : 0; } } - protected override bool InternalContains(Vector2 screenSpacePos) => logoContainer.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => logoContainer.Contains(screenSpacePos); public bool Ripple { diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 8d70a0f1a9..88522e23ab 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -127,7 +127,7 @@ namespace osu.Game.Screens.Play this.target = target; } - protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool Contains(Vector2 screenSpacePos) => true; public override bool HandleInput => true; diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 49d669aef9..3f3b44aef9 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play Button = button; } - protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool Contains(Vector2 screenSpacePos) => true; private static string getStringRepresentation(MouseButton button) { diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 531c78c17e..6d732b58e4 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Select private readonly SearchTextBox searchTextBox; - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos); public FilterControl() { diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 882aa482da..613c666b92 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -124,7 +124,7 @@ namespace osu.Game.Screens.Select updateModeLight(); } - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || StartButton.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || StartButton.Contains(screenSpacePos); protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index db8ab439eb..942d3a6a32 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -83,7 +83,7 @@ namespace osu.Game.Screens.Select.Options return false; } - protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); public BeatmapOptionsButton() { From 494a77aa0d1c2d5918c99f53a1b229ca1d452bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 24 Jun 2017 09:35:54 +0200 Subject: [PATCH 12/75] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index f832f77c04..2f7ebfcf63 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit f832f77c04dd2c64063763a4283831ff95854aab +Subproject commit 2f7ebfcf637cc1928d8d37f6336e5da77f4926a0 From 1bca9ca0e9e1345b4033bb847a8f6bfbf32f31f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 24 Jun 2017 12:56:35 +0200 Subject: [PATCH 13/75] Update framework with better children list --- osu.Game/Overlays/Chat/ChannelSection.cs | 2 +- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 2 +- osu.Game/Overlays/Direct/DirectPanel.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 2 +- osu.Game/Overlays/SocialOverlay.cs | 2 +- osu.Game/Screens/Multiplayer/RoomInspector.cs | 2 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index f12ec53605..cafb88b6ac 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Chat public IEnumerable Channels { - set { ChannelFlow.Children = value.Select(c => new ChannelListItem(c)); } + set { ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c)); } } public ChannelSection() diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 6ff3cc7be5..7c10c4fb9b 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Chat { set { - sectionsFlow.Children = value; + sectionsFlow.ChildrenEnumerable = value; foreach (ChannelSection s in sectionsFlow.Children) { diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index c8ca50823f..5edb48e136 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Dialog get { return buttonsContainer.Children; } set { - buttonsContainer.Children = value; + buttonsContainer.ChildrenEnumerable = value; foreach (PopupDialogButton b in value) { var action = b.Action; diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 8a56cf392e..f8acad1f59 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Direct SetInfo = setInfo; } - protected IEnumerable GetDifficultyIcons() + protected List GetDifficultyIcons() { var icons = new List(); diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 93c440384b..beb1355f36 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -129,7 +129,7 @@ namespace osu.Game.Overlays private void recreatePanels(PanelDisplayStyle displayStyle) { if (BeatmapSets == null) return; - panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); + panels.ChildrenEnumerable = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); } public class ResultCounts diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index c6ce20f5cf..1cd2343848 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -44,7 +44,7 @@ namespace osu.Game.Overlays panelFlow.Clear(); else { - panelFlow.Children = users.Select(u => + panelFlow.ChildrenEnumerable = users.Select(u => { var p = new UserPanel(u) { Width = 300 }; p.Status.BindTo(u.Status); diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 2181f37be9..f9e015eceb 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -495,7 +495,7 @@ namespace osu.Game.Screens.Multiplayer levelRangeLower.Text = ranks.Min().ToString(); levelRangeHigher.Text = ranks.Max().ToString(); - participantsFlow.Children = value.Select(u => new UserTile(u)); + participantsFlow.ChildrenEnumerable = value.Select(u => new UserTile(u)); } private class UserTile : Container, IHasTooltip diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index ac333e47ff..15e8e4bfcd 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Ranking } }; - statisticsContainer.Children = Score.Statistics.Select(s => new DrawableScoreStatistic(s)); + statisticsContainer.ChildrenEnumerable = Score.Statistics.Select(s => new DrawableScoreStatistic(s)); } protected override void LoadComplete() diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index daf28c8f1b..481637e2af 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -439,7 +439,7 @@ namespace osu.Game.Screens.Select { Show(); if (header.Text == "Tags") - content.Children = value.Split(' ').Select(text => new OsuSpriteText + content.ChildrenEnumerable = value.Split(' ').Select(text => new OsuSpriteText { Text = text, Font = "Exo2.0-Regular", From ba783f984cb964cc6317126c33bb0742405b7980 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Sat, 24 Jun 2017 13:36:57 +0200 Subject: [PATCH 14/75] Change usage of ScrollIntoView to ScrollTo in the setttings overlay --- osu.Game/Overlays/SettingsOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 88f4599383..5677bbcad9 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -93,7 +93,7 @@ namespace osu.Game.Overlays new SidebarButton { Section = section, - Action = sectionsContainer.ScrollContainer.ScrollIntoView, + Action = sectionsContainer.ScrollContainer.ScrollTo, } ).ToArray() } From d914a1b00ef20bbc88082d3760775a4b4a363252 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Sat, 24 Jun 2017 13:47:34 +0200 Subject: [PATCH 15/75] Added animation parameter --- osu.Game/Overlays/Settings/SidebarButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index 309216dd91..8d5e0e96b7 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Settings private readonly Box backgroundBox; private readonly Box selectionIndicator; private readonly Container text; - public Action Action; + public Action Action; private SettingsSection section; public SettingsSection Section @@ -112,7 +112,7 @@ namespace osu.Game.Overlays.Settings protected override bool OnClick(InputState state) { - Action?.Invoke(section); + Action?.Invoke(section, true); backgroundBox.FlashColour(Color4.White, 400); return true; } From 63aeb42657dc0084cd9a417e8356246e0599629c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 25 Jun 2017 14:38:00 +0900 Subject: [PATCH 16/75] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 2f7ebfcf63..a5e66079b9 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 2f7ebfcf637cc1928d8d37f6336e5da77f4926a0 +Subproject commit a5e66079b9df3cf74a8bd1431c1cb7faad3c4d9f From 7baa2b742175286c6c70b254c8540efab23b2bba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 25 Jun 2017 14:46:59 +0900 Subject: [PATCH 17/75] Fix CI issues --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 2 +- osu.Game/Graphics/UserInterface/BarGraph.cs | 2 +- osu.Game/Overlays/OnScreenDisplay.cs | 5 ++--- .../Screens/Tournament/Components/VisualiserContainer.cs | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 395e496b61..c6c009e8f2 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { if (!userTriggered && Time.Current >= slider.EndTime) { - var ticksCount = ticks.Children.Count() + 1; + var ticksCount = ticks.Children.Count + 1; var ticksHit = ticks.Children.Count(t => t.Judgement.Result == HitResult.Hit); if (initialCircle.Judgement.Result == HitResult.Hit) ticksHit++; diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index d0965a1861..e4a471bbba 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -29,7 +29,7 @@ namespace osu.Game.Graphics.UserInterface base.Direction = (direction & BarDirection.Horizontal) > 0 ? FillDirection.Vertical : FillDirection.Horizontal; foreach (var bar in Children) { - bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / Children.Count()) : new Vector2(1.0f / Children.Count(), 1); + bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / Children.Count) : new Vector2(1.0f / Children.Count, 1); bar.Direction = direction; } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 2887d4355b..4a616a8685 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Extensions; @@ -182,7 +181,7 @@ namespace osu.Game.Overlays textLine2.Origin = optionCount > 0 ? Anchor.BottomCentre : Anchor.Centre; textLine2.Y = optionCount > 0 ? 0 : 5; - if (optionLights.Children.Count() != optionCount) + if (optionLights.Children.Count != optionCount) { optionLights.Clear(); for (int i = 0; i < optionCount; i++) @@ -190,7 +189,7 @@ namespace osu.Game.Overlays } for (int i = 0; i < optionCount; i++) - optionLights.Children.Skip(i).First().Glowing = i == selectedOption; + optionLights.Children[i].Glowing = i == selectedOption; }); } diff --git a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs index 373934f775..3dd7207607 100644 --- a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs +++ b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs @@ -84,7 +84,7 @@ namespace osu.Game.Screens.Tournament.Components { base.UpdateAfterChildren(); - while (Children.Count() < 3) + while (Children.Count < 3) addLine(); float pos = leftPos; From cbf188c293e0a7ca467a5ee6076cb7b39db8d7a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 26 Jun 2017 19:06:08 +0900 Subject: [PATCH 18/75] Add new main menu backgrounds --- osu-resources | 2 +- .../Backgrounds/BackgroundScreenDefault.cs | 25 ++++++++++++++++++- osu.Game/Screens/Loader.cs | 5 ++-- osu.Game/Screens/Menu/MainMenu.cs | 11 +++++++- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/osu-resources b/osu-resources index 10fda22522..900f47563f 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 10fda22522ffadbdbc43fa0f3683a065e536f7d1 +Subproject commit 900f47563f5598eef7cbf203f0b3f2166508b6d5 diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index f411f74361..3248fef0db 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -2,16 +2,39 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Graphics.Backgrounds; namespace osu.Game.Screens.Backgrounds { public class BackgroundScreenDefault : BackgroundScreen { + private int currentDisplay; + private const int background_count = 5; + + + private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}"; + + private Background current; + [BackgroundDependencyLoader] private void load() { - Add(new Background(@"Backgrounds/bg1")); + display(new Background(backgroundName)); + } + + private void display(Background b) + { + current?.FadeOut(800, EasingTypes.OutQuint); + current?.Expire(); + + Add(current = b); + } + + public void Next() + { + currentDisplay++; + LoadComponentAsync(new Background(backgroundName) { Depth = currentDisplay }, display); } } } \ No newline at end of file diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index 30e1538b47..af084e740b 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Screens; using osu.Game.Screens.Menu; namespace osu.Game.Screens @@ -20,9 +19,9 @@ namespace osu.Game.Screens private void load(OsuGame game) { if (game.IsDeployedBuild) - LoadComponentAsync(new Disclaimer(), d => Push((Screen)d)); + LoadComponentAsync(new Disclaimer(), d => Push(d)); else - LoadComponentAsync(new Intro(), d => Push((Screen)d)); + LoadComponentAsync(new Intro(), d => Push(d)); } } } diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 1a7d2d4e37..5a2e0a7b12 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -7,6 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Input; using osu.Framework.Screens; +using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; @@ -24,7 +25,7 @@ namespace osu.Game.Screens.Menu internal override bool ShowOverlays => buttons.State != MenuState.Initial; - private readonly BackgroundScreen background; + private readonly BackgroundScreenDefault background; private Screen songSelect; protected override BackgroundScreen CreateBackground() => background; @@ -66,6 +67,12 @@ namespace osu.Game.Screens.Menu preloadSongSelect(); } + protected override void OnBeatmapChanged(WorkingBeatmap beatmap) + { + base.OnBeatmapChanged(beatmap); + background.Next(); + } + private void preloadSongSelect() { if (songSelect == null) @@ -111,6 +118,8 @@ namespace osu.Game.Screens.Menu { base.OnResuming(last); + background.Next(); + //we may have consumed our preloaded instance, so let's make another. preloadSongSelect(); From 803bb3c7802357d24f078bf3fb0dcbd0f6c69e78 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 26 Jun 2017 23:05:35 +0900 Subject: [PATCH 19/75] Cleanup. --- osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 3248fef0db..bab267a24a 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -12,7 +12,6 @@ namespace osu.Game.Screens.Backgrounds private int currentDisplay; private const int background_count = 5; - private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}"; private Background current; @@ -23,12 +22,12 @@ namespace osu.Game.Screens.Backgrounds display(new Background(backgroundName)); } - private void display(Background b) + private void display(Background newBackground) { current?.FadeOut(800, EasingTypes.OutQuint); current?.Expire(); - Add(current = b); + Add(current = newBackground); } public void Next() @@ -37,4 +36,4 @@ namespace osu.Game.Screens.Backgrounds LoadComponentAsync(new Background(backgroundName) { Depth = currentDisplay }, display); } } -} \ No newline at end of file +} From b40526ced22d250dd2c5cfac7976bc9e7a58d9ff Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 26 Jun 2017 23:47:15 +0900 Subject: [PATCH 20/75] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index a5e66079b9..25b660ce32 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit a5e66079b9df3cf74a8bd1431c1cb7faad3c4d9f +Subproject commit 25b660ce322922abbb9be53caca2041c0e0c3ba0 From 480cdba023ad7e34f3b08a9c180869991d618b25 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 27 Jun 2017 21:05:49 +0900 Subject: [PATCH 21/75] Add OsuClickableContainer with generic sounds --- .../Containers/OsuClickableContainer.cs | 35 +++++++++++++++++++ osu.Game/Graphics/UserInterface/BackButton.cs | 1 - .../Graphics/UserInterface/DialogButton.cs | 12 +++---- osu.Game/Graphics/UserInterface/IconButton.cs | 3 +- .../Graphics/UserInterface/TwoLayerButton.cs | 5 +-- osu.Game/Overlays/Direct/DirectListPanel.cs | 3 +- osu.Game/Overlays/Direct/FilterControl.cs | 3 +- .../Overlays/Notifications/Notification.cs | 3 +- .../Notifications/NotificationSection.cs | 3 +- .../SearchableList/DisplayStyleControl.cs | 3 +- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 19 +++------- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 3 +- osu.Game/Screens/Play/MenuOverlay.cs | 6 ---- osu.Game/Screens/Play/SkipButton.cs | 14 ++------ osu.Game/Screens/Select/FooterButton.cs | 4 +-- .../Select/Leaderboards/LeaderboardScore.cs | 3 +- .../Select/Options/BeatmapOptionsButton.cs | 3 +- osu.Game/osu.Game.csproj | 1 + 18 files changed, 68 insertions(+), 56 deletions(-) create mode 100644 osu.Game/Graphics/Containers/OsuClickableContainer.cs diff --git a/osu.Game/Graphics/Containers/OsuClickableContainer.cs b/osu.Game/Graphics/Containers/OsuClickableContainer.cs new file mode 100644 index 0000000000..adc15f6833 --- /dev/null +++ b/osu.Game/Graphics/Containers/OsuClickableContainer.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input; + +namespace osu.Game.Graphics.Containers +{ + public class OsuClickableContainer : ClickableContainer + { + public SampleChannel SampleClick, SampleHover; + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + SampleHover = audio.Sample.Get(@"UI/generic-hover"); + SampleClick = audio.Sample.Get(@"UI/generic-click"); + } + + protected override bool OnHover(InputState state) + { + SampleHover?.Play(); + return base.OnHover(state); + } + + protected override bool OnClick(InputState state) + { + SampleClick?.Play(); + return base.OnClick(state); + } + } +} diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index 2b4b9cdb04..24905d6044 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -20,7 +20,6 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colours) { - ActivationSound = audio.Sample.Get(@"Menu/menuback"); BackgroundColour = colours.Pink; HoverColour = colours.PinkDark; } diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 47f628f96c..26e0148bd6 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -8,14 +8,14 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Containers; -using osu.Framework.Audio.Sample; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Graphics.Containers; namespace osu.Game.Graphics.UserInterface { - public class DialogButton : ClickableContainer + public class DialogButton : OsuClickableContainer { private const float hover_width = 0.9f; private const float hover_duration = 500; @@ -79,8 +79,6 @@ namespace osu.Game.Graphics.UserInterface } } - public SampleChannel SampleClick, SampleHover; - private readonly Container backgroundContainer; private readonly Container colourContainer; private readonly Container glowContainer; @@ -100,8 +98,6 @@ namespace osu.Game.Graphics.UserInterface didClick = true; colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In); flash(); - SampleClick?.Play(); - Action?.Invoke(); Delay(click_duration); Schedule(delegate { @@ -110,7 +106,7 @@ namespace osu.Game.Graphics.UserInterface glowContainer.FadeOut(); }); - return true; + return base.OnClick(state); } protected override bool OnHover(Framework.Input.InputState state) @@ -119,7 +115,7 @@ namespace osu.Game.Graphics.UserInterface colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic); glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out); - SampleHover?.Play(); + base.OnHover(state); return true; } diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index 8540b35702..84904c10db 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -9,10 +9,11 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input; +using osu.Game.Graphics.Containers; namespace osu.Game.Graphics.UserInterface { - public class IconButton : ClickableContainer + public class IconButton : OsuClickableContainer { private readonly TextAwesome icon; private readonly Box hover; diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index b188e782e2..81c031151d 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -18,7 +18,7 @@ using osu.Framework.Graphics.Shapes; namespace osu.Game.Graphics.UserInterface { - public class TwoLayerButton : ClickableContainer + public class TwoLayerButton : OsuClickableContainer { private readonly BouncingIcon bouncingIcon; @@ -32,7 +32,6 @@ namespace osu.Game.Graphics.UserInterface public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50); public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50); - public SampleChannel ActivationSound; private readonly SpriteText text; public Color4 HoverColour; @@ -210,8 +209,6 @@ namespace osu.Game.Graphics.UserInterface flash.FadeOut(500, EasingTypes.OutQuint); flash.Expire(); - ActivationSound.Play(); - return base.OnClick(state); } diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 2cede1e574..1e923d79fa 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -16,6 +16,7 @@ using osu.Framework.Graphics.Textures; using System.Linq; using osu.Framework.Input; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Direct { @@ -151,7 +152,7 @@ namespace osu.Game.Overlays.Direct }; } - private class DownloadButton : ClickableContainer + private class DownloadButton : OsuClickableContainer { private readonly TextAwesome icon; diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 455d0ab77b..b898d24c31 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Database; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Overlays.SearchableList; namespace osu.Game.Overlays.Direct @@ -42,7 +43,7 @@ namespace osu.Game.Overlays.Direct } } - private class RulesetToggleButton : ClickableContainer + private class RulesetToggleButton : OsuClickableContainer { private readonly TextAwesome icon; diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 2833ef9f3a..3380c61385 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Notifications { @@ -152,7 +153,7 @@ namespace osu.Game.Overlays.Notifications Expire(); } - private class CloseButton : ClickableContainer + private class CloseButton : OsuClickableContainer { private Color4 hoverColour; diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index b53f8e6b14..b4f35be733 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Notifications { @@ -131,7 +132,7 @@ namespace osu.Game.Overlays.Notifications countText.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString(); } - private class ClearAllButton : ClickableContainer + private class ClearAllButton : OsuClickableContainer { private readonly OsuSpriteText text; diff --git a/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs index b37b0db139..7157861632 100644 --- a/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs +++ b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs @@ -6,6 +6,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.SearchableList { @@ -52,7 +53,7 @@ namespace osu.Game.Overlays.SearchableList DisplayStyle.Value = PanelDisplayStyle.Grid; } - private class DisplayStyleToggleButton : ClickableContainer + private class DisplayStyleToggleButton : OsuClickableContainer { private readonly TextAwesome icon; private readonly PanelDisplayStyle style; diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index bb3fc0783f..0866c68561 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -1,10 +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 osu.Framework.Allocation; using osu.Framework.Audio; -using osu.Framework.Audio.Sample; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -16,10 +14,11 @@ using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Toolbar { - public class ToolbarButton : Container + public class ToolbarButton : OsuClickableContainer { public const float WIDTH = Toolbar.HEIGHT * 1.4f; @@ -58,7 +57,6 @@ namespace osu.Game.Overlays.Toolbar protected virtual Anchor TooltipAnchor => Anchor.TopLeft; - public Action Action; protected TextAwesome DrawableIcon; protected SpriteText DrawableText; protected Box HoverBackground; @@ -66,7 +64,6 @@ namespace osu.Game.Overlays.Toolbar private readonly SpriteText tooltip1; private readonly SpriteText tooltip2; protected FillFlowContainer Flow; - private SampleChannel sampleClick; public ToolbarButton() { @@ -136,27 +133,19 @@ namespace osu.Game.Overlays.Toolbar }; } - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - sampleClick = audio.Sample.Get(@"Menu/menuclick"); - } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; protected override bool OnClick(InputState state) { - Action?.Invoke(); - sampleClick.Play(); HoverBackground.FlashColour(Color4.White.Opacity(100), 500, EasingTypes.OutQuint); - return true; + return base.OnClick(state); } protected override bool OnHover(InputState state) { HoverBackground.FadeIn(200); tooltipContainer.FadeIn(100); - return false; + return base.OnHover(state); } protected override void OnHoverLost(InputState state) diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 71114dd3a3..620797aff6 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -11,13 +11,14 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Game.Database; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Multiplayer; using osu.Game.Users; namespace osu.Game.Screens.Multiplayer { - public class DrawableRoom : ClickableContainer + public class DrawableRoom : OsuClickableContainer { private const float content_padding = 5; private const float height = 90; diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index adfa1a736b..368c53f12f 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -191,12 +191,6 @@ namespace osu.Game.Screens.Play public class Button : DialogButton { - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - SampleHover = audio.Sample.Get(@"Menu/menuclick"); - SampleClick = audio.Sample.Get(@"Menu/menuback"); - } } } } diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index b38a9b4934..15d252d742 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -16,8 +16,8 @@ using osu.Game.Screens.Ranking; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; -using osu.Framework.Audio.Sample; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Play { @@ -175,16 +175,14 @@ namespace osu.Game.Screens.Play } } - private class Button : Container + private class Button : OsuClickableContainer { - public Action Action; private Color4 colourNormal; private Color4 colourHover; private Box box; private FillFlowContainer flow; private Box background; private AspectContainer aspect; - private SampleChannel activationSound; public Button() { @@ -194,8 +192,6 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(OsuColour colours, AudioManager audio) { - activationSound = audio.Sample.Get(@"Menu/menuhit"); - colourNormal = colours.Yellow; colourHover = colours.YellowDark; @@ -282,13 +278,9 @@ namespace osu.Game.Screens.Play protected override bool OnClick(InputState state) { - Action?.Invoke(); - - activationSound.Play(); - box.FlashColour(Color4.White, 500, EasingTypes.OutQuint); aspect.ScaleTo(1.2f, 2000, EasingTypes.OutQuint); - return true; + return base.OnClick(state); } } } diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 9be940e06a..536bf3971a 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -6,15 +6,15 @@ using OpenTK; using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Select { - public class FooterButton : ClickableContainer + public class FooterButton : OsuClickableContainer { private static readonly Vector2 shearing = new Vector2(0.15f, 0); diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 32e6d9630b..48de4c2d3a 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -13,10 +13,11 @@ using osu.Game.Rulesets.Mods; using osu.Game.Users; using osu.Framework; using osu.Game.Rulesets.Scoring; +using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Select.Leaderboards { - public class LeaderboardScore : ClickableContainer, IStateful + public class LeaderboardScore : OsuClickableContainer, IStateful { public static readonly float HEIGHT = 60; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index 942d3a6a32..d9314d09ee 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -11,10 +11,11 @@ using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; +using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Select.Options { - public class BeatmapOptionsButton : ClickableContainer + public class BeatmapOptionsButton : OsuClickableContainer { private const float width = 130; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 64b81ddc6a..7be7812478 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -76,6 +76,7 @@ + From 40225238d96b78e1544f1f18721211d0174fb422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 28 Jun 2017 12:24:23 +0300 Subject: [PATCH 22/75] Set RelativeSizeAxes for updated FillMode behavior --- osu-framework | 2 +- osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs | 1 + osu.Game/Graphics/Backgrounds/Background.cs | 1 + osu.Game/Overlays/Direct/DirectPanel.cs | 1 + osu.Game/Overlays/MusicController.cs | 1 + osu.Game/Screens/Multiplayer/RoomInspector.cs | 1 + osu.Game/Screens/Play/PlayerLoader.cs | 1 + osu.Game/Screens/Ranking/Results.cs | 1 + osu.Game/Screens/Ranking/ResultsPageScore.cs | 1 + osu.Game/Screens/Select/BeatmapInfoWedge.cs | 1 + osu.Game/Screens/Select/Leaderboards/DrawableRank.cs | 1 + osu.Game/Screens/Tournament/Drawings.cs | 1 + osu.Game/Screens/Tournament/Group.cs | 2 +- osu.Game/Users/Avatar.cs | 1 + osu.Game/Users/UserPanel.cs | 1 + 15 files changed, 15 insertions(+), 2 deletions(-) diff --git a/osu-framework b/osu-framework index a5e66079b9..3fffad110c 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit a5e66079b9df3cf74a8bd1431c1cb7faad3c4d9f +Subproject commit 3fffad110c0d019146944735ac2dcb8a37f98f8b diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 1ac6261621..b59dbac722 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -93,6 +93,7 @@ namespace osu.Game.Beatmaps.Drawables { new BeatmapBackgroundSprite(working) { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index 7c47635276..8eb2ddc0ab 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -26,6 +26,7 @@ namespace osu.Game.Graphics.Backgrounds Add(Sprite = new Sprite { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Color4.DarkGray, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index f8acad1f59..3c708bff67 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -38,6 +38,7 @@ namespace osu.Game.Overlays.Direct { return new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(SetInfo.Beatmaps.FirstOrDefault(), textures, null)) { + RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), }) { RelativeSizeAxes = Axes.Both }; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index e1e920ec0f..181046f3ff 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -397,6 +397,7 @@ namespace osu.Game.Overlays { sprite = new Sprite { + RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(150), FillMode = FillMode.Fill, }, diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index f9e015eceb..3a822be791 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -438,6 +438,7 @@ namespace osu.Game.Screens.Multiplayer { new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(value, textures, null)) { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 726397a3b1..c8ebb1f436 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -227,6 +227,7 @@ namespace osu.Game.Screens.Play { new Sprite { + RelativeSizeAxes = Axes.Both, Texture = beatmap?.Background, Origin = Anchor.Centre, Anchor = Anchor.Centre, diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 2bff535603..dac83536ed 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -163,6 +163,7 @@ namespace osu.Game.Screens.Ranking { new Sprite { + RelativeSizeAxes = Axes.Both, Alpha = 0.2f, Texture = Beatmap?.Background, Anchor = Anchor.Centre, diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 15e8e4bfcd..96e63585bf 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -343,6 +343,7 @@ namespace osu.Game.Screens.Ranking { cover = new Sprite { + RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 264fe6643b..42f9598096 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -152,6 +152,7 @@ namespace osu.Game.Screens.Select // Zoomed-in and cropped beatmap background new BeatmapBackgroundSprite(beatmap) { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, diff --git a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs index 647398db9e..6329729687 100644 --- a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs +++ b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs @@ -31,6 +31,7 @@ namespace osu.Game.Screens.Select.Leaderboards { rankSprite = new Sprite { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fit diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 7efb86a403..246fa17e85 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -82,6 +82,7 @@ namespace osu.Game.Screens.Tournament }, new Sprite { + RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Texture = textures.Get(@"Backgrounds/Drawings/background.png") }, diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index 441a5c7bcd..bd13ced2cd 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -151,9 +151,9 @@ namespace osu.Game.Screens.Tournament { flagSprite = new Sprite { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - FillMode = FillMode.Fit }, new OsuSpriteText diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index b032187624..5d518f1780 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -31,6 +31,7 @@ namespace osu.Game.Users Add(new Sprite { + RelativeSizeAxes = Axes.Both, Texture = texture, FillMode = FillMode.Fit, Anchor = Anchor.Centre, diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 8cff3517a3..881aaf2e07 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -46,6 +46,7 @@ namespace osu.Game.Users { new AsyncLoadWrapper(new CoverBackgroundSprite(user) { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, From 28f0da606a69f534c2625e0e63b9bac04ded659a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 28 Jun 2017 10:18:12 -0700 Subject: [PATCH 23/75] Add OsuFocusedOverlayContainer with predefined sounds. --- .../Containers/OsuFocusedOverlayContainer.cs | 38 +++++++++++++++++++ .../Overlays/Chat/ChannelSelectionOverlay.cs | 3 +- osu.Game/Overlays/ChatOverlay.cs | 3 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 3 +- osu.Game/Overlays/DialogOverlay.cs | 3 +- osu.Game/Overlays/LoginOverlay.cs | 3 +- osu.Game/Overlays/MusicController.cs | 3 +- osu.Game/Overlays/NotificationManager.cs | 3 +- osu.Game/Overlays/SettingsOverlay.cs | 2 +- osu.Game/Overlays/WaveOverlayContainer.cs | 3 +- .../Select/Options/BeatmapOptionsOverlay.cs | 2 +- osu.Game/osu.Game.csproj | 1 + 12 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs new file mode 100644 index 0000000000..0713fa1a52 --- /dev/null +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -0,0 +1,38 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Graphics.Containers +{ + public class OsuFocusedOverlayContainer : FocusedOverlayContainer + { + private SampleChannel samplePopIn; + private SampleChannel samplePopOut; + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + samplePopIn = audio.Sample.Get(@"UI/melodic-5"); + samplePopOut = audio.Sample.Get(@"UI/melodic-4"); + + StateChanged += OsuFocusedOverlayContainer_StateChanged; + } + + private void OsuFocusedOverlayContainer_StateChanged(VisibilityContainer arg1, Visibility arg2) + { + switch (arg2) + { + case Visibility.Visible: + samplePopIn?.Play(); + break; + case Visibility.Hidden: + samplePopOut?.Play(); + break; + } + } + } +} diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 7c10c4fb9b..9f61d13813 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -16,10 +16,11 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Chat; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Chat { - public class ChannelSelectionOverlay : FocusedOverlayContainer + public class ChannelSelectionOverlay : OsuFocusedOverlayContainer { public static readonly float WIDTH_PADDING = 170; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 97c7907874..22852f21a6 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -22,10 +22,11 @@ using osu.Framework.Input; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Overlays.Chat; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays { - public class ChatOverlay : FocusedOverlayContainer, IOnlineComponent + public class ChatOverlay : OsuFocusedOverlayContainer, IOnlineComponent { private const float textbox_height = 60; private const float channel_selection_min_height = 0.3f; diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 5edb48e136..39338ba3e1 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -15,10 +15,11 @@ using OpenTK; using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Dialog { - public class PopupDialog : FocusedOverlayContainer + public class PopupDialog : OsuFocusedOverlayContainer { public static readonly float ENTER_DURATION = 500; public static readonly float EXIT_DURATION = 200; diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 757781a4ab..f1a6bc1681 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -7,10 +7,11 @@ using osu.Framework.Graphics.Containers; using osu.Game.Overlays.Dialog; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays { - public class DialogOverlay : FocusedOverlayContainer + public class DialogOverlay : OsuFocusedOverlayContainer { private readonly Container dialogContainer; private PopupDialog currentDialog; diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index b688bafd4d..790530342f 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -8,10 +8,11 @@ using osu.Game.Graphics; using osu.Game.Overlays.Settings.Sections.General; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays { - internal class LoginOverlay : FocusedOverlayContainer + internal class LoginOverlay : OsuFocusedOverlayContainer { private LoginSettings settingsSection; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index e1e920ec0f..61439a26e0 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -24,10 +24,11 @@ using osu.Framework.Threading; using osu.Game.Overlays.Music; using osu.Game.Graphics.UserInterface; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays { - public class MusicController : FocusedOverlayContainer + public class MusicController : OsuFocusedOverlayContainer { private const float player_height = 130; diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index 34690013df..382683cbcc 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -9,10 +9,11 @@ using osu.Framework.Graphics.Containers; using osu.Game.Overlays.Notifications; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays { - public class NotificationManager : FocusedOverlayContainer + public class NotificationManager : OsuFocusedOverlayContainer { private const float width = 320; diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 88f4599383..093b7c8c26 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -15,7 +15,7 @@ using osu.Game.Overlays.Settings.Sections; namespace osu.Game.Overlays { - public class SettingsOverlay : FocusedOverlayContainer + public class SettingsOverlay : OsuFocusedOverlayContainer { internal const float CONTENT_MARGINS = 10; diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index e744f23a3a..1bb7813d90 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -8,10 +8,11 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using System; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays { - public abstract class WaveOverlayContainer : FocusedOverlayContainer + public abstract class WaveOverlayContainer : OsuFocusedOverlayContainer { protected const float APPEAR_DURATION = 800; protected const float DISAPPEAR_DURATION = 500; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index a6ad56b86f..f18080d6f5 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -14,7 +14,7 @@ using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Select.Options { - public class BeatmapOptionsOverlay : FocusedOverlayContainer + public class BeatmapOptionsOverlay : OsuFocusedOverlayContainer { private const float transition_duration = 500; private const float x_position = 0.2f; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7be7812478..06d4da663e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -77,6 +77,7 @@ + From ee96d39b93eaaaade69541de50f09b22a704b9c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 28 Jun 2017 10:19:04 -0700 Subject: [PATCH 24/75] Shuffle sound samples around and make more conformant --- osu.Game/Graphics/UserInterface/OsuButton.cs | 17 ++++++++++- .../Graphics/UserInterface/OsuCheckbox.cs | 4 +-- .../UserInterface/OsuContextMenuItem.cs | 4 +-- .../Graphics/UserInterface/OsuSliderBar.cs | 2 +- osu.Game/Overlays/Chat/ChannelListItem.cs | 3 +- .../Dialog/PopupDialogCancelButton.cs | 2 -- .../Overlays/Dialog/PopupDialogOkButton.cs | 4 +-- osu.Game/Screens/Menu/Button.cs | 16 ++++++----- osu.Game/Screens/Menu/ButtonSystem.cs | 28 ++++++++++++------- osu.Game/Screens/Menu/OsuLogo.cs | 24 +++++++++------- osu.Game/Screens/OsuScreen.cs | 14 +++++++++- osu.Game/Screens/Play/HotkeyRetryOverlay.cs | 3 -- osu.Game/Screens/Play/Player.cs | 6 ++++ osu.Game/Screens/ScreenWhiteBox.cs | 6 ---- 14 files changed, 84 insertions(+), 49 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 7bd58d38a5..6814308cb4 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -3,6 +3,8 @@ using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; @@ -18,6 +20,9 @@ namespace osu.Game.Graphics.UserInterface { private Box hover; + private SampleChannel sampleClick; + private SampleChannel sampleHover; + public OsuButton() { Height = 40; @@ -34,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface public override bool HandleInput => Action != null; [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, AudioManager audio) { if (Action == null) Colour = OsuColour.Gray(0.5f); @@ -60,10 +65,20 @@ namespace osu.Game.Graphics.UserInterface Alpha = 0, }, }); + + sampleClick = audio.Sample.Get(@"UI/generic-click"); + sampleHover = audio.Sample.Get(@"UI/generic-hover"); + } + + protected override bool OnClick(InputState state) + { + sampleClick?.Play(); + return base.OnClick(state); } protected override bool OnHover(InputState state) { + sampleHover?.Play(); hover.FadeIn(200); return base.OnHover(state); } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 198a01b5a4..68ff99e593 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -106,8 +106,8 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleChecked = audio.Sample.Get(@"Checkbox/check-on"); - sampleUnchecked = audio.Sample.Get(@"Checkbox/check-off"); + sampleChecked = audio.Sample.Get(@"UI/check-on"); + sampleUnchecked = audio.Sample.Get(@"UI/check-off"); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs index 769df18566..5d12dadf5f 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs @@ -65,8 +65,8 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleHover = audio.Sample.Get(@"Menu/menuclick"); - sampleClick = audio.Sample.Get(@"Menu/menuback"); + sampleHover = audio.Sample.Get(@"UI/generic-hover"); + sampleClick = audio.Sample.Get(@"UI/generic-click"); BackgroundColour = Color4.Transparent; BackgroundColourHover = OsuColour.FromHex(@"172023"); diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 4f0ac28731..673a23afac 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -100,7 +100,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colours) { - sample = audio.Sample.Get(@"Sliderbar/sliderbar"); + sample = audio.Sample.Get(@"UI/sliderbar-notch"); AccentColour = colours.Pink; } diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 9aa11cdd4f..aca65bbc17 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -12,10 +12,11 @@ using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Chat { - public class ChannelListItem : ClickableContainer, IFilterable + public class ChannelListItem : OsuClickableContainer, IFilterable { private const float width_padding = 5; private const float channel_width = 150; diff --git a/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs b/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs index 1449577b21..28b6e1b5fb 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs @@ -13,8 +13,6 @@ namespace osu.Game.Overlays.Dialog private void load(OsuColour colours, AudioManager audio) { ButtonColour = colours.Blue; - SampleHover = audio.Sample.Get(@"Menu/menuclick"); - SampleClick = audio.Sample.Get(@"Menu/menuback"); } } } diff --git a/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs b/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs index 46bf3debc4..8bc8ad76b9 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs @@ -10,11 +10,9 @@ namespace osu.Game.Overlays.Dialog public class PopupDialogOkButton : PopupDialogButton { [BackgroundDependencyLoader] - private void load(OsuColour colours, AudioManager audio) + private void load(OsuColour colours) { ButtonColour = colours.Pink; - SampleHover = audio.Sample.Get(@"Menu/menuclick"); - SampleClick = audio.Sample.Get(@"Menu/menu-play-click"); } } } diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index cdff79c94f..3e9f51ebe9 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -30,16 +30,17 @@ namespace osu.Game.Screens.Menu private readonly Container box; private readonly Box boxHoverLayer; private readonly TextAwesome icon; - private readonly string internalName; + private readonly string sampleName; private readonly Action clickAction; private readonly Key triggerKey; private SampleChannel sampleClick; + private SampleChannel sampleHover; public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); - public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown) + public Button(string text, string sampleName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown) { - this.internalName = internalName; + this.sampleName = sampleName; this.clickAction = clickAction; this.triggerKey = triggerKey; @@ -120,8 +121,7 @@ namespace osu.Game.Screens.Menu { if (State != ButtonState.Expanded) return true; - //if (OsuGame.Instance.IsActive) - // Game.Audio.PlaySamplePositional($@"menu-{internalName}-hover", @"menuclick"); + sampleHover?.Play(); box.ScaleTo(new Vector2(1.5f, 1), 500, EasingTypes.OutElastic); @@ -222,7 +222,9 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleClick = audio.Sample.Get($@"Menu/menu-{internalName}-click") ?? audio.Sample.Get(internalName.Contains(@"back") ? @"Menu/menuback" : @"Menu/menuhit"); + sampleHover = audio.Sample.Get(@"Menu/hover"); + if (!string.IsNullOrEmpty(sampleName)) + sampleClick = audio.Sample.Get($@"Menu/{sampleName}"); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -259,7 +261,7 @@ namespace osu.Game.Screens.Menu private void trigger() { - sampleClick.Play(); + sampleClick?.Play(); clickAction?.Invoke(); diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 82b7335a9b..9ba16ab1ca 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -15,6 +15,8 @@ using osu.Game.Overlays.Toolbar; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; +using osu.Framework.Audio.Sample; +using osu.Framework.Audio; namespace osu.Game.Screens.Menu { @@ -51,6 +53,8 @@ namespace osu.Game.Screens.Menu private readonly List