From 92c21d8b12b1b6a9a7cc553f3cb71675f15b7ec7 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 5 Dec 2016 00:58:52 +0800 Subject: [PATCH 01/71] Add button and sliderbar. --- .../Tests/TestCaseKeyCounter.cs | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index f7cbc1252e..646d076d4f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -5,6 +5,11 @@ using osu.Framework.GameModes.Testing; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK.Input; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Configuration; +using OpenTK; +using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests { @@ -18,22 +23,32 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - Children = new[] + KeyCounterCollection kc; + BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 1000, Default = 50 }; + AddButton("Add Random", null); + Add(new SliderBar { - new KeyCounterCollection + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, + Width = 150, + Height = 10, + SelectionColor = Color4.Orange, + Position = new Vector2(0, 50), + Bindable = bindable + }); + Add(kc = new KeyCounterCollection + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + IsCounting = true, + Children = new KeyCounter[] { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - IsCounting = true, - Children = new KeyCounter[] - { - new KeyCounterKeyboard(@"Z", Key.Z), - new KeyCounterKeyboard(@"X", Key.X), - new KeyCounterMouse(@"M1", MouseButton.Left), - new KeyCounterMouse(@"M2", MouseButton.Right), - }, + new KeyCounterKeyboard(@"Z", Key.Z), + new KeyCounterKeyboard(@"X", Key.X), + new KeyCounterMouse(@"M1", MouseButton.Left), + new KeyCounterMouse(@"M2", MouseButton.Right), }, - }; + }); } } } From 63ba3455fb26f7642fdd3aa7a9fb9e561b925834 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 5 Dec 2016 01:03:18 +0800 Subject: [PATCH 02/71] Function of add random. --- .../Tests/TestCaseKeyCounter.cs | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 646d076d4f..50779abb39 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Configuration; using OpenTK; using OpenTK.Graphics; +using osu.Framework.MathUtils; namespace osu.Desktop.VisualTests.Tests { @@ -23,20 +24,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - KeyCounterCollection kc; - BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 1000, Default = 50 }; - AddButton("Add Random", null); - Add(new SliderBar - { - Origin = Anchor.TopLeft, - Anchor = Anchor.TopLeft, - Width = 150, - Height = 10, - SelectionColor = Color4.Orange, - Position = new Vector2(0, 50), - Bindable = bindable - }); - Add(kc = new KeyCounterCollection + KeyCounterCollection kc = new KeyCounterCollection { Origin = Anchor.Centre, Anchor = Anchor.Centre, @@ -48,7 +36,24 @@ namespace osu.Desktop.VisualTests.Tests new KeyCounterMouse(@"M1", MouseButton.Left), new KeyCounterMouse(@"M2", MouseButton.Right), }, + }; + BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 1000, Default = 50 }; + AddButton("Add Random", () => + { + Key key = (Key)((int)Key.A + RNG.Next(26)); + kc.Add(new KeyCounterKeyboard(key.ToString(), key)); }); + Add(new SliderBar + { + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, + Width = 150, + Height = 10, + SelectionColor = Color4.Orange, + Position = new Vector2(0, 50), + Bindable = bindable + }); + Add(kc); } } } From cb8a07b65331027c59bb1f9fec08948a962a69f3 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 5 Dec 2016 01:06:28 +0800 Subject: [PATCH 03/71] Function of changing FadeTime. --- osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 50779abb39..1441cc93be 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -37,7 +37,8 @@ namespace osu.Desktop.VisualTests.Tests new KeyCounterMouse(@"M2", MouseButton.Right), }, }; - BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 1000, Default = 50 }; + BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 200, Default = 50 }; + bindable.ValueChanged += delegate { kc.FadeTime = bindable.Value; }; AddButton("Add Random", () => { Key key = (Key)((int)Key.A + RNG.Next(26)); From 21f993d1492b18220168a320bab57214f22bcf4d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Dec 2016 22:57:14 +0900 Subject: [PATCH 04/71] Add ability to navigate song select carousel using arrow keys. --- osu.Game/Screens/Select/CarouselContainer.cs | 68 ++++++++++++++++---- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index 2c59639ce7..144e4cabba 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -1,19 +1,21 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using osu.Framework.Caching; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transformations; -using osu.Game.Database; -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Lists; -using osu.Game.Beatmaps.Drawables; +using OpenTK; +using osu.Framework.Caching; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Transformations; +using osu.Game.Database; +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Lists; +using osu.Game.Beatmaps.Drawables; using osu.Framework.Timing; +using osu.Framework.Input; +using OpenTK.Input; namespace osu.Game.Screens.Select { @@ -244,5 +246,47 @@ namespace osu.Game.Screens.Select updatePanel(p, halfHeight); } } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + int direction = 0; + bool skipDifficulties = false; + + switch (args.Key) + { + case Key.Up: + direction = -1; + break; + case Key.Down: + direction = 1; + break; + case Key.Left: + direction = -1; + skipDifficulties = true; + break; + case Key.Right: + direction = 1; + skipDifficulties = true; + break; + } + + if (direction != 0) + { + int index = SelectedGroup.BeatmapPanels.IndexOf(SelectedPanel) + direction; + + if (!skipDifficulties && index >= 0 && index < SelectedGroup.BeatmapPanels.Count) + //changing difficulty panel, not set. + SelectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[index]); + else + { + index = (groups.IndexOf(SelectedGroup) + direction + groups.Count) % groups.Count; + SelectBeatmap(groups[index].BeatmapPanels.First().Beatmap); + } + + return true; + } + + return base.OnKeyDown(state, args); + } } } From 9557821776b5e71084a064b275fb65b567a0f768 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Dec 2016 20:55:37 +0900 Subject: [PATCH 05/71] Start a map using enter key. --- osu.Game/Screens/Select/PlaySongSelect.cs | 29 +++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 9d2debb8aa..e79278a742 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -28,6 +28,8 @@ using osu.Framework.Audio.Sample; using osu.Framework.Graphics.Transformations; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics.Containers; +using osu.Framework.Input; +using OpenTK.Input; namespace osu.Game.Screens.Select { @@ -141,17 +143,22 @@ namespace osu.Game.Screens.Select Width = 100, Text = "Play", Colour = new Color4(238, 51, 153, 255), - Action = () => Push(new Player - { - BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, - PreferredPlayMode = playMode.Value - }) + Action = start }, } } }; } + private void start() + { + Push(new Player + { + BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, + PreferredPlayMode = playMode.Value + }); + } + [BackgroundDependencyLoader(permitNulls: true)] private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game, OsuGame osuGame) { @@ -343,5 +350,17 @@ namespace osu.Game.Screens.Select addBeatmapSet(beatmapSet, game); } } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + switch (args.Key) + { + case Key.Enter: + start(); + return true; + } + + return base.OnKeyDown(state, args); + } } } From 8d800dac992d0d941e80164eec78e0fe36a8b1e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Dec 2016 21:18:30 +0900 Subject: [PATCH 06/71] Make Player load async. --- osu.Game/Screens/Select/PlaySongSelect.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index e79278a742..e9e5144159 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -150,12 +150,26 @@ namespace osu.Game.Screens.Select }; } + Player player; + private void start() { - Push(new Player + if (player != null) + return; + + player = new Player { BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, PreferredPlayMode = playMode.Value + }; + + player.Preload(Game, delegate + { + if (!Push(player)) + { + player = null; + //error occured? + } }); } @@ -206,6 +220,8 @@ namespace osu.Game.Screens.Select protected override void OnResuming(GameMode last) { + player = null; + changeBackground(Beatmap); ensurePlayingSelected(); base.OnResuming(last); From 08ef8ed8ea22b3266937f0b463da005ef54db6b9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Dec 2016 21:20:27 +0900 Subject: [PATCH 07/71] Add comment about future implementation. --- osu.Game/Screens/Select/PlaySongSelect.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index e9e5144159..6e311d7dd5 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -157,6 +157,8 @@ namespace osu.Game.Screens.Select if (player != null) return; + //in the future we may want to move this logic to a PlayerLoader gamemode or similar, so we can rely on the SongSelect transition + //and provide a better loading experience (at the moment song select is still accepting input during preload). player = new Player { BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, From 0a9e3ce1b081f053ff3cfecd6836297b657e9a9e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Dec 2016 21:47:32 +0900 Subject: [PATCH 08/71] Don't handle input in triangle particle effect containers. --- osu.Game.Modes.Osu/Objects/Drawables/Pieces/Triangles.cs | 2 ++ osu.Game/Graphics/Backgrounds/Triangles.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/Triangles.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/Triangles.cs index 95f25c43d1..2025934e71 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/Triangles.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/Triangles.cs @@ -13,6 +13,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { public class Triangles : Container { + public override bool HandleInput => false; + protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 34e65f0b2a..b68b5ebc4a 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -15,6 +15,8 @@ namespace osu.Game.Graphics.Backgrounds { public class Triangles : Container { + public override bool HandleInput => false; + public Triangles() { Alpha = 0.3f; From d8e40d4fb160a5b30b3de32e5f9daba07c1d8057 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Dec 2016 21:47:57 +0900 Subject: [PATCH 09/71] Add naive lifetime calculation for drawable HitObjects. --- osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 94694b8d5e..d18b3e2cbb 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -44,6 +44,8 @@ namespace osu.Game.Modes.Objects.Drawables UpdateState(state); + Expire(true); + if (State == ArmedState.Hit) PlaySample(); } @@ -75,6 +77,8 @@ namespace osu.Game.Modes.Objects.Drawables //force application of the state that was set before we loaded. UpdateState(State); + + Expire(true); } /// From cf8283582b6aa877439eb4b942efbf3c12820171 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Dec 2016 22:33:11 +0900 Subject: [PATCH 10/71] Don't update LifetimeStart on HitObject state change. --- osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index d18b3e2cbb..7ce71acf3e 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -44,7 +44,7 @@ namespace osu.Game.Modes.Objects.Drawables UpdateState(state); - Expire(true); + Expire(); if (State == ArmedState.Hit) PlaySample(); From ec7bbd231f8ceff76195b19c41daaf3d92c8f3c6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Dec 2016 22:35:12 +0900 Subject: [PATCH 11/71] Make flash animation last slightly longer. --- osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index ccbfbb1db3..b2179d95d0 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -134,7 +134,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables FadeOut(TIME_FADEOUT / 5); break; case ArmedState.Hit: - const double flash_in = 30; + const double flash_in = 40; flash.FadeTo(0.8f, flash_in); flash.Delay(flash_in); From 8ce18e89869b15af8bb98a8afd35169cc272eea0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Dec 2016 22:48:35 +0900 Subject: [PATCH 12/71] Improve song select startup time via better database querying. Also fix difficulty displays. --- osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index 3f5fe58ab5..db769bccc9 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps.Drawables } } - public BeatmapGroup(WorkingBeatmap beatmap) + public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null) { this.beatmap = beatmap; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 6e311d7dd5..bf4d2c84f1 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Select BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, PreferredPlayMode = playMode.Value }; - + player.Preload(Game, delegate { if (!Push(player)) @@ -336,10 +336,15 @@ namespace osu.Game.Screens.Select private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game) { beatmapSet = database.GetWithChildren(beatmapSet.BeatmapSetID); - beatmapSet.Beatmaps.ForEach(b => database.GetChildren(b)); + beatmapSet.Beatmaps.ForEach(b => + { + database.GetChildren(b); + if (b.Metadata == null) b.Metadata = beatmapSet.Metadata; + }); + beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList(); - var beatmap = database.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault()); + var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database); var group = new BeatmapGroup(beatmap) { SelectionChanged = selectionChanged }; From 20260b43d17d17d77004c9953ac9d4b828988d0b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Dec 2016 22:51:35 +0900 Subject: [PATCH 13/71] Improve star animation. --- osu.Game/Graphics/UserInterface/StarCounter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index 097362bc77..fa8ca7e5a9 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -35,7 +35,7 @@ namespace osu.Game.Graphics.UserInterface protected set; } - private double animationDelay => 150; + private double animationDelay => 80; private double scalingDuration => 500; private EasingTypes scalingEasing => EasingTypes.OutElasticHalf; From a845a897b3e720de5cad7b3889246cfcffefed26 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 15 Dec 2016 17:11:48 -0600 Subject: [PATCH 14/71] Add Base Preview Time --- osu.Game/Screens/Select/PlaySongSelect.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 9d2debb8aa..1496727469 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -279,20 +279,28 @@ namespace osu.Game.Screens.Select /// private void selectionChanged(BeatmapGroup group, BeatmapInfo beatmap) { + bool beatmapSetChange = false; if (!beatmap.Equals(Beatmap?.BeatmapInfo)) { if (beatmap.BeatmapSetID == Beatmap?.BeatmapInfo.BeatmapSetID) + { sampleChangeDifficulty.Play(); + beatmapSetChange = false; + } else + { sampleChangeBeatmap.Play(); + beatmapSetChange = true; + + } Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap); } - - ensurePlayingSelected(); + + ensurePlayingSelected(beatmapSetChange); } - private async Task ensurePlayingSelected() + private async Task ensurePlayingSelected(bool preview = false) { AudioTrack track = null; @@ -303,6 +311,8 @@ namespace osu.Game.Screens.Select if (track != null) { trackManager.SetExclusive(track); + if (preview) + track.Seek(Beatmap.Beatmap.Metadata.PreviewTime); track.Start(); } }); From b788878c95f8756825967990bea141577a0a5a36 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 15 Dec 2016 17:28:22 -0600 Subject: [PATCH 15/71] Unnecesary things were removed (I guess) --- osu.Game/Screens/Select/PlaySongSelect.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 1496727469..7eae136d5e 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -280,23 +280,19 @@ namespace osu.Game.Screens.Select private void selectionChanged(BeatmapGroup group, BeatmapInfo beatmap) { bool beatmapSetChange = false; + if (!beatmap.Equals(Beatmap?.BeatmapInfo)) { if (beatmap.BeatmapSetID == Beatmap?.BeatmapInfo.BeatmapSetID) - { sampleChangeDifficulty.Play(); - beatmapSetChange = false; - } else { sampleChangeBeatmap.Play(); beatmapSetChange = true; - } - Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap); } - + ensurePlayingSelected(beatmapSetChange); } From d37ff8f153d9762fe7eab53e31b4171bb01b56da Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 15 Dec 2016 17:35:14 -0600 Subject: [PATCH 16/71] Deleted unnecesary things (I guess) --- osu.Game/Screens/Select/PlaySongSelect.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 7eae136d5e..bc9c983352 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -292,7 +292,6 @@ namespace osu.Game.Screens.Select } Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap); } - ensurePlayingSelected(beatmapSetChange); } From c642f6c34f3cef27d924318891d464212d7dbb2e Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 7 Dec 2016 15:39:21 -0500 Subject: [PATCH 17/71] Add sliderbar L+F --- osu.Game/Overlays/Options/SliderOption.cs | 135 +++++++++++++++------- 1 file changed, 91 insertions(+), 44 deletions(-) diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index d00eeebe35..cbb6fc4148 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -1,53 +1,100 @@ -using System; +using System; +using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options -{ - public class SliderOption : FlowContainer where T : struct, - IComparable, IFormattable, IConvertible, IComparable, IEquatable - { - private SliderBar slider; - private SpriteText text; - - public string LabelText - { - get { return text.Text; } - set - { - text.Text = value; - text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1; - } - } - - public BindableNumber Bindable - { - get { return slider.Bindable; } - set { slider.Bindable = value; } - } - - public SliderOption() - { - Direction = FlowDirection.VerticalOnly; - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Children = new Drawable[] - { - text = new SpriteText { Alpha = 0 }, - slider = new SliderBar - { - Margin = new MarginPadding { Top = 5 }, - Height = 10, - RelativeSizeAxes = Axes.X, - Color = Color4.White, - SelectionColor = new Color4(255, 102, 170, 255), - } - }; - } - } +namespace osu.Game.Overlays.Options +{ + public class SliderOption : FlowContainer where T : struct, + IComparable, IFormattable, IConvertible, IComparable, IEquatable + { + private SliderBar slider; + private SpriteText text; + + public string LabelText + { + get { return text.Text; } + set + { + text.Text = value; + text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1; + } + } + + public BindableNumber Bindable + { + get { return slider.Bindable; } + set { slider.Bindable = value; } + } + + public SliderOption() + { + Direction = FlowDirection.VerticalOnly; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Children = new Drawable[] + { + text = new SpriteText { Alpha = 0 }, + slider = new OsuSliderBar + { + Margin = new MarginPadding { Top = 5 }, + RelativeSizeAxes = Axes.X, + } + }; + } + + private class OsuSliderBar : SliderBar where U : struct, + IComparable, IFormattable, IConvertible, IComparable, IEquatable + { + private Container nub; + + public OsuSliderBar() + { + Height = 22; + Color = Color4.White; + SelectionColor = new Color4(255, 102, 170, 255); + Add(nub = new Container + { + Width = Height, + Height = Height, + CornerRadius = Height / 2, + Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.None, + RelativeSizeAxes = Axes.None, + RelativePositionAxes = Axes.X, + Masking = true, + BorderColour = new Color4(255, 102, 170, 255), + BorderThickness = 2, + Children = new[] + { + new Box { Colour = Color4.Transparent, RelativeSizeAxes = Axes.Both } + } + }); + Box.Height = SelectionBox.Height = 2; + Box.RelativePositionAxes = Axes.None; + Box.RelativeSizeAxes = SelectionBox.RelativeSizeAxes = Axes.None; + Box.Position = SelectionBox.Position = new Vector2(0, Height / 2 - 1); + Box.Colour = new Color4(255, 102, 170, 100); + } + + protected override void UpdateAmount(float amt) + { + nub.MoveToX(amt, 300, EasingTypes.OutQuint); + SelectionBox.ScaleTo( + new Vector2(DrawWidth * amt - Height / 2 + 1, 1), + 300, EasingTypes.OutQuint); + Box.MoveToX(DrawWidth * amt + Height / 2 - 1, + 300, EasingTypes.OutQuint); + Box.ScaleTo( + new Vector2(DrawWidth * (1 - amt) - Height / 2 + 1, 1), + 300, EasingTypes.OutQuint); + } + } + } } \ No newline at end of file From 22c2a4757cc1d079427124677d40259c212465e8 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 7 Dec 2016 15:56:00 -0500 Subject: [PATCH 18/71] Play slider sample as the value changes in 1/10ths --- osu.Game/Overlays/Options/SliderOption.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index cbb6fc4148..c86e226672 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -1,6 +1,9 @@ using System; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -53,6 +56,8 @@ namespace osu.Game.Overlays.Options IComparable, IFormattable, IConvertible, IComparable, IEquatable { private Container nub; + private AudioSample sample; + private float prevAmount = -1; public OsuSliderBar() { @@ -83,8 +88,17 @@ namespace osu.Game.Overlays.Options Box.Colour = new Color4(255, 102, 170, 100); } + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + sample = audio.Sample.Get(@"Sliderbar/sliderbar"); + } + protected override void UpdateAmount(float amt) { + if (prevAmount != -1 && (int)(prevAmount * 10) != (int)(amt * 10)) + sample?.Play(); + prevAmount = amt; nub.MoveToX(amt, 300, EasingTypes.OutQuint); SelectionBox.ScaleTo( new Vector2(DrawWidth * amt - Height / 2 + 1, 1), From 9e75ecab4fdbc178f7350f16ee29e4e5bfca08fc Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 8 Dec 2016 17:12:12 -0500 Subject: [PATCH 19/71] Fix up slider bugs --- osu.Game/Overlays/Options/SliderOption.cs | 117 +++++++++++++++------- 1 file changed, 79 insertions(+), 38 deletions(-) diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index c86e226672..ac49c72e38 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -1,5 +1,6 @@ using System; using OpenTK; +using OpenTK.Input; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -11,6 +12,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; namespace osu.Game.Overlays.Options { @@ -55,37 +57,50 @@ namespace osu.Game.Overlays.Options private class OsuSliderBar : SliderBar where U : struct, IComparable, IFormattable, IConvertible, IComparable, IEquatable { - private Container nub; private AudioSample sample; - private float prevAmount = -1; - + private double lastSample; + + private Container nub; + private Box leftBox, rightBox; public OsuSliderBar() { Height = 22; - Color = Color4.White; - SelectionColor = new Color4(255, 102, 170, 255); - Add(nub = new Container + Children = new Drawable[] { - Width = Height, - Height = Height, - CornerRadius = Height / 2, - Origin = Anchor.TopCentre, - AutoSizeAxes = Axes.None, - RelativeSizeAxes = Axes.None, - RelativePositionAxes = Axes.X, - Masking = true, - BorderColour = new Color4(255, 102, 170, 255), - BorderThickness = 2, - Children = new[] + leftBox = new Box { - new Box { Colour = Color4.Transparent, RelativeSizeAxes = Axes.Both } - } - }); - Box.Height = SelectionBox.Height = 2; - Box.RelativePositionAxes = Axes.None; - Box.RelativeSizeAxes = SelectionBox.RelativeSizeAxes = Axes.None; - Box.Position = SelectionBox.Position = new Vector2(0, Height / 2 - 1); - Box.Colour = new Color4(255, 102, 170, 100); + Height = 2, + RelativeSizeAxes = Axes.None, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Colour = new Color4(255, 102, 170, 255), + }, + rightBox = new Box + { + Height = 2, + RelativeSizeAxes = Axes.None, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Colour = new Color4(255, 102, 170, 255), + Alpha = 0.5f, + }, + nub = new Container + { + Width = Height, + Height = Height, + CornerRadius = Height / 2, + Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.None, + RelativeSizeAxes = Axes.None, + Masking = true, + BorderColour = new Color4(255, 102, 170, 255), + BorderThickness = 3, + Children = new[] + { + new Box { Colour = Color4.Transparent, RelativeSizeAxes = Axes.Both } + } + }, + }; } [BackgroundDependencyLoader] @@ -94,20 +109,46 @@ namespace osu.Game.Overlays.Options sample = audio.Sample.Get(@"Sliderbar/sliderbar"); } - protected override void UpdateAmount(float amt) + private void playSample() { - if (prevAmount != -1 && (int)(prevAmount * 10) != (int)(amt * 10)) - sample?.Play(); - prevAmount = amt; - nub.MoveToX(amt, 300, EasingTypes.OutQuint); - SelectionBox.ScaleTo( - new Vector2(DrawWidth * amt - Height / 2 + 1, 1), - 300, EasingTypes.OutQuint); - Box.MoveToX(DrawWidth * amt + Height / 2 - 1, - 300, EasingTypes.OutQuint); - Box.ScaleTo( - new Vector2(DrawWidth * (1 - amt) - Height / 2 + 1, 1), - 300, EasingTypes.OutQuint); + if (Clock == null) + return; + if (Clock.CurrentTime - lastSample > 50) + { + lastSample = Clock.CurrentTime; + sample.Frequency.Value = 1 + NormalizedValue * 0.2f; + sample.Play(); + } + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Key == Key.Left || args.Key == Key.Right) + playSample(); + return base.OnKeyDown(state, args); + } + + protected override bool OnClick(InputState state) + { + playSample(); + return base.OnClick(state); + } + + protected override bool OnDrag(InputState state) + { + playSample(); + return base.OnDrag(state); + } + + protected override void UpdateValue(float value) + { + nub.MoveToX(DrawWidth * value, 300, EasingTypes.OutQuint); + leftBox.ScaleTo(new Vector2( + MathHelper.Clamp(DrawWidth * value - nub.Width / 2 + 2, 0, DrawWidth), + 1), 300, EasingTypes.OutQuint); + rightBox.ScaleTo(new Vector2( + MathHelper.Clamp(DrawWidth * (1 - value) - nub.Width / 2 + 2, 0, DrawWidth), + 1), 300, EasingTypes.OutQuint); } } } From 10cc6f7885d42fe359ea1a839bd9f28911d19438 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 9 Dec 2016 08:18:58 -0500 Subject: [PATCH 20/71] Move where clause to next line --- osu.Game/Overlays/Options/SliderOption.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index ac49c72e38..010514efcd 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -16,8 +16,8 @@ using osu.Framework.Input; namespace osu.Game.Overlays.Options { - public class SliderOption : FlowContainer where T : struct, - IComparable, IFormattable, IConvertible, IComparable, IEquatable + public class SliderOption : FlowContainer + where T : struct, IComparable, IFormattable, IConvertible, IComparable, IEquatable { private SliderBar slider; private SpriteText text; @@ -54,8 +54,8 @@ namespace osu.Game.Overlays.Options }; } - private class OsuSliderBar : SliderBar where U : struct, - IComparable, IFormattable, IConvertible, IComparable, IEquatable + private class OsuSliderBar : SliderBar + where U : struct, IComparable, IFormattable, IConvertible, IComparable, IEquatable { private AudioSample sample; private double lastSample; @@ -152,4 +152,4 @@ namespace osu.Game.Overlays.Options } } } -} \ No newline at end of file +} From a751cfcba3cb6d029fe5a41de2869f19450c9033 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 14 Dec 2016 14:57:41 -0500 Subject: [PATCH 21/71] Update SliderOption implementation Per @Tom94's suggestion, the bars track the nub in Update instead of animating seperately. Also only animates when the event source is the keyboard. --- osu.Game/Overlays/Options/SliderOption.cs | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index 010514efcd..a13bce6217 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -139,16 +139,22 @@ namespace osu.Game.Overlays.Options playSample(); return base.OnDrag(state); } - - protected override void UpdateValue(float value) + + protected override void Update() { - nub.MoveToX(DrawWidth * value, 300, EasingTypes.OutQuint); - leftBox.ScaleTo(new Vector2( - MathHelper.Clamp(DrawWidth * value - nub.Width / 2 + 2, 0, DrawWidth), - 1), 300, EasingTypes.OutQuint); - rightBox.ScaleTo(new Vector2( - MathHelper.Clamp(DrawWidth * (1 - value) - nub.Width / 2 + 2, 0, DrawWidth), - 1), 300, EasingTypes.OutQuint); + leftBox.Scale = new Vector2(MathHelper.Clamp( + nub.DrawPosition.X - nub.DrawSize.X / 2 + 2, 0, DrawWidth), 1); + rightBox.Scale = new Vector2(MathHelper.Clamp( + DrawWidth - nub.DrawPosition.X - nub.DrawSize.X / 2 + 2, 0, DrawWidth), 1); + base.Update(); + } + + protected override void UpdateValue(float value, SliderBarEventSource eventSource) + { + if (eventSource == SliderBarEventSource.Keyboard) + nub.MoveToX(DrawWidth * value, 300, EasingTypes.OutQuint); + else + nub.Position = new Vector2(DrawWidth * value, nub.Position.Y); } } } From abc6db18b39fbf26902ce3e8ce0f69449500f3e4 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 14 Dec 2016 14:59:23 -0500 Subject: [PATCH 22/71] Add license header --- osu.Game/Overlays/Options/SliderOption.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index a13bce6217..83a6148e69 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -1,4 +1,7 @@ -using System; +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using OpenTK; using OpenTK.Input; using OpenTK.Graphics; From 80574423cbd82bc00bcacd6e681b810b21e2ef4c Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 15 Dec 2016 00:11:37 -0500 Subject: [PATCH 23/71] Drop SliderBarEventSource --- osu.Game/Overlays/Options/SliderOption.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index 83a6148e69..e20bc86c07 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -145,19 +145,16 @@ namespace osu.Game.Overlays.Options protected override void Update() { + base.Update(); leftBox.Scale = new Vector2(MathHelper.Clamp( nub.DrawPosition.X - nub.DrawSize.X / 2 + 2, 0, DrawWidth), 1); rightBox.Scale = new Vector2(MathHelper.Clamp( DrawWidth - nub.DrawPosition.X - nub.DrawSize.X / 2 + 2, 0, DrawWidth), 1); - base.Update(); } - protected override void UpdateValue(float value, SliderBarEventSource eventSource) + protected override void UpdateValue(float value) { - if (eventSource == SliderBarEventSource.Keyboard) - nub.MoveToX(DrawWidth * value, 300, EasingTypes.OutQuint); - else - nub.Position = new Vector2(DrawWidth * value, nub.Position.Y); + nub.Position = new Vector2(DrawWidth * value, nub.Position.Y); } } } From 96a6e30a212330c9c9d93bab8fb4e0d47e9f93e5 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 15 Dec 2016 22:50:23 -0500 Subject: [PATCH 24/71] Drop complicated type constraints --- osu.Game/Overlays/Options/SliderOption.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index e20bc86c07..bdca93b341 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -19,8 +19,7 @@ using osu.Framework.Input; namespace osu.Game.Overlays.Options { - public class SliderOption : FlowContainer - where T : struct, IComparable, IFormattable, IConvertible, IComparable, IEquatable + public class SliderOption : FlowContainer where T : struct { private SliderBar slider; private SpriteText text; @@ -57,8 +56,7 @@ namespace osu.Game.Overlays.Options }; } - private class OsuSliderBar : SliderBar - where U : struct, IComparable, IFormattable, IConvertible, IComparable, IEquatable + private class OsuSliderBar : SliderBar where U : struct { private AudioSample sample; private double lastSample; From 6143a9f318d2a2f9d635ebe2d81d9591bc914375 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 16 Dec 2016 00:27:16 -0500 Subject: [PATCH 25/71] Update submodules --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index cea7e88cad..19008db380 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit cea7e88cad687a6a6613655ddd74be3f15bf49db +Subproject commit 19008db3800972e245f649468ac8330934c29a4c From 796858f86f2b5a3ac5eeb504dfa3e1a5183fb8a8 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 16 Dec 2016 00:37:37 -0500 Subject: [PATCH 26/71] Fix transparency issues --- osu.Game/Overlays/Options/SliderOption.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index bdca93b341..179b3ed440 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -98,7 +98,11 @@ namespace osu.Game.Overlays.Options BorderThickness = 3, Children = new[] { - new Box { Colour = Color4.Transparent, RelativeSizeAxes = Axes.Both } + new Box + { + Colour = new Color4(255, 102, 170, 0), + RelativeSizeAxes = Axes.Both + } } }, }; From 67d748f677898cb62036637f7d0663597b00ba97 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 16 Dec 2016 01:27:57 -0500 Subject: [PATCH 27/71] Adjust padding on sliders --- osu.Game/Overlays/Options/SliderOption.cs | 31 ++++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index 179b3ed440..44b7935945 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -59,13 +59,23 @@ namespace osu.Game.Overlays.Options private class OsuSliderBar : SliderBar where U : struct { private AudioSample sample; - private double lastSample; + private double lastSampleTime; private Container nub; private Box leftBox, rightBox; + + private float innerWidth + { + get + { + return DrawWidth - Height; + } + } + public OsuSliderBar() { Height = 22; + Padding = new MarginPadding { Left = Height / 2, Right = Height / 2 }; Children = new Drawable[] { leftBox = new Box @@ -104,7 +114,7 @@ namespace osu.Game.Overlays.Options RelativeSizeAxes = Axes.Both } } - }, + } }; } @@ -116,14 +126,11 @@ namespace osu.Game.Overlays.Options private void playSample() { - if (Clock == null) + if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50) return; - if (Clock.CurrentTime - lastSample > 50) - { - lastSample = Clock.CurrentTime; - sample.Frequency.Value = 1 + NormalizedValue * 0.2f; - sample.Play(); - } + lastSampleTime = Clock.CurrentTime; + sample.Frequency.Value = 1 + NormalizedValue * 0.2f; + sample.Play(); } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) @@ -149,14 +156,14 @@ namespace osu.Game.Overlays.Options { base.Update(); leftBox.Scale = new Vector2(MathHelper.Clamp( - nub.DrawPosition.X - nub.DrawSize.X / 2 + 2, 0, DrawWidth), 1); + nub.DrawPosition.X - nub.DrawWidth / 2 + 2, 0, innerWidth), 1); rightBox.Scale = new Vector2(MathHelper.Clamp( - DrawWidth - nub.DrawPosition.X - nub.DrawSize.X / 2 + 2, 0, DrawWidth), 1); + innerWidth - nub.DrawPosition.X - nub.DrawWidth / 2 + 2, 0, innerWidth), 1); } protected override void UpdateValue(float value) { - nub.Position = new Vector2(DrawWidth * value, nub.Position.Y); + nub.MoveToX(innerWidth * value); } } } From 400cb2da82d9afd0622e7fec5b81cdc649978e12 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 16 Dec 2016 01:44:23 -0500 Subject: [PATCH 28/71] Update submodules --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 19008db380..eab5cc9fde 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 19008db3800972e245f649468ac8330934c29a4c +Subproject commit eab5cc9fde277a9558712c69d92aed0671f2b0ad From ba81222af64a3e3b35f9c37c922da9748236279c Mon Sep 17 00:00:00 2001 From: n4b3l Date: Fri, 16 Dec 2016 17:13:24 +0100 Subject: [PATCH 29/71] basic background dim --- osu.Game/Screens/Play/Player.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7e6f5d2b55..d9cee732aa 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -21,6 +21,8 @@ using OpenTK; using osu.Framework.GameModes; using osu.Game.Modes.UI; using osu.Game.Screens.Ranking; +using osu.Game.Configuration; +using osu.Framework.Configuration; namespace osu.Game.Screens.Play { @@ -42,6 +44,7 @@ namespace osu.Game.Screens.Play private ScoreProcessor scoreProcessor; private HitRenderer hitRenderer; + private Bindable dimLevel; [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game) @@ -110,6 +113,7 @@ namespace osu.Game.Screens.Play }, scoreOverlay, }; + dimLevel = game.Config.GetBindable(OsuConfig.DimLevel); } protected override void LoadComplete() @@ -145,10 +149,17 @@ namespace osu.Game.Screens.Play base.OnEntering(last); (Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000); + (Background as BackgroundModeBeatmap)?.FadeTo((100f- dimLevel)/100,1000); Content.Alpha = 0; } + protected override bool OnExiting(GameMode next) + { + (Background as BackgroundModeBeatmap)?.FadeTo(1f, 0); + return base.OnExiting(next); + } + class PlayerInputManager : UserInputManager { public PlayerInputManager(BasicGameHost host) From f13303c86c7542ab90211b03ff098d665c5c0b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 17 Dec 2016 08:44:58 +0100 Subject: [PATCH 30/71] Do not lengthen slider curves according to the length prescribed in the .osu file for now. This fixes some issues with the map http://osu.ppy.sh/s/484689 . There is still one problem with an almost stationary slider in this map at around the 2/3 mark, but the rest seems to work fine now. --- osu.Game.Modes.Osu/Objects/SliderCurve.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/SliderCurve.cs b/osu.Game.Modes.Osu/Objects/SliderCurve.cs index 961658112f..1c2ef3a604 100644 --- a/osu.Game.Modes.Osu/Objects/SliderCurve.cs +++ b/osu.Game.Modes.Osu/Objects/SliderCurve.cs @@ -101,9 +101,11 @@ namespace osu.Game.Modes.Osu.Objects cumulativeLength.Add(l); } + //TODO: Figure out if the following code is needed in some cases. Judging by the map + // "Transform" http://osu.ppy.sh/s/484689 it seems like we should _not_ be doing this. // Lengthen slider curves that are too short compared to what's // in the .osu file. - if (l < Length && calculatedPath.Count > 1) + /*if (l < Length && calculatedPath.Count > 1) { Vector2 diff = calculatedPath[calculatedPath.Count - 1] - calculatedPath[calculatedPath.Count - 2]; double d = diff.Length; @@ -113,7 +115,7 @@ namespace osu.Game.Modes.Osu.Objects calculatedPath[calculatedPath.Count - 1] += diff * (float)((Length - l) / d); cumulativeLength[calculatedPath.Count - 1] = Length; - } + }*/ } public void Calculate() From c73fbe6e427d887768f4abba554eafb9561c8692 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 15:06:56 +0100 Subject: [PATCH 31/71] Remove unnecessary casts --- osu.Game/Screens/Play/Player.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d9cee732aa..5f28b0e17b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -149,14 +149,14 @@ namespace osu.Game.Screens.Play base.OnEntering(last); (Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000); - (Background as BackgroundModeBeatmap)?.FadeTo((100f- dimLevel)/100,1000); + Background?.FadeTo((100f- dimLevel)/100,1000); Content.Alpha = 0; } protected override bool OnExiting(GameMode next) { - (Background as BackgroundModeBeatmap)?.FadeTo(1f, 0); + Background?.FadeTo(1f, 0); return base.OnExiting(next); } From 36049cc4934e1f952f191af0a91495179a2def62 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 20:29:20 +0100 Subject: [PATCH 32/71] smoother transition --- osu.Game/Screens/Play/Player.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5f28b0e17b..427777b739 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -149,14 +149,14 @@ namespace osu.Game.Screens.Play base.OnEntering(last); (Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000); - Background?.FadeTo((100f- dimLevel)/100,1000); + Background?.FadeTo((100f- dimLevel)/100, 1000); Content.Alpha = 0; } protected override bool OnExiting(GameMode next) { - Background?.FadeTo(1f, 0); + Background?.FadeTo(1f, 200); return base.OnExiting(next); } From 224e6a877aa854bdd4cc56e9f80e59592fd83980 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 20:59:41 +0100 Subject: [PATCH 33/71] responsive to dim changes --- osu.Game/Screens/Play/Player.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 427777b739..9b7c1f73d1 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -23,6 +23,7 @@ using osu.Game.Modes.UI; using osu.Game.Screens.Ranking; using osu.Game.Configuration; using osu.Framework.Configuration; +using System; namespace osu.Game.Screens.Play { @@ -44,7 +45,7 @@ namespace osu.Game.Screens.Play private ScoreProcessor scoreProcessor; private HitRenderer hitRenderer; - private Bindable dimLevel; + private Bindable dimLevel = new Bindable(); [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game) @@ -113,11 +114,13 @@ namespace osu.Game.Screens.Play }, scoreOverlay, }; - dimLevel = game.Config.GetBindable(OsuConfig.DimLevel); + dimLevel.Weld(game.Config.GetBindable(OsuConfig.DimLevel)); + dimLevel.ValueChanged += dimChanged; } protected override void LoadComplete() { + base.LoadComplete(); Delay(250, true); @@ -156,10 +159,16 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(GameMode next) { + dimLevel.ValueChanged -= dimChanged; Background?.FadeTo(1f, 200); return base.OnExiting(next); } + private void dimChanged(object sender, EventArgs e) + { + Background?.FadeTo((100f - dimLevel) / 100, 800); + } + class PlayerInputManager : UserInputManager { public PlayerInputManager(BasicGameHost host) From 0fbd2d8bc845af0fffe868c97754aa22a9babd67 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 21:03:14 +0100 Subject: [PATCH 34/71] removed random enter --- osu.Game/Screens/Play/Player.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 9b7c1f73d1..6c83c70f4b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -120,7 +120,6 @@ namespace osu.Game.Screens.Play protected override void LoadComplete() { - base.LoadComplete(); Delay(250, true); From eb1c5e089950a6c19c7e3d0f82b7166ff3ed5247 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 7 Dec 2016 01:31:21 +0800 Subject: [PATCH 35/71] Put slider bar into ButtonsContainer. --- osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 1441cc93be..a7cc5d5fd6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -44,14 +44,11 @@ namespace osu.Desktop.VisualTests.Tests Key key = (Key)((int)Key.A + RNG.Next(26)); kc.Add(new KeyCounterKeyboard(key.ToString(), key)); }); - Add(new SliderBar + ButtonsContainer.Add(new SliderBar { - Origin = Anchor.TopLeft, - Anchor = Anchor.TopLeft, Width = 150, Height = 10, SelectionColor = Color4.Orange, - Position = new Vector2(0, 50), Bindable = bindable }); Add(kc); From 1982c8de46dc8d7f06fbd5e7b719df1b8b98450b Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sun, 18 Dec 2016 12:36:49 +0800 Subject: [PATCH 36/71] Update to latest silder bar definition. --- .../Tests/TestCaseKeyCounter.cs | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index a7cc5d5fd6..aa99141e45 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -11,6 +11,8 @@ using osu.Framework.Configuration; using OpenTK; using OpenTK.Graphics; using osu.Framework.MathUtils; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transformations; namespace osu.Desktop.VisualTests.Tests { @@ -44,7 +46,7 @@ namespace osu.Desktop.VisualTests.Tests Key key = (Key)((int)Key.A + RNG.Next(26)); kc.Add(new KeyCounterKeyboard(key.ToString(), key)); }); - ButtonsContainer.Add(new SliderBar + ButtonsContainer.Add(new TestSliderBar { Width = 150, Height = 10, @@ -53,5 +55,38 @@ namespace osu.Desktop.VisualTests.Tests }); Add(kc); } + private class TestSliderBar : SliderBar where T : struct + { + public Color4 Color + { + get { return Box.Colour; } + set { Box.Colour = value; } + } + + public Color4 SelectionColor + { + get { return SelectionBox.Colour; } + set { SelectionBox.Colour = value; } + } + + protected readonly Box SelectionBox; + protected readonly Box Box; + + public TestSliderBar() + { + Children = new Drawable[] + { + Box = new Box { RelativeSizeAxes = Axes.Both }, + SelectionBox = new Box { RelativeSizeAxes = Axes.Both } + }; + } + + protected override void UpdateValue(float value) + { + SelectionBox.ScaleTo( + new Vector2(value, 1), + 300, EasingTypes.OutQuint); + } + } } } From 9e00ca83e177fe927d713d11e876fed78653676d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Dec 2016 16:31:27 +0900 Subject: [PATCH 37/71] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index eab5cc9fde..f8899f9d10 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit eab5cc9fde277a9558712c69d92aed0671f2b0ad +Subproject commit f8899f9d1043ed74481eba2d9bf89c3c5ee38ddf From 2cbc5289710cccf674fe907fc32aca551b4727aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Dec 2016 16:50:39 +0900 Subject: [PATCH 38/71] Remove janky beatmap info wedge animation, restore pixel snapping. --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 1 + osu.Game/Screens/Select/PlaySongSelect.cs | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index e4aa8f27b9..81cd55d429 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -61,6 +61,7 @@ namespace osu.Game.Screens.Select (beatmapInfoContainer = new BufferedContainer { Depth = newDepth, + PixelSnapping = true, CacheDrawnFrameBuffer = true, Shear = -Shear, RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index fb3f6acbdf..78423c06f1 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -213,11 +213,8 @@ namespace osu.Game.Screens.Select Content.FadeInFromZero(250); - beatmapInfoWedge.MoveTo(wedged_container_start_position + new Vector2(-100, 50)); - beatmapInfoWedge.RotateTo(10); - - beatmapInfoWedge.MoveTo(wedged_container_start_position, 800, EasingTypes.OutQuint); - beatmapInfoWedge.RotateTo(0, 800, EasingTypes.OutQuint); + beatmapInfoWedge.MoveToX(wedged_container_start_position.X - 50); + beatmapInfoWedge.MoveToX(wedged_container_start_position.X, 800, EasingTypes.OutQuint); } protected override void OnResuming(GameMode last) From 6e10a9bb2973cbfae0b1f84e5c5c704d401be53c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Dec 2016 16:59:13 +0900 Subject: [PATCH 39/71] Allow starting maps by clicking an active panel a second time. --- osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 6 ++++++ osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 12 +++++++++++- osu.Game/Screens/Select/PlaySongSelect.cs | 6 +++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index db769bccc9..f8d72ad67f 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -19,6 +19,11 @@ namespace osu.Game.Beatmaps.Drawables /// public Action SelectionChanged; + /// + /// Fires when one of our difficulties is clicked when already selected. Should start playing the map. + /// + public Action StartRequested; + public BeatmapSetHeader Header; private BeatmapGroupState state; @@ -68,6 +73,7 @@ namespace osu.Game.Beatmaps.Drawables { Alpha = 0, GainedSelection = panelGainedSelection, + StartRequested = p => { StartRequested?.Invoke(p.Beatmap); }, RelativeSizeAxes = Axes.X, }).ToList(); } diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index 72d1e2f05d..e8b60bab81 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -16,7 +16,8 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; - +using osu.Framework.Input; + namespace osu.Game.Beatmaps.Drawables { class BeatmapPanel : Panel @@ -25,6 +26,7 @@ namespace osu.Game.Beatmaps.Drawables private Sprite background; public Action GainedSelection; + public Action StartRequested; Color4 deselectedColour = new Color4(20, 43, 51, 255); @@ -45,6 +47,14 @@ namespace osu.Game.Beatmaps.Drawables background.Colour = deselectedColour; } + protected override bool OnClick(InputState state) + { + if (State == PanelSelectedState.Selected) + StartRequested?.Invoke(this); + + return base.OnClick(state); + } + public BeatmapPanel(BeatmapInfo beatmap) { Beatmap = beatmap; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 78423c06f1..944b20eb65 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -348,7 +348,11 @@ namespace osu.Game.Screens.Select var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database); - var group = new BeatmapGroup(beatmap) { SelectionChanged = selectionChanged }; + var group = new BeatmapGroup(beatmap) + { + SelectionChanged = selectionChanged, + StartRequested = b => start() + }; //for the time being, let's completely load the difficulty panels in the background. //this likely won't scale so well, but allows us to completely async the loading flow. From 5ac9402d5fa1b4202c0883b66f5b2a4e3874b5d3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Dec 2016 17:06:03 +0900 Subject: [PATCH 40/71] Adjust fade out transform of difficulty panels to avoid overlap. --- osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index f8d72ad67f..7014ada35f 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework; using osu.Framework.Graphics; +using osu.Framework.Graphics.Transformations; using osu.Game.Database; namespace osu.Game.Beatmaps.Drawables @@ -53,7 +54,7 @@ namespace osu.Game.Beatmaps.Drawables SelectedPanel.State = PanelSelectedState.NotSelected; foreach (BeatmapPanel panel in BeatmapPanels) - panel.FadeOut(250); + panel.FadeOut(300, EasingTypes.OutQuint); break; } } From f14a9e7d6bb6b35b1014e46d9703edb42d6d1082 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Dec 2016 17:06:56 +0900 Subject: [PATCH 41/71] Remove unused beatmap reference in BeatmapGroup. --- osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index 7014ada35f..7799095a77 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -30,7 +30,6 @@ namespace osu.Game.Beatmaps.Drawables private BeatmapGroupState state; public List BeatmapPanels; - private WorkingBeatmap beatmap; public BeatmapGroupState State { @@ -62,8 +61,6 @@ namespace osu.Game.Beatmaps.Drawables public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null) { - this.beatmap = beatmap; - Header = new BeatmapSetHeader(beatmap) { GainedSelection = headerGainedSelection, From df305989d03304598cdf3e47c32654c1c823027e Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sun, 18 Dec 2016 10:48:59 +0100 Subject: [PATCH 42/71] use config bindable directly --- osu.Game/Screens/Play/Player.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 6c83c70f4b..7b6f260c56 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -45,7 +45,7 @@ namespace osu.Game.Screens.Play private ScoreProcessor scoreProcessor; private HitRenderer hitRenderer; - private Bindable dimLevel = new Bindable(); + private Bindable dimLevel; [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game) @@ -114,8 +114,7 @@ namespace osu.Game.Screens.Play }, scoreOverlay, }; - dimLevel.Weld(game.Config.GetBindable(OsuConfig.DimLevel)); - dimLevel.ValueChanged += dimChanged; + dimLevel = game.Config.GetBindable(OsuConfig.DimLevel); } protected override void LoadComplete() @@ -154,6 +153,7 @@ namespace osu.Game.Screens.Play Background?.FadeTo((100f- dimLevel)/100, 1000); Content.Alpha = 0; + dimLevel.ValueChanged += dimChanged; } protected override bool OnExiting(GameMode next) From 1d5dc77c4d8de93780dc6197bdc4166eedce7e92 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Dec 2016 20:47:00 +0900 Subject: [PATCH 43/71] Keep reference to reader to avoid early disposal. --- osu.Game/Beatmaps/WorkingBeatmap.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 4c9848363b..9184607398 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -67,6 +67,7 @@ namespace osu.Game.Beatmaps set { lock (beatmapLock) beatmap = value; } } + private ArchiveReader trackReader; private AudioTrack track; private object trackLock = new object(); public AudioTrack Track @@ -79,12 +80,11 @@ namespace osu.Game.Beatmaps try { - using (var reader = GetReader()) - { - var trackData = reader?.GetStream(BeatmapInfo.Metadata.AudioFile); - if (trackData != null) - track = new AudioTrackBass(trackData); - } + //store a reference to the reader as we may continue accessing the stream in the background. + trackReader = GetReader(); + var trackData = trackReader?.GetStream(BeatmapInfo.Metadata.AudioFile); + if (trackData != null) + track = new AudioTrackBass(trackData); } catch { } From 66435a515ce739c54ba45cce5a016471dc45bdf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 18 Dec 2016 15:19:41 +0100 Subject: [PATCH 44/71] Don't async/await song selection since audio operations are now on a separate thread. --- osu-framework | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 21 ++++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/osu-framework b/osu-framework index f8899f9d10..45bff5838d 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit f8899f9d1043ed74481eba2d9bf89c3c5ee38ddf +Subproject commit 45bff5838d133d918547e90bd74c9d0d5fadecc1 diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 944b20eb65..3a74c42029 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -317,22 +317,17 @@ namespace osu.Game.Screens.Select ensurePlayingSelected(beatmapSetChange); } - private async Task ensurePlayingSelected(bool preview = false) + private void ensurePlayingSelected(bool preview = false) { - AudioTrack track = null; + AudioTrack track = Beatmap?.Track; - await Task.Run(() => track = Beatmap?.Track); - - Schedule(delegate + if (track != null) { - if (track != null) - { - trackManager.SetExclusive(track); - if (preview) - track.Seek(Beatmap.Beatmap.Metadata.PreviewTime); - track.Start(); - } - }); + trackManager.SetExclusive(track); + if (preview) + track.Seek(Beatmap.Beatmap.Metadata.PreviewTime); + track.Start(); + } } private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game) From 16d1a8d3b59acf434796352d4e415642f63fa895 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Mon, 19 Dec 2016 00:00:32 +0100 Subject: [PATCH 45/71] Better vscode launch config --- .vscode/launch.json | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index f1682a2ce2..b981556649 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,13 +2,25 @@ "version": "0.2.0", "configurations": [ { - "name": "Launch", + "name": "Launch VisualTests", "type": "mono", "request": "launch", "program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe", "args": [], "cwd": "${workspaceRoot}", - "preLaunchTask": "", + "preLaunchTask": "build", + "runtimeExecutable": null, + "env": {}, + "externalConsole": false + }, + { + "name": "Launch Desktop", + "type": "mono", + "request": "launch", + "program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe", + "args": [], + "cwd": "${workspaceRoot}", + "preLaunchTask": "build", "runtimeExecutable": null, "env": {}, "externalConsole": false From ca2531164afcfdde722fadad63d924c04bc11c6b Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 19 Dec 2016 10:53:03 +0800 Subject: [PATCH 46/71] Add a label for slider bar. --- osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index aa99141e45..e83cda77ee 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -46,6 +46,7 @@ namespace osu.Desktop.VisualTests.Tests Key key = (Key)((int)Key.A + RNG.Next(26)); kc.Add(new KeyCounterKeyboard(key.ToString(), key)); }); + ButtonsContainer.Add(new SpriteText { Text = "FadeTime" }); ButtonsContainer.Add(new TestSliderBar { Width = 150, From 09f9f86b062e9420767480164602e041e97e9dca Mon Sep 17 00:00:00 2001 From: n4b3l Date: Mon, 19 Dec 2016 14:03:10 +0100 Subject: [PATCH 47/71] check if dimLevel is null on exit --- osu.Game/Screens/Play/Player.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7b6f260c56..236a84ccfd 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -158,7 +158,8 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(GameMode next) { - dimLevel.ValueChanged -= dimChanged; + if(dimLevel != null) + dimLevel.ValueChanged -= dimChanged; Background?.FadeTo(1f, 200); return base.OnExiting(next); } From aebe87fefc9fec87d350907d0dd040cdfa4834e3 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Mon, 19 Dec 2016 16:09:29 +0100 Subject: [PATCH 48/71] better implementation --- osu.Game/Screens/Play/Player.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 236a84ccfd..ca4245504b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -50,6 +50,7 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game) { + dimLevel = game.Config.GetBindable(OsuConfig.DimLevel); try { if (Beatmap == null) @@ -114,7 +115,6 @@ namespace osu.Game.Screens.Play }, scoreOverlay, }; - dimLevel = game.Config.GetBindable(OsuConfig.DimLevel); } protected override void LoadComplete() @@ -158,8 +158,7 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(GameMode next) { - if(dimLevel != null) - dimLevel.ValueChanged -= dimChanged; + dimLevel.ValueChanged -= dimChanged; Background?.FadeTo(1f, 200); return base.OnExiting(next); } From e23a1b8e92fe2536e68a35efd0095b9aacf3229f Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Mon, 19 Dec 2016 19:17:04 +0300 Subject: [PATCH 49/71] Remove unnecessary items from OptionsOverlay --- osu.Game/Overlays/Options/Input/MouseOptions.cs | 1 - osu.Game/Overlays/Options/SkinSection.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/osu.Game/Overlays/Options/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Input/MouseOptions.cs index 9d0823ce07..56b34c5396 100644 --- a/osu.Game/Overlays/Options/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Input/MouseOptions.cs @@ -20,7 +20,6 @@ namespace osu.Game.Overlays.Options.Input { Children = new Drawable[] { - new SpriteText { Text = "Sensitivity: TODO slider" }, new SliderOption { LabelText = "Sensitivity", diff --git a/osu.Game/Overlays/Options/SkinSection.cs b/osu.Game/Overlays/Options/SkinSection.cs index de88570a0e..f9f7587e72 100644 --- a/osu.Game/Overlays/Options/SkinSection.cs +++ b/osu.Game/Overlays/Options/SkinSection.cs @@ -62,7 +62,6 @@ namespace osu.Game.Overlays.Options LabelText = "Always use skin cursor", Bindable = config.GetBindable(OsuConfig.UseSkinCursor) }, - new SpriteText { Text = "Cursor size: TODO slider" }, new SliderOption { LabelText = "Cursor size", From d1f68abab960bcc54225b49516ae247114866e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=AF=E5=8D=81=E5=85=AD=E5=A4=9C?= Date: Tue, 20 Dec 2016 15:50:50 +0800 Subject: [PATCH 50/71] Remove unsupported file format --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 12a26dafa8..5a7f9b8494 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -25,7 +25,6 @@ namespace osu.Game.Beatmaps.Formats AddDecoder(@"osu file format v12"); AddDecoder(@"osu file format v11"); AddDecoder(@"osu file format v10"); - AddDecoder(@"osu file format v9"); // TODO: Not sure how far back to go, or differences between versions } From 02f6e461052922107eb304c4529217a5ebfcc303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=AF=E5=8D=81=E5=85=AD=E5=A4=9C?= Date: Tue, 20 Dec 2016 23:56:49 +0800 Subject: [PATCH 51/71] Add support for v9 beatmaps --- osu.Game/Database/BeatmapDatabase.cs | 15 ++++++++++---- osu.Game/Database/BeatmapInfo.cs | 8 ++++++-- osu.Game/Database/BeatmapSetInfo.cs | 24 ++++++++++++----------- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 896e742989..e1975e8a0e 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -69,8 +69,15 @@ namespace osu.Game.Database using (var reader = ArchiveReader.GetReader(storage, path)) metadata = reader.ReadMetadata(); - if (connection.Table().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0) - return; // TODO: Update this beatmap instead + if (metadata.BeatmapSetID != -1) + { + if (connection.Table().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0) + return; // TODO: Update this beatmap instead + } + else + { + // TODO: Another method is required to determine whether two beatmaps with no BeatmapSetID are equal. + } if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader { @@ -144,13 +151,13 @@ namespace osu.Game.Database public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) { - var beatmapSetInfo = Query().FirstOrDefault(s => s.BeatmapSetID == beatmapInfo.BeatmapSetID); + var beatmapSetInfo = Query().FirstOrDefault(s => s.ID == beatmapInfo.BeatmapSetInfoID); //we need metadata GetChildren(beatmapSetInfo); if (beatmapSetInfo == null) - throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetID} is not in the local database."); + throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); if (beatmapInfo.Metadata == null) beatmapInfo.Metadata = beatmapSetInfo.Metadata; diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index be47891016..6b0b124020 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -13,12 +13,16 @@ namespace osu.Game.Database { public class BeatmapInfo : IEquatable { - [PrimaryKey] + [PrimaryKey, AutoIncrement] + public int ID { get; set; } + public int BeatmapID { get; set; } - [ForeignKey(typeof(BeatmapSetInfo))] public int BeatmapSetID { get; set; } + [ForeignKey(typeof(BeatmapSetInfo))] + public int BeatmapSetInfoID { get; set; } + [ManyToOne] public BeatmapSetInfo BeatmapSet { get; set; } diff --git a/osu.Game/Database/BeatmapSetInfo.cs b/osu.Game/Database/BeatmapSetInfo.cs index 0a83753963..de90a4ed2c 100644 --- a/osu.Game/Database/BeatmapSetInfo.cs +++ b/osu.Game/Database/BeatmapSetInfo.cs @@ -10,20 +10,22 @@ namespace osu.Game.Database { public class BeatmapSetInfo { - [PrimaryKey] - public int BeatmapSetID { get; set; } - + [PrimaryKey, AutoIncrement] + public int ID { get; set; } + + public int BeatmapSetID { get; set; } + [OneToOne(CascadeOperations = CascadeOperation.All)] - public BeatmapMetadata Metadata { get; set; } - - [NotNull, ForeignKey(typeof(BeatmapMetadata))] + public BeatmapMetadata Metadata { get; set; } + + [NotNull, ForeignKey(typeof(BeatmapMetadata))] public int BeatmapMetadataID { get; set; } - [OneToMany(CascadeOperations = CascadeOperation.All)] - public List Beatmaps { get; set; } - - public string Hash { get; set; } - + [OneToMany(CascadeOperations = CascadeOperation.All)] + public List Beatmaps { get; set; } + + public string Hash { get; set; } + public string Path { get; set; } } } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 3a74c42029..b14dd24fd7 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -332,7 +332,7 @@ namespace osu.Game.Screens.Select private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game) { - beatmapSet = database.GetWithChildren(beatmapSet.BeatmapSetID); + beatmapSet = database.GetWithChildren(beatmapSet.ID); beatmapSet.Beatmaps.ForEach(b => { database.GetChildren(b); From ef11c3f38930b5da513b78510d73bac669c5463a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=AF=E5=8D=81=E5=85=AD=E5=A4=9C?= Date: Wed, 21 Dec 2016 14:47:56 +0800 Subject: [PATCH 52/71] Add default Beatmap ID --- osu.Game/Database/BeatmapDatabase.cs | 12 +++--------- osu.Game/Database/BeatmapInfo.cs | 6 +++--- osu.Game/Database/BeatmapMetadata.cs | 5 +++-- osu.Game/Database/BeatmapSetInfo.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index e1975e8a0e..1c30e7af4b 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -69,15 +69,9 @@ namespace osu.Game.Database using (var reader = ArchiveReader.GetReader(storage, path)) metadata = reader.ReadMetadata(); - if (metadata.BeatmapSetID != -1) - { - if (connection.Table().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0) - return; // TODO: Update this beatmap instead - } - else - { - // TODO: Another method is required to determine whether two beatmaps with no BeatmapSetID are equal. - } + if (metadata.BeatmapSetID != -1 && + connection.Table().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0) + return; // TODO: Update this beatmap instead if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader { diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 6b0b124020..c8ca99f7d4 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -16,9 +16,9 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int ID { get; set; } - public int BeatmapID { get; set; } + public int BeatmapID { get; set; } = 0; - public int BeatmapSetID { get; set; } + public int BeatmapSetID { get; set; } = -1; [ForeignKey(typeof(BeatmapSetInfo))] public int BeatmapSetInfoID { get; set; } @@ -75,7 +75,7 @@ namespace osu.Game.Database public bool Equals(BeatmapInfo other) { - return BeatmapID == other?.BeatmapID; + return ID == other?.ID; } public bool AudioEquals(BeatmapInfo other) => other != null && diff --git a/osu.Game/Database/BeatmapMetadata.cs b/osu.Game/Database/BeatmapMetadata.cs index 45b7b8de0f..4df4424450 100644 --- a/osu.Game/Database/BeatmapMetadata.cs +++ b/osu.Game/Database/BeatmapMetadata.cs @@ -9,8 +9,9 @@ namespace osu.Game.Database { [PrimaryKey, AutoIncrement] public int ID { get; set; } - - public int BeatmapSetID { get; set; } + + public int BeatmapSetID { get; set; } = -1; + public string Title { get; set; } public string TitleUnicode { get; set; } public string Artist { get; set; } diff --git a/osu.Game/Database/BeatmapSetInfo.cs b/osu.Game/Database/BeatmapSetInfo.cs index de90a4ed2c..44c0b1a3d2 100644 --- a/osu.Game/Database/BeatmapSetInfo.cs +++ b/osu.Game/Database/BeatmapSetInfo.cs @@ -13,7 +13,7 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int ID { get; set; } - public int BeatmapSetID { get; set; } + public int BeatmapSetID { get; set; } = -1; [OneToOne(CascadeOperations = CascadeOperation.All)] public BeatmapMetadata Metadata { get; set; } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index b14dd24fd7..c9b514f87b 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -305,7 +305,7 @@ namespace osu.Game.Screens.Select if (!beatmap.Equals(Beatmap?.BeatmapInfo)) { - if (beatmap.BeatmapSetID == Beatmap?.BeatmapInfo.BeatmapSetID) + if (beatmap.BeatmapSetInfoID == Beatmap?.BeatmapInfo.BeatmapSetInfoID) sampleChangeDifficulty.Play(); else { From e578e50721b35523084f470f7651442261010ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=AF=E5=8D=81=E5=85=AD=E5=A4=9C?= Date: Wed, 21 Dec 2016 16:29:57 +0800 Subject: [PATCH 53/71] Add support for old beatmaps --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 12a26dafa8..1386471ba0 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -26,6 +26,10 @@ namespace osu.Game.Beatmaps.Formats AddDecoder(@"osu file format v11"); AddDecoder(@"osu file format v10"); AddDecoder(@"osu file format v9"); + AddDecoder(@"osu file format v8"); + AddDecoder(@"osu file format v7"); + AddDecoder(@"osu file format v6"); + AddDecoder(@"osu file format v5"); // TODO: Not sure how far back to go, or differences between versions } From 00c08cb882d6c21e404b3a3db88f01e54b0c8da4 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 23 Dec 2016 14:55:33 -0500 Subject: [PATCH 54/71] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 6b719f3140..885c7c7722 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ Rhythm is just a *click* away. The future of osu! and the beginning of an open era! +# Status + +This is still heavily under development and is not intended for end-user use. This repository is intended for developer collaboration. You're welcome to try and use it but please do not submit bug reports without a patch. Please do not ask for help building or using this software. + # Requirements - A desktop platform which can compile .NET 4.5. From 5b3219064192fb6cd4d8c56d20e3d8965c8fd576 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 28 Dec 2016 00:06:45 -0500 Subject: [PATCH 55/71] Add ISSUE_TEMPLATE.md --- ISSUE_TEMPLATE.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 ISSUE_TEMPLATE.md diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..ff930b07a3 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,9 @@ +osu!lazer is currently in early stages of development and is not yet ready for end users. Please avoid creating issues or bugs if you do not personally intend to fix them. Some acceptable topics include: + +- Discussions about technical design decisions +- Bugs that you have found and are personally willing and able to fix +- TODO lists of smaller tasks around larger features + +Basically, issues are not a place for you to get help. They are a place for developers to collaborate on the game. + +If your issue qualifies, replace this text with a detailed description of your issue with as much relevant information as you can provide. From 794e4663d863fd1304ed798e7f26d54689a6e48a Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 4 Jan 2017 01:00:08 +0800 Subject: [PATCH 56/71] Fix PreferUnicode changing when nothing to play. --- osu.Game/Overlays/MusicController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index c69624bfda..4825b92dbe 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -235,7 +235,9 @@ namespace osu.Game.Overlays void preferUnicode_changed(object sender, EventArgs e) { - updateDisplay(current, TransformDirection.None); + if (current != null) + updateDisplay(current, TransformDirection.None); + //else: we can show something in correspond laguage } private void workingChanged(object sender = null, EventArgs e = null) From 6690d1bd7259c92b8f545f1fb9b82807aa1688e5 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 4 Jan 2017 02:12:18 +0800 Subject: [PATCH 57/71] Move logic into updateDisplay. --- osu.Game/Overlays/MusicController.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 4825b92dbe..449d588f26 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -235,9 +235,7 @@ namespace osu.Game.Overlays void preferUnicode_changed(object sender, EventArgs e) { - if (current != null) - updateDisplay(current, TransformDirection.None); - //else: we can show something in correspond laguage + updateDisplay(current, TransformDirection.None); } private void workingChanged(object sender = null, EventArgs e = null) @@ -320,7 +318,7 @@ namespace osu.Game.Overlays { Task.Run(() => { - if (beatmap.Beatmap == null) + if (beatmap?.Beatmap == null) //todo: we may need to display some default text here (currently in the constructor). return; From a1f8c0df64e84332a5351d11e5966b6530bc37b3 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 3 Jan 2017 23:00:28 -0500 Subject: [PATCH 58/71] Style dropdown to match osu!stable --- osu.Game/Overlays/Options/DropdownOption.cs | 79 ++++++++++++++------- 1 file changed, 55 insertions(+), 24 deletions(-) diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index 3cdc6da2ab..ec2bad5bdc 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; +using osu.Game.Graphics; namespace osu.Game.Overlays.Options { @@ -97,6 +98,7 @@ namespace osu.Game.Overlays.Options { ComboBox.CornerRadius = 4; DropDown.CornerRadius = 4; + DropDown.Masking = true; } protected override void AnimateOpen() @@ -121,45 +123,74 @@ namespace osu.Game.Overlays.Options private class StyledDropDownComboBox : DropDownComboBox { - protected override Color4 BackgroundColour => new Color4(255, 255, 255, 100); - protected override Color4 BackgroundColourHover => Color4.HotPink; + protected override Color4 BackgroundColour => new Color4(0, 0, 0, 128); + protected override Color4 BackgroundColourHover => new Color4(187, 17, 119, 255); + + private SpriteText label; + protected override string Label + { + get { return label.Text; } + set { label.Text = value; } + } public StyledDropDownComboBox() { Foreground.Padding = new MarginPadding(4); + + Children = new[] + { + label = new SpriteText(), + new TextAwesome + { + Icon = FontAwesome.fa_chevron_down, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Margin = new MarginPadding { Right = 4 }, + } + }; } } private class StyledDropDownMenuItem : DropDownMenuItem { + protected override Color4 BackgroundColour => new Color4(0, 0, 0, 128); + protected override Color4 BackgroundColourSelected => new Color4(0, 0, 0, 128); + protected override Color4 BackgroundColourHover => new Color4(187, 17, 119, 255); + public StyledDropDownMenuItem(string text, U value) : base(text, value) { AutoSizeAxes = Axes.None; Height = 0; Foreground.Padding = new MarginPadding(2); - } - protected override void OnSelectChange() - { - if (!IsLoaded) - return; - - FormatBackground(); - FormatCaret(); - FormatLabel(); - } - - protected override void FormatCaret() - { - (Caret as SpriteText).Text = IsSelected ? @"+" : @"-"; - } - - protected override void FormatLabel() - { - if (IsSelected) - (Label as SpriteText).Text = @"*" + Value + @"*"; - else - (Label as SpriteText).Text = Value.ToString(); + Children = new[] + { + new FlowContainer + { + Direction = FlowDirection.HorizontalOnly, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new Framework.Graphics.Containers.Container + { + Width = 20, + Height = 20, + Margin = new MarginPadding { Top = 1, Right = 3 }, + Children = new[] + { + new TextAwesome + { + Icon = FontAwesome.fa_chevron_right, + Colour = Color4.Black, + Anchor = Anchor.Centre, + } + } + }, + new SpriteText { Text = text } + } + } + }; } } } From af4aeeab095d5cf53843d8757cd568768fc11d8f Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 4 Jan 2017 01:14:25 -0500 Subject: [PATCH 59/71] Update following framework changes --- osu.Game/Overlays/Options/DropdownOption.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index ec2bad5bdc..5d6fc0d835 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Reflection; @@ -69,9 +70,6 @@ namespace osu.Game.Overlays.Options Direction = FlowDirection.VerticalOnly; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - var items = typeof(T).GetFields().Where(f => !f.IsSpecialName).Zip( - (T[])Enum.GetValues(typeof(T)), (a, b) => new Tuple( - a.GetCustomAttribute()?.Description ?? a.Name, b)); Children = new Drawable[] { text = new SpriteText { Alpha = 0 }, @@ -79,7 +77,7 @@ namespace osu.Game.Overlays.Options { Margin = new MarginPadding { Top = 5 }, RelativeSizeAxes = Axes.X, - Items = items.Select(item => new StyledDropDownMenuItem(item.Item1, item.Item2)) + Items = (T[])Enum.GetValues(typeof(T)), } }; dropdown.ValueChanged += Dropdown_ValueChanged; @@ -93,6 +91,17 @@ namespace osu.Game.Overlays.Options { return new StyledDropDownComboBox(); } + + protected override IEnumerable> GetDropDownItems(IEnumerable values) + { + return values.Select(v => + { + var field = typeof(U).GetField(Enum.GetName(typeof(U), v)); + return new StyledDropDownMenuItem( + field.GetCustomAttribute()?.Description ?? field.Name, v); + }); + + } public StyledDropDownMenu() { From b27139c2bdf36123c4e0a6c3b7e15670ed332473 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 5 Jan 2017 00:57:19 -0500 Subject: [PATCH 60/71] Simplify layout of dropdown menu item --- osu.Game/Overlays/Options/DropdownOption.cs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index 5d6fc0d835..150dddc13d 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -107,7 +107,6 @@ namespace osu.Game.Overlays.Options { ComboBox.CornerRadius = 4; DropDown.CornerRadius = 4; - DropDown.Masking = true; } protected override void AnimateOpen() @@ -181,20 +180,13 @@ namespace osu.Game.Overlays.Options AutoSizeAxes = Axes.Y, Children = new Drawable[] { - new Framework.Graphics.Containers.Container + new TextAwesome { - Width = 20, - Height = 20, - Margin = new MarginPadding { Top = 1, Right = 3 }, - Children = new[] - { - new TextAwesome - { - Icon = FontAwesome.fa_chevron_right, - Colour = Color4.Black, - Anchor = Anchor.Centre, - } - } + Icon = FontAwesome.fa_chevron_right, + Colour = Color4.Black, + Margin = new MarginPadding { Right = 3 }, + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, }, new SpriteText { Text = text } } From 4899d88d190c965bc85271892b547e3f2c338a60 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 5 Jan 2017 02:10:05 -0500 Subject: [PATCH 61/71] Update framework --- osu-framework | 2 +- osu.Game/Overlays/Options/DropdownOption.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu-framework b/osu-framework index 45bff5838d..4ce11f434d 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 45bff5838d133d918547e90bd74c9d0d5fadecc1 +Subproject commit 4ce11f434dccb07b35b64618bf3db97c09d310a5 diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index 150dddc13d..e843e15993 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -111,7 +111,7 @@ namespace osu.Game.Overlays.Options protected override void AnimateOpen() { - foreach (StyledDropDownMenuItem child in DropDownList.Children) + foreach (StyledDropDownMenuItem child in DropDownItemsContainer.Children) { child.FadeIn(200); child.ResizeTo(new Vector2(1, 24), 200); @@ -121,7 +121,7 @@ namespace osu.Game.Overlays.Options protected override void AnimateClose() { - foreach (StyledDropDownMenuItem child in DropDownList.Children) + foreach (StyledDropDownMenuItem child in DropDownItemsContainer.Children) { child.ResizeTo(new Vector2(1, 0), 200); child.FadeOut(200); From 8bfcfbc276233220b1a97b04982f22ded3e20c4d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 Jan 2017 20:51:57 +0800 Subject: [PATCH 62/71] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 4ce11f434d..b84b391c7f 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4ce11f434dccb07b35b64618bf3db97c09d310a5 +Subproject commit b84b391c7fed14023ad309f42169909f4151d69b From 8ba5c1c15de7636b8bcd95069c1215f1fb30c3f4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 Jan 2017 20:52:19 +0800 Subject: [PATCH 63/71] Fix not being able to hit two stacked circles by pressing both buttons/keys on the same frame. --- osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index b2179d95d0..5143bd4af8 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -42,6 +42,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables Colour = osuObject.Colour, Hit = () => { + if (Judgement.Result.HasValue) return false; + ((PositionalJudgementInfo)Judgement).PositionOffset = Vector2.Zero; //todo: set to correct value UpdateJudgement(true); return true; From 651ea1b0d672f0ec93f4feea8e95529f0b089475 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 Jan 2017 21:01:48 +0800 Subject: [PATCH 64/71] Update resources. --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index e24414a277..30031c02af 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit e24414a277e407ae2438e4b6d9fa9c7992dd6485 +Subproject commit 30031c02aff374f0c5558f2d732614559301f658 From acfbf2e32e9c0615e080478a5a6b465095b2b042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=AF=E5=8D=81=E5=85=AD=E5=A4=9C?= Date: Mon, 9 Jan 2017 21:05:01 +0800 Subject: [PATCH 65/71] Add prefix Online to BeatmapID and BeatmapSetID --- .../Tests/TestCasePlaySongSelect.cs | 10 +++++----- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 8 +++++--- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 6 +++--- osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs | 5 +++-- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 6 +++--- osu.Game/Database/BeatmapDatabase.cs | 8 ++++---- osu.Game/Database/BeatmapInfo.cs | 4 ++-- osu.Game/Database/BeatmapMetadata.cs | 2 +- osu.Game/Database/BeatmapSetInfo.cs | 2 +- 9 files changed, 27 insertions(+), 24 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index a291f4f65f..adfa2556a0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -49,12 +49,12 @@ namespace osu.Desktop.VisualTests.Tests { return new BeatmapSetInfo { - BeatmapSetID = 1234 + i, + OnlineBeatmapSetID = 1234 + i, Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249", Path = string.Empty, Metadata = new BeatmapMetadata { - BeatmapSetID = 1234 + i, + OnlineBeatmapSetID = 1234 + i, Artist = "MONACA", Title = "Black Song", Author = "Some Guy", @@ -63,7 +63,7 @@ namespace osu.Desktop.VisualTests.Tests { new BeatmapInfo { - BeatmapID = 1234 + i, + OnlineBeatmapID = 1234 + i, Mode = PlayMode.Osu, Path = "normal.osu", Version = "Normal", @@ -74,7 +74,7 @@ namespace osu.Desktop.VisualTests.Tests }, new BeatmapInfo { - BeatmapID = 1235 + i, + OnlineBeatmapID = 1235 + i, Mode = PlayMode.Osu, Path = "hard.osu", Version = "Hard", @@ -85,7 +85,7 @@ namespace osu.Desktop.VisualTests.Tests }, new BeatmapInfo { - BeatmapID = 1236 + i, + OnlineBeatmapID = 1236 + i, Mode = PlayMode.Osu, Path = "insane.osu", Version = "Insane", diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index d52eace965..9a988d6eff 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -23,7 +23,8 @@ namespace osu.Game.Tests.Beatmaps.Formats OsuLegacyDecoder.Register(); Ruleset.Register(new OsuRuleset()); } - [Test] + + [Test] public void TestDecodeMetadata() { var decoder = new OsuLegacyDecoder(); @@ -31,7 +32,7 @@ namespace osu.Game.Tests.Beatmaps.Formats { var beatmap = decoder.Decode(new StreamReader(stream)); var meta = beatmap.BeatmapInfo.Metadata; - Assert.AreEqual(241526, meta.BeatmapSetID); + Assert.AreEqual(241526, meta.OnlineBeatmapSetID); Assert.AreEqual("Soleily", meta.Artist); Assert.AreEqual("Soleily", meta.ArtistUnicode); Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile); @@ -125,7 +126,8 @@ namespace osu.Game.Tests.Beatmaps.Formats } } - [Test] public void TestDecodeHitObjects() + [Test] + public void TestDecodeHitObjects() { var decoder = new OsuLegacyDecoder(); using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 37d89b6497..165181a332 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -83,7 +83,7 @@ namespace osu.Game.Tests.Beatmaps.IO Action waitAction = () => { while ((resultSets = osu.Dependencies.Get() - .Query().Where(s => s.BeatmapSetID == 241526)).Count() != 1) + .Query().Where(s => s.OnlineBeatmapSetID == 241526)).Count() != 1) Thread.Sleep(1); }; @@ -100,7 +100,7 @@ namespace osu.Game.Tests.Beatmaps.IO waitAction = () => { while ((resultBeatmaps = osu.Dependencies.Get() - .Query().Where(s => s.BeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) + .Query().Where(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) Thread.Sleep(1); }; @@ -113,7 +113,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count()); foreach (BeatmapInfo b in resultBeatmaps) - Assert.IsTrue(set.Beatmaps.Any(c => c.BeatmapID == b.BeatmapID)); + Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID)); Assert.IsTrue(set.Beatmaps.Count > 0); diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index 1343ae7241..a09d0c2f86 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -52,7 +52,7 @@ namespace osu.Game.Tests.Beatmaps.IO { var reader = new OszArchiveReader(osz); var meta = reader.ReadMetadata(); - Assert.AreEqual(241526, meta.BeatmapSetID); + Assert.AreEqual(241526, meta.OnlineBeatmapSetID); Assert.AreEqual("Soleily", meta.Artist); Assert.AreEqual("Soleily", meta.ArtistUnicode); Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile); @@ -65,7 +65,8 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.AreEqual("Renatus", meta.TitleUnicode); } } - [Test] + + [Test] public void TestReadFile() { using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz")) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 1386471ba0..33a39ca3b5 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -136,11 +136,11 @@ namespace osu.Game.Beatmaps.Formats beatmap.BeatmapInfo.Metadata.Tags = val; break; case @"BeatmapID": - beatmap.BeatmapInfo.BeatmapID = int.Parse(val); + beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(val); break; case @"BeatmapSetID": - beatmap.BeatmapInfo.BeatmapSetID = int.Parse(val); - metadata.BeatmapSetID = int.Parse(val); + beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(val); + metadata.OnlineBeatmapSetID = int.Parse(val); break; } } diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 1c30e7af4b..eda5f1b9a3 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -69,8 +69,8 @@ namespace osu.Game.Database using (var reader = ArchiveReader.GetReader(storage, path)) metadata = reader.ReadMetadata(); - if (metadata.BeatmapSetID != -1 && - connection.Table().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0) + if (metadata.OnlineBeatmapSetID.HasValue && + connection.Table().Count(b => b.OnlineBeatmapSetID == metadata.OnlineBeatmapSetID) != 0) return; // TODO: Update this beatmap instead if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader @@ -87,7 +87,7 @@ namespace osu.Game.Database } var beatmapSet = new BeatmapSetInfo { - BeatmapSetID = metadata.BeatmapSetID, + OnlineBeatmapSetID = metadata.OnlineBeatmapSetID, Beatmaps = new List(), Path = path, Hash = hash, @@ -140,7 +140,7 @@ namespace osu.Game.Database public BeatmapSetInfo GetBeatmapSet(int id) { - return Query().FirstOrDefault(s => s.BeatmapSetID == id); + return Query().FirstOrDefault(s => s.OnlineBeatmapSetID == id); } public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index c8ca99f7d4..ef5f00b634 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -16,9 +16,9 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int ID { get; set; } - public int BeatmapID { get; set; } = 0; + public int? OnlineBeatmapID { get; set; } = null; - public int BeatmapSetID { get; set; } = -1; + public int? OnlineBeatmapSetID { get; set; } = null; [ForeignKey(typeof(BeatmapSetInfo))] public int BeatmapSetInfoID { get; set; } diff --git a/osu.Game/Database/BeatmapMetadata.cs b/osu.Game/Database/BeatmapMetadata.cs index 4df4424450..e0d2f0c5f7 100644 --- a/osu.Game/Database/BeatmapMetadata.cs +++ b/osu.Game/Database/BeatmapMetadata.cs @@ -10,7 +10,7 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int ID { get; set; } - public int BeatmapSetID { get; set; } = -1; + public int? OnlineBeatmapSetID { get; set; } = null; public string Title { get; set; } public string TitleUnicode { get; set; } diff --git a/osu.Game/Database/BeatmapSetInfo.cs b/osu.Game/Database/BeatmapSetInfo.cs index 44c0b1a3d2..60637f8736 100644 --- a/osu.Game/Database/BeatmapSetInfo.cs +++ b/osu.Game/Database/BeatmapSetInfo.cs @@ -13,7 +13,7 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int ID { get; set; } - public int BeatmapSetID { get; set; } = -1; + public int? OnlineBeatmapSetID { get; set; } = null; [OneToOne(CascadeOperations = CascadeOperation.All)] public BeatmapMetadata Metadata { get; set; } From 70ecf48ca76b553d2cf4224f6884c9ba31e163cb Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 9 Jan 2017 17:18:47 -0500 Subject: [PATCH 66/71] Add central color class I didn't move _every_ color here, but most of them. The ones I left behind are mostly just shades of gray. Closes #126 --- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 212 +++++++++--------- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 193 ++++++++-------- osu.Game/Beatmaps/Drawables/Panel.cs | 7 +- osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 11 +- osu.Game/Graphics/OsuColor.cs | 62 +++++ osu.Game/Graphics/UserInterface/BackButton.cs | 4 +- osu.Game/Graphics/UserInterface/OsuButton.cs | 2 +- osu.Game/Modes/Objects/HitObject.cs | 3 +- osu.Game/Online/Chat/Drawables/ChatLine.cs | 2 +- osu.Game/Overlays/MusicController.cs | 4 +- osu.Game/Overlays/Options/CheckBoxOption.cs | 13 +- osu.Game/Overlays/Options/DropdownOption.cs | 10 +- osu.Game/Overlays/Options/OptionsSection.cs | 2 +- osu.Game/Overlays/Options/SidebarButton.cs | 4 +- osu.Game/Overlays/Options/SliderOption.cs | 10 +- osu.Game/Overlays/OptionsOverlay.cs | 3 +- .../Overlays/Toolbar/ToolbarModeButton.cs | 4 +- .../Overlays/Toolbar/ToolbarModeSelector.cs | 3 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 5 +- osu.Game/Screens/Select/PlaySongSelect.cs | 3 +- osu.Game/osu.Game.csproj | 1 + 21 files changed, 312 insertions(+), 246 deletions(-) create mode 100644 osu.Game/Graphics/OsuColor.cs diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index e8b60bab81..c57e361916 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -1,72 +1,68 @@ -//Copyright (c) 2007-2016 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.Graphics; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; -using osu.Framework.MathUtils; -using osu.Game.Database; -using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.UserInterface; -using OpenTK; -using OpenTK.Graphics; +//Copyright (c) 2007-2016 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.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.MathUtils; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.UserInterface; +using OpenTK; +using OpenTK.Graphics; using osu.Framework.Input; -namespace osu.Game.Beatmaps.Drawables -{ - class BeatmapPanel : Panel - { - public BeatmapInfo Beatmap; - private Sprite background; - +namespace osu.Game.Beatmaps.Drawables +{ + class BeatmapPanel : Panel + { + public BeatmapInfo Beatmap; + private Sprite background; + public Action GainedSelection; public Action StartRequested; - Color4 deselectedColour = new Color4(20, 43, 51, 255); - protected override void Selected() { base.Selected(); GainedSelection?.Invoke(this); - background.ColourInfo = ColourInfo.GradientVertical( - new Color4(20, 43, 51, 255), - new Color4(40, 86, 102, 255)); - } - + background.ColourInfo = OsuColor.BeatmapPanelSelected; + } + protected override void Deselected() { base.Deselected(); - background.Colour = deselectedColour; - } - + background.Colour = OsuColor.BeatmapPanelUnselected; + } + protected override bool OnClick(InputState state) { if (State == PanelSelectedState.Selected) StartRequested?.Invoke(this); return base.OnClick(state); - } - - public BeatmapPanel(BeatmapInfo beatmap) + } + + public BeatmapPanel(BeatmapInfo beatmap) { Beatmap = beatmap; - Height *= 0.60f; - - Children = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - }, - new Triangles + Height *= 0.60f; + + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + new Triangles { // The border is drawn in the shader of the children. Being additive, triangles would over-emphasize // the border wherever they cross it, and thus they get their own masking container without a border. @@ -74,70 +70,70 @@ namespace osu.Game.Beatmaps.Drawables CornerRadius = Content.CornerRadius, RelativeSizeAxes = Axes.Both, BlendingMode = BlendingMode.Additive, - Colour = deselectedColour, - }, - new FlowContainer - { - Padding = new MarginPadding(5), - Direction = FlowDirection.HorizontalOnly, - AutoSizeAxes = Axes.Both, + Colour = OsuColor.BeatmapPanelUnselected, + }, + new FlowContainer + { + Padding = new MarginPadding(5), + Direction = FlowDirection.HorizontalOnly, + AutoSizeAxes = Axes.Both, Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Children = new Drawable[] - { - new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)) + Origin = Anchor.CentreLeft, + Children = new Drawable[] + { + new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)) { Scale = new Vector2(1.8f), Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - }, - new FlowContainer - { - Padding = new MarginPadding { Left = 5 }, - Spacing = new Vector2(0, 5), - Direction = FlowDirection.VerticalOnly, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new FlowContainer - { - Direction = FlowDirection.HorizontalOnly, - AutoSizeAxes = Axes.Both, - Spacing = new Vector2(4, 0), - Children = new[] - { - new SpriteText - { - Font = @"Exo2.0-Medium", - Text = beatmap.Version, - TextSize = 20, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft - }, - new SpriteText - { - Font = @"Exo2.0-Medium", - Text = "mapped by", - TextSize = 16, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft - }, - new SpriteText - { - Font = @"Exo2.0-MediumItalic", - Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}", - TextSize = 16, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft - }, - } - }, - new StarCounter { Count = beatmap.BaseDifficulty?.OverallDifficulty ?? 5, StarSize = 8 } - } - } - } - } - }; + }, + new FlowContainer + { + Padding = new MarginPadding { Left = 5 }, + Spacing = new Vector2(0, 5), + Direction = FlowDirection.VerticalOnly, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new FlowContainer + { + Direction = FlowDirection.HorizontalOnly, + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(4, 0), + Children = new[] + { + new SpriteText + { + Font = @"Exo2.0-Medium", + Text = beatmap.Version, + TextSize = 20, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new SpriteText + { + Font = @"Exo2.0-Medium", + Text = "mapped by", + TextSize = 16, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new SpriteText + { + Font = @"Exo2.0-MediumItalic", + Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}", + TextSize = 16, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + } + }, + new StarCounter { Count = beatmap.BaseDifficulty?.OverallDifficulty ?? 5, StarSize = 8 } + } + } + } + } + }; } - } -} + } +} diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 7234e2ad8b..98a010efe1 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -1,74 +1,74 @@ -//Copyright (c) 2007-2016 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.Configuration; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; -using osu.Game.Configuration; -using osu.Game.Graphics; -using OpenTK; -using OpenTK.Graphics; - +//Copyright (c) 2007-2016 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.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Game.Configuration; +using osu.Game.Graphics; +using OpenTK; +using OpenTK.Graphics; + namespace osu.Game.Beatmaps.Drawables { - class BeatmapSetHeader : Panel - { - public Action GainedSelection; - private SpriteText title, artist; - private OsuConfigManager config; - private Bindable preferUnicode; - private WorkingBeatmap beatmap; - - public BeatmapSetHeader(WorkingBeatmap beatmap) - { - this.beatmap = beatmap; - - Children = new Drawable[] - { + class BeatmapSetHeader : Panel + { + public Action GainedSelection; + private SpriteText title, artist; + private OsuConfigManager config; + private Bindable preferUnicode; + private WorkingBeatmap beatmap; + + public BeatmapSetHeader(WorkingBeatmap beatmap) + { + this.beatmap = beatmap; + + Children = new Drawable[] + { new PanelBackground(beatmap) { RelativeSizeAxes = Axes.Both, }, - new FlowContainer - { - Direction = FlowDirection.VerticalOnly, - Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 }, - AutoSizeAxes = Axes.Both, - Children = new[] - { - title = new SpriteText - { - Font = @"Exo2.0-BoldItalic", - Text = beatmap.BeatmapSetInfo.Metadata.Title, - TextSize = 22, - Shadow = true, - }, - artist = new SpriteText - { - Margin = new MarginPadding { Top = -1 }, - Font = @"Exo2.0-SemiBoldItalic", - Text = beatmap.BeatmapSetInfo.Metadata.Artist, - TextSize = 17, - Shadow = true, - }, - new FlowContainer - { - Margin = new MarginPadding { Top = 5 }, - AutoSizeAxes = Axes.Both, - Children = new[] - { - new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)), - new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(246, 101, 166, 255)), - } - } - } - } - }; + new FlowContainer + { + Direction = FlowDirection.VerticalOnly, + Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 }, + AutoSizeAxes = Axes.Both, + Children = new[] + { + title = new SpriteText + { + Font = @"Exo2.0-BoldItalic", + Text = beatmap.BeatmapSetInfo.Metadata.Title, + TextSize = 22, + Shadow = true, + }, + artist = new SpriteText + { + Margin = new MarginPadding { Top = -1 }, + Font = @"Exo2.0-SemiBoldItalic", + Text = beatmap.BeatmapSetInfo.Metadata.Artist, + TextSize = 17, + Shadow = true, + }, + new FlowContainer + { + Margin = new MarginPadding { Top = 5 }, + AutoSizeAxes = Axes.Both, + Children = new[] + { + new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)), + new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(246, 101, 166, 255)), + } + } + } + } + }; } protected override void LoadComplete() @@ -81,8 +81,8 @@ namespace osu.Game.Beatmaps.Drawables { base.Selected(); GainedSelection?.Invoke(this); - } - + } + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { @@ -90,31 +90,32 @@ namespace osu.Game.Beatmaps.Drawables preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); preferUnicode.ValueChanged += preferUnicode_changed; - preferUnicode_changed(preferUnicode, null); + preferUnicode_changed(preferUnicode, null); } - private void preferUnicode_changed(object sender, EventArgs e) - { - title.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Title, beatmap.BeatmapSetInfo.Metadata.TitleUnicode); - artist.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Artist, beatmap.BeatmapSetInfo.Metadata.ArtistUnicode); + + private void preferUnicode_changed(object sender, EventArgs e) + { + title.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Title, beatmap.BeatmapSetInfo.Metadata.TitleUnicode); + artist.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Artist, beatmap.BeatmapSetInfo.Metadata.ArtistUnicode); } protected override void Dispose(bool isDisposing) - { - if (preferUnicode != null) + { + if (preferUnicode != null) preferUnicode.ValueChanged -= preferUnicode_changed; base.Dispose(isDisposing); - } - + } + class PanelBackground : BufferedContainer - { - private readonly WorkingBeatmap working; - - public PanelBackground(WorkingBeatmap working) - { - this.working = working; - - CacheDrawnFrameBuffer = true; - + { + private readonly WorkingBeatmap working; + + public PanelBackground(WorkingBeatmap working) + { + this.working = working; + + CacheDrawnFrameBuffer = true; + Children = new[] { new FlowContainer @@ -128,34 +129,34 @@ namespace osu.Game.Beatmaps.Drawables Children = new[] { // The left half with no gradient applied - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - Width = 0.4f, + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Width = 0.4f, }, // Piecewise-linear gradient with 3 segments to make it appear smoother new Box { RelativeSizeAxes = Axes.Both, - ColourInfo = ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.9f)), + ColourInfo = OsuColor.BeatmapHeaderBackgroundA, Width = 0.05f, }, new Box { RelativeSizeAxes = Axes.Both, - ColourInfo = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)), + ColourInfo = OsuColor.BeatmapHeaderBackgroundB, Width = 0.2f, }, new Box { RelativeSizeAxes = Axes.Both, - ColourInfo = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)), + ColourInfo = OsuColor.BeatmapHeaderBackgroundC, Width = 0.05f, }, } - }, - }; + }, + }; } [BackgroundDependencyLoader] @@ -172,6 +173,6 @@ namespace osu.Game.Beatmaps.Drawables ForceRedraw(); }); } - } + } } } \ No newline at end of file diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index f97a5260d8..94fc3e8aae 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Transformations; using osu.Framework.Input; using OpenTK; using OpenTK.Graphics; +using osu.Game.Graphics; namespace osu.Game.Beatmaps.Drawables { @@ -35,7 +36,7 @@ namespace osu.Game.Beatmaps.Drawables RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 10, - BorderColour = new Color4(221, 255, 255, 255), + BorderColour = OsuColor.PanelBorder, }); } @@ -84,7 +85,7 @@ namespace osu.Game.Beatmaps.Drawables nestedContainer.EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, - Colour = new Color4(130, 204, 255, 150), + Colour = OsuColor.PanelGlowSelected, Radius = 20, Roundness = 10, }; @@ -98,7 +99,7 @@ namespace osu.Game.Beatmaps.Drawables Type = EdgeEffectType.Shadow, Offset = new Vector2(1), Radius = 10, - Colour = new Color4(0, 0, 0, 100), + Colour = OsuColor.PanelGlowUnselected, }; } diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 83cd60eca3..2a30900f16 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using osu.Game.Modes.Objects; using OpenTK.Graphics; +using osu.Game.Graphics; namespace osu.Game.Beatmaps.Formats { @@ -44,11 +45,11 @@ namespace osu.Game.Beatmaps.Formats public virtual void ApplyColours(Beatmap b) { - List colours = b.ComboColors ?? new List() { - new Color4(17, 136, 170, 255), - new Color4(102,136,0, 255), - new Color4(204,102,0, 255), - new Color4(121,9,13, 255), + List colours = b.ComboColors ?? new List { + OsuColor.Combo1, + OsuColor.Combo2, + OsuColor.Combo3, + OsuColor.Combo4, }; if (colours.Count == 0) return; diff --git a/osu.Game/Graphics/OsuColor.cs b/osu.Game/Graphics/OsuColor.cs new file mode 100644 index 0000000000..e516b38983 --- /dev/null +++ b/osu.Game/Graphics/OsuColor.cs @@ -0,0 +1,62 @@ +using System; +using OpenTK.Graphics; +using osu.Framework.Graphics.Colour; + +namespace osu.Game.Graphics +{ + public static class OsuColor + { + public static readonly Color4 OsuPink = new Color4(255, 102, 170, 255); + + public static readonly Color4 BeatmapPanelUnselected = new Color4(20, 43, 51, 255); + public static readonly ColourInfo BeatmapPanelSelected = ColourInfo.GradientVertical( + new Color4(20, 43, 51, 255), + new Color4(40, 86, 102, 255)); + + public static readonly ColourInfo BeatmapHeaderBackgroundA = + ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.9f)); + public static readonly ColourInfo BeatmapHeaderBackgroundB = + ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)); + public static readonly ColourInfo BeatmapHeaderBackgroundC = + ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)); + + public static readonly Color4 PanelBorder = new Color4(221, 255, 255, 255); + public static readonly Color4 PanelGlowSelected = new Color4(130, 204, 255, 150); + public static readonly Color4 PanelGlowUnselected = new Color4(0, 0, 0, 100); + + public static readonly Color4 Combo1 = new Color4(17, 136, 170, 255); + public static readonly Color4 Combo2 = new Color4(102, 136, 0, 255); + public static readonly Color4 Combo3 = new Color4(204, 102, 0, 255); + public static readonly Color4 Combo4 = new Color4(121, 9, 13, 255); + + public static readonly Color4 BackButtonLeft = new Color4(195, 40, 140, 255); + public static readonly Color4 BackButtonRight = new Color4(238, 51, 153, 255); + + public static readonly Color4 Button = new Color4(14, 132, 165, 255); + + public static readonly Color4 PlayButton = new Color4(238, 51, 153, 255); + + public static readonly Color4 MusicControllerBackground = new Color4(150, 150, 150, 255); + public static readonly Color4 MusicControllerProgress = new Color4(255, 204, 34, 255); + + public static readonly Color4 CheckBoxHover = new Color4(255, 221, 238, 255); + public static readonly Color4 CheckBoxGlow = new Color4(187, 17, 119, 0); + + public static readonly Color4 DropDownBackground = new Color4(0, 0, 0, 128); + public static readonly Color4 DropDownHover = new Color4(187, 17, 119, 255); + + public static readonly Color4 OptionSectionHeader = new Color4(247, 198, 35, 255); + + public static readonly Color4 SidebarButtonBackground = new Color4(60, 60, 60, 255); + public static readonly Color4 SidebarButtonSelectionIndicator = new Color4(247, 198, 35, 255); + + public static readonly Color4 SliderbarBackground = new Color4(255, 102, 170, 255); + public static readonly Color4 SliderbarNub = new Color4(255, 102, 170, 255); + + public static readonly Color4 ToolbarModeButtonIcon = new Color4(255, 194, 224, 255); + public static readonly Color4 ToolbarModeButtonIconActiveGlow = new Color4(255, 194, 224, 100); + + public static readonly Color4 BeatmapInfoWedgeBorder = new Color4(221, 255, 255, 255); + public static readonly Color4 BeatmapInfoWedgeGlow = new Color4(130, 204, 255, 150); + } +} \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index ade6cedc58..3203240581 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -46,7 +46,7 @@ namespace osu.Game.Graphics.UserInterface leftBox = new Box { RelativeSizeAxes = Axes.Both, - Colour = new Color4(195, 40, 140, 255), + Colour = OsuColor.BackButtonLeft, Shear = new Vector2(shear, 0), }, icon = new TextAwesome @@ -67,7 +67,7 @@ namespace osu.Game.Graphics.UserInterface { rightBox = new Box { - Colour = new Color4(238, 51, 153, 255), + Colour = OsuColor.BackButtonRight, Origin = Anchor.TopLeft, Anchor = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 476895e0b2..48922de6ae 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -12,7 +12,7 @@ namespace osu.Game.Graphics.UserInterface public OsuButton() { Height = 25; - Colour = new Color4(14, 132, 165, 255); + Colour = OsuColor.Button; } } } \ No newline at end of file diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Modes/Objects/HitObject.cs index 71839e7036..dbf95d658c 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Modes/Objects/HitObject.cs @@ -4,6 +4,7 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.Samples; using OpenTK.Graphics; +using osu.Game.Graphics; namespace osu.Game.Modes.Objects { @@ -17,7 +18,7 @@ namespace osu.Game.Modes.Objects public bool NewCombo { get; set; } - public Color4 Colour = new Color4(17, 136, 170, 255); + public Color4 Colour = OsuColor.Combo1; public double Duration => EndTime - StartTime; diff --git a/osu.Game/Online/Chat/Drawables/ChatLine.cs b/osu.Game/Online/Chat/Drawables/ChatLine.cs index 454f7beed7..2dd3425bda 100644 --- a/osu.Game/Online/Chat/Drawables/ChatLine.cs +++ b/osu.Game/Online/Chat/Drawables/ChatLine.cs @@ -35,7 +35,7 @@ namespace osu.Game.Online.Chat.Drawables { Text = Message.Timestamp.LocalDateTime.ToLongTimeString(), TextSize = text_size, - Colour = new Color4(128, 128, 128, 255) + Colour = Color4.Gray }, new SpriteText { diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 449d588f26..0ef986a4e6 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -171,7 +171,7 @@ namespace osu.Game.Overlays Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, Height = 10, - Colour = new Color4(255, 204, 34, 255), + Colour = OsuColor.MusicControllerProgress, SeekRequested = seek } }; @@ -393,7 +393,7 @@ namespace osu.Game.Overlays { sprite = new Sprite { - Colour = new Color4(150, 150, 150, 255), + Colour = OsuColor.MusicControllerBackground, FillMode = FillMode.Fill, }, new Box diff --git a/osu.Game/Overlays/Options/CheckBoxOption.cs b/osu.Game/Overlays/Options/CheckBoxOption.cs index 2ea176378c..f50fed844a 100644 --- a/osu.Game/Overlays/Options/CheckBoxOption.cs +++ b/osu.Game/Overlays/Options/CheckBoxOption.cs @@ -16,6 +16,7 @@ using osu.Framework.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; using osu.Framework.Input; +using osu.Game.Graphics; namespace osu.Game.Overlays.Options { @@ -141,21 +142,17 @@ namespace osu.Game.Overlays.Options const float border_width = 3; - Color4 hoverColour = new Color4(255, 221, 238, 255); - Color4 defaultColour = new Color4(255, 102, 170, 255); - Color4 glowColour = new Color4(187, 17, 119, 0); - public Light() { Size = new Vector2(40, 12); Masking = true; - Colour = defaultColour; + Colour = OsuColor.OsuPink; EdgeEffect = new EdgeEffect { - Colour = glowColour, + Colour = OsuColor.CheckBoxGlow, Type = EdgeEffectType.Glow, Radius = 10, Roundness = 8, @@ -182,13 +179,13 @@ namespace osu.Game.Overlays.Options { if (value) { - FadeColour(hoverColour, 500, EasingTypes.OutQuint); + FadeColour(OsuColor.CheckBoxHover, 500, EasingTypes.OutQuint); FadeGlowTo(1, 500, EasingTypes.OutQuint); } else { FadeGlowTo(0, 500); - FadeColour(defaultColour, 500); + FadeColour(OsuColor.OsuPink, 500); } } } diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index e843e15993..aa552d788d 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -131,8 +131,8 @@ namespace osu.Game.Overlays.Options private class StyledDropDownComboBox : DropDownComboBox { - protected override Color4 BackgroundColour => new Color4(0, 0, 0, 128); - protected override Color4 BackgroundColourHover => new Color4(187, 17, 119, 255); + protected override Color4 BackgroundColour => OsuColor.DropDownBackground; + protected override Color4 BackgroundColourHover => OsuColor.DropDownHover; private SpriteText label; protected override string Label @@ -161,9 +161,9 @@ namespace osu.Game.Overlays.Options private class StyledDropDownMenuItem : DropDownMenuItem { - protected override Color4 BackgroundColour => new Color4(0, 0, 0, 128); - protected override Color4 BackgroundColourSelected => new Color4(0, 0, 0, 128); - protected override Color4 BackgroundColourHover => new Color4(187, 17, 119, 255); + protected override Color4 BackgroundColour => OsuColor.DropDownBackground; + protected override Color4 BackgroundColourSelected => OsuColor.DropDownBackground; + protected override Color4 BackgroundColourHover => OsuColor.DropDownHover; public StyledDropDownMenuItem(string text, U value) : base(text, value) { diff --git a/osu.Game/Overlays/Options/OptionsSection.cs b/osu.Game/Overlays/Options/OptionsSection.cs index 256d5c8218..9e23e72d61 100644 --- a/osu.Game/Overlays/Options/OptionsSection.cs +++ b/osu.Game/Overlays/Options/OptionsSection.cs @@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Options new SpriteText { TextSize = headerSize, - Colour = new Color4(247, 198, 35, 255), + Colour = OsuColor.OptionSectionHeader, Text = Header, }, content = new FlowContainer diff --git a/osu.Game/Overlays/Options/SidebarButton.cs b/osu.Game/Overlays/Options/SidebarButton.cs index a1edc997a1..76af193691 100644 --- a/osu.Game/Overlays/Options/SidebarButton.cs +++ b/osu.Game/Overlays/Options/SidebarButton.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Options { RelativeSizeAxes = Axes.Both, BlendingMode = BlendingMode.Additive, - Colour = new Color4(60, 60, 60, 255), + Colour = OsuColor.SidebarButtonBackground, Alpha = 0, }, new Container @@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Options Width = 5, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Colour = new Color4(247, 198, 35, 255) + Colour = OsuColor.SidebarButtonSelectionIndicator } }; } diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index 44b7935945..ff0e8318d8 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -16,6 +16,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; +using osu.Game.Graphics; namespace osu.Game.Overlays.Options { @@ -84,7 +85,7 @@ namespace osu.Game.Overlays.Options RelativeSizeAxes = Axes.None, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Colour = new Color4(255, 102, 170, 255), + Colour = OsuColor.OsuPink, }, rightBox = new Box { @@ -92,7 +93,7 @@ namespace osu.Game.Overlays.Options RelativeSizeAxes = Axes.None, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Colour = new Color4(255, 102, 170, 255), + Colour = OsuColor.SliderbarBackground, Alpha = 0.5f, }, nub = new Container @@ -104,13 +105,14 @@ namespace osu.Game.Overlays.Options AutoSizeAxes = Axes.None, RelativeSizeAxes = Axes.None, Masking = true, - BorderColour = new Color4(255, 102, 170, 255), + BorderColour = OsuColor.SliderbarNub, BorderThickness = 3, Children = new[] { new Box { - Colour = new Color4(255, 102, 170, 0), + Colour = new Color4(OsuColor.SliderbarNub.R, + OsuColor.SliderbarNub.G, OsuColor.SliderbarNub.B, 0), RelativeSizeAxes = Axes.Both } } diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 33677799f1..fb4bdb35d0 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -23,6 +23,7 @@ using osu.Game.Overlays.Options.Graphics; using osu.Game.Overlays.Options.Input; using osu.Game.Overlays.Options.Online; using System; +using osu.Game.Graphics; namespace osu.Game.Overlays { @@ -94,7 +95,7 @@ namespace osu.Game.Overlays }, new SpriteText { - Colour = new Color4(255, 102, 170, 255), + Colour = OsuColor.OsuPink, Text = "Change the way osu! behaves", TextSize = 18, Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 }, diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs index 60ce228164..3f88349f00 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Toolbar DrawableIcon.EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, - Colour = new Color4(255, 194, 224, 100), + Colour = OsuColor.ToolbarModeButtonIconActiveGlow, Radius = 15, Roundness = 15, }; @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Toolbar else { DrawableIcon.Masking = false; - DrawableIcon.Colour = new Color4(255, 194, 224, 255); + DrawableIcon.Colour = OsuColor.ToolbarModeButtonIcon; } } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 22c214d82f..2405705d1b 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Modes; using OpenTK; using OpenTK.Graphics; +using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { @@ -52,7 +53,7 @@ namespace osu.Game.Overlays.Toolbar EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, - Colour = new Color4(255, 194, 224, 100), + Colour = OsuColor.ToolbarModeButtonIconActiveGlow, Radius = 15, Roundness = 15, }, diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 81cd55d429..eb176f4bdd 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -14,6 +14,7 @@ using osu.Game.Beatmaps; using osu.Game.Database; using osu.Framework.Graphics.Colour; using osu.Game.Beatmaps.Drawables; +using osu.Game.Graphics; namespace osu.Game.Screens.Select { @@ -29,12 +30,12 @@ namespace osu.Game.Screens.Select { Shear = wedged_container_shear; Masking = true; - BorderColour = new Color4(221, 255, 255, 255); + BorderColour = OsuColor.BeatmapInfoWedgeBorder; BorderThickness = 2.5f; EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, - Colour = new Color4(130, 204, 255, 150), + Colour = OsuColor.BeatmapInfoWedgeGlow, Radius = 20, Roundness = 15, }; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 3a74c42029..b14e959755 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -30,6 +30,7 @@ using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics.Containers; using osu.Framework.Input; using OpenTK.Input; +using osu.Game.Graphics; namespace osu.Game.Screens.Select { @@ -142,7 +143,7 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.Y, Width = 100, Text = "Play", - Colour = new Color4(238, 51, 153, 255), + Colour = OsuColor.PlayButton, Action = start }, } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a15cd5db7d..78c78fd5a8 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -231,6 +231,7 @@ + From c222be05c06f80f9959699a3ea1af9a7d89065fa Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 10 Jan 2017 13:44:40 -0500 Subject: [PATCH 67/71] Add Color4.Opacity and OsuColor.Gray --- osu.Game/Graphics/OsuColor.cs | 5 +++++ osu.Game/Graphics/UserInterface/BackButton.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 3 ++- osu.Game/Overlays/MusicController.cs | 4 ++-- osu.Game/Overlays/Options/SliderOption.cs | 3 +-- osu.Game/Overlays/Toolbar/Toolbar.cs | 5 +++-- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 6 +++--- osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs | 3 ++- osu.Game/Overlays/Toolbar/ToolbarUserButton.cs | 3 ++- osu.Game/Screens/Menu/Button.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 6 +++--- 13 files changed, 27 insertions(+), 19 deletions(-) diff --git a/osu.Game/Graphics/OsuColor.cs b/osu.Game/Graphics/OsuColor.cs index e516b38983..af62e29f27 100644 --- a/osu.Game/Graphics/OsuColor.cs +++ b/osu.Game/Graphics/OsuColor.cs @@ -6,6 +6,11 @@ namespace osu.Game.Graphics { public static class OsuColor { + public static Color4 Opacity(this Color4 color, float a) => new Color4(color.R, color.G, color.B, a); + public static Color4 Opacity(this Color4 color, byte a) => new Color4(color.R, color.G, color.B, a / 255f); + public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f); + public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255); + public static readonly Color4 OsuPink = new Color4(255, 102, 170, 255); public static readonly Color4 BeatmapPanelUnselected = new Color4(20, 43, 51, 255); diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index 3203240581..faa47eae2b 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -151,7 +151,7 @@ namespace osu.Game.Graphics.UserInterface { RelativeSizeAxes = Axes.Both, Shear = new Vector2(shear, 0), - Colour = new Color4(255, 255, 255, 128), + Colour = Color4.White.Opacity(0.5f), }; Add(flash); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 22f7a3a78f..a3ae3ca876 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Threading; +using osu.Game.Graphics; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.Chat; @@ -45,7 +46,7 @@ namespace osu.Game.Overlays { Depth = float.MaxValue, RelativeSizeAxes = Axes.Both, - Colour = new Color4(0.1f, 0.1f, 0.1f, 0.4f), + Colour = OsuColor.Gray(0.1f).Opacity(0.4f), }, content = new Container { diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 0ef986a4e6..932306d033 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Shadow, - Colour = new Color4(0, 0, 0, 40), + Colour = Color4.Black.Opacity(40), Radius = 5, }; @@ -402,7 +402,7 @@ namespace osu.Game.Overlays Height = 50, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, - Colour = new Color4(0, 0, 0, 127) + Colour = Color4.Black.Opacity(0.5f) } }; } diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index ff0e8318d8..2571db8ec2 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -111,8 +111,7 @@ namespace osu.Game.Overlays.Options { new Box { - Colour = new Color4(OsuColor.SliderbarNub.R, - OsuColor.SliderbarNub.G, OsuColor.SliderbarNub.B, 0), + Colour = OsuColor.SliderbarNub.Opacity(0), RelativeSizeAxes = Axes.Both } } diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index df6168b6c5..3ff127e964 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Toolbar solidBackground = new Box { RelativeSizeAxes = Axes.Both, - Colour = new Color4(0.1f, 0.1f, 0.1f, 1), + Colour = OsuColor.Gray(0.1f), Alpha = alpha_normal, }, gradientBackground = new Box @@ -75,7 +75,8 @@ namespace osu.Game.Overlays.Toolbar Anchor = Anchor.BottomLeft, Alpha = 0, Height = 90, - ColourInfo = ColourInfo.GradientVertical(new Color4(0.1f, 0.1f, 0.1f, 0.5f), new Color4(0.1f, 0.1f, 0.1f, 0f)), + ColourInfo = ColourInfo.GradientVertical( + OsuColor.Gray(0.1f).Opacity(0.5f), OsuColor.Gray(0.1f).Opacity(0)), }, new FlowContainer { diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 80b2fcdb42..1d8999d2a4 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Toolbar HoverBackground = new Box { RelativeSizeAxes = Axes.Both, - Colour = new Color4(80, 80, 80, 180), + Colour = OsuColor.Gray(80).Opacity(180), BlendingMode = BlendingMode.Additive, Alpha = 0, }, @@ -144,7 +144,7 @@ namespace osu.Game.Overlays.Toolbar { Action?.Invoke(); sampleClick.Play(); - HoverBackground.FlashColour(new Color4(255, 255, 255, 100), 500, EasingTypes.OutQuint); + HoverBackground.FlashColour(Color4.White.Opacity(100), 500, EasingTypes.OutQuint); return true; } @@ -174,7 +174,7 @@ namespace osu.Game.Overlays.Toolbar new Box { RelativeSizeAxes = Axes.Both, - Colour = new Color4(30, 30, 30, 255) + Colour = OsuColor.Gray(30) }, new Triangles { diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index b72a358456..c4bec26767 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -17,6 +17,7 @@ using osu.Game.Configuration; using osu.Game.Online.API; using OpenTK; using OpenTK.Graphics; +using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { @@ -41,7 +42,7 @@ namespace osu.Game.Overlays.Toolbar Add(StateBackground = new Box { RelativeSizeAxes = Axes.Both, - Colour = new Color4(150, 150, 150, 180), + Colour = OsuColor.Gray(150).Opacity(180), BlendingMode = BlendingMode.Additive, Depth = 2, Alpha = 0, diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 09708fc403..e093dbeca0 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -16,6 +16,7 @@ using osu.Game.Configuration; using osu.Game.Online.API; using OpenTK; using OpenTK.Graphics; +using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { @@ -73,7 +74,7 @@ namespace osu.Game.Overlays.Toolbar { Type = EdgeEffectType.Shadow, Radius = 4, - Colour = new Color4(0, 0, 0, 0.1f), + Colour = Color4.Black.Opacity(0.1f), }; Masking = true; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 28158457dd..719d75b018 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -64,7 +64,7 @@ namespace osu.Game.Screens.Menu EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Shadow, - Colour = new Color4(0, 0, 0, 0.2f), + Colour = Color4.Black.Opacity(0.2f), Roundness = 5, Radius = 8, }, diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 6e15d458c1..c2b9513d56 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -72,7 +72,7 @@ namespace osu.Game.Screens.Menu { RelativeSizeAxes = Axes.Both, Size = new Vector2(2, 1), - Colour = new Color4(50, 50, 50, 255), + Colour = OsuColor.Gray(50), Anchor = Anchor.Centre, Origin = Anchor.Centre, }, diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index eb176f4bdd..e451aa9991 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -81,7 +81,7 @@ namespace osu.Game.Screens.Select new Container { RelativeSizeAxes = Axes.Both, - ColourInfo = ColourInfo.GradientVertical(Color4.White, new Color4(1f, 1f, 1f, 0.3f)), + ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)), Children = new [] { // Zoomed-in and cropped beatmap background diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index b14e959755..f2df737d7f 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.Both, Size = new Vector2(1, 0.5f), - Colour = new Color4(0, 0, 0, 0.5f), + Colour = Color4.Black.Opacity(0.5f), Shear = new Vector2(0.15f, 0), EdgeSmoothness = new Vector2(2, 0), }, @@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select RelativePositionAxes = Axes.Y, Size = new Vector2(1, -0.5f), Position = new Vector2(0, 1), - Colour = new Color4(0, 0, 0, 0.5f), + Colour = Color4.Black.Opacity(0.5f), Shear = new Vector2(-0.15f, 0), EdgeSmoothness = new Vector2(2, 0), }, @@ -127,7 +127,7 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.Both, Size = Vector2.One, - Colour = new Color4(0, 0, 0, 0.5f), + Colour = Color4.Black.Opacity(0.5f), }, new BackButton { From fa007e632d79320a9bebe63573ca35d31818ebe5 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 12 Jan 2017 16:38:27 -0500 Subject: [PATCH 68/71] Refactor colors to palette based design --- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 8 +- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 9 ++- osu.Game/Beatmaps/Drawables/Panel.cs | 6 +- osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 8 +- osu.Game/Graphics/OsuColor.cs | 67 ---------------- osu.Game/Graphics/OsuColour.cs | 57 +++++++++++++ osu.Game/Graphics/UserInterface/BackButton.cs | 4 +- osu.Game/Graphics/UserInterface/OsuButton.cs | 2 +- osu.Game/Modes/Objects/HitObject.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/MusicController.cs | 4 +- osu.Game/Overlays/Options/CheckBoxOption.cs | 8 +- osu.Game/Overlays/Options/DropdownOption.cs | 10 +-- osu.Game/Overlays/Options/OptionsSection.cs | 2 +- osu.Game/Overlays/Options/SidebarButton.cs | 4 +- osu.Game/Overlays/Options/SliderOption.cs | 8 +- osu.Game/Overlays/OptionsOverlay.cs | 2 +- osu.Game/Overlays/Toolbar/Toolbar.cs | 4 +- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 4 +- .../Overlays/Toolbar/ToolbarModeButton.cs | 4 +- .../Overlays/Toolbar/ToolbarModeSelector.cs | 2 +- .../Toolbar/ToolbarOverlayToggleButton.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 80 +++++++++---------- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 26 files changed, 150 insertions(+), 155 deletions(-) delete mode 100644 osu.Game/Graphics/OsuColor.cs create mode 100644 osu.Game/Graphics/OsuColour.cs diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index c57e361916..ed5db58418 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -33,14 +33,16 @@ namespace osu.Game.Beatmaps.Drawables base.Selected(); GainedSelection?.Invoke(this); - background.ColourInfo = OsuColor.BeatmapPanelSelected; + background.ColourInfo = ColourInfo.GradientVertical( + new Color4(20, 43, 51, 255), + new Color4(40, 86, 102, 255)); } protected override void Deselected() { base.Deselected(); - background.Colour = OsuColor.BeatmapPanelUnselected; + background.Colour = new Color4(20, 43, 51, 255); } protected override bool OnClick(InputState state) @@ -70,7 +72,7 @@ namespace osu.Game.Beatmaps.Drawables CornerRadius = Content.CornerRadius, RelativeSizeAxes = Axes.Both, BlendingMode = BlendingMode.Additive, - Colour = OsuColor.BeatmapPanelUnselected, + Colour = new Color4(20, 43, 51, 255), }, new FlowContainer { diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 98a010efe1..99942de133 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -139,19 +139,22 @@ namespace osu.Game.Beatmaps.Drawables new Box { RelativeSizeAxes = Axes.Both, - ColourInfo = OsuColor.BeatmapHeaderBackgroundA, + ColourInfo = ColourInfo.GradientHorizontal( + Color4.Black, new Color4(0f, 0f, 0f, 0.9f)), Width = 0.05f, }, new Box { RelativeSizeAxes = Axes.Both, - ColourInfo = OsuColor.BeatmapHeaderBackgroundB, + ColourInfo = ColourInfo.GradientHorizontal( + new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)), Width = 0.2f, }, new Box { RelativeSizeAxes = Axes.Both, - ColourInfo = OsuColor.BeatmapHeaderBackgroundC, + ColourInfo = ColourInfo.GradientHorizontal( + new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)), Width = 0.05f, }, } diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index 94fc3e8aae..ff89e5882d 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -36,7 +36,7 @@ namespace osu.Game.Beatmaps.Drawables RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 10, - BorderColour = OsuColor.PanelBorder, + BorderColour = new Color4(221, 255, 255, 255), }); } @@ -85,7 +85,7 @@ namespace osu.Game.Beatmaps.Drawables nestedContainer.EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, - Colour = OsuColor.PanelGlowSelected, + Colour = new Color4(130, 204, 255, 150), Radius = 20, Roundness = 10, }; @@ -99,7 +99,7 @@ namespace osu.Game.Beatmaps.Drawables Type = EdgeEffectType.Shadow, Offset = new Vector2(1), Radius = 10, - Colour = OsuColor.PanelGlowUnselected, + Colour = Color4.Black.Opacity(100), }; } diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 2a30900f16..cd55f36ae3 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -46,10 +46,10 @@ namespace osu.Game.Beatmaps.Formats public virtual void ApplyColours(Beatmap b) { List colours = b.ComboColors ?? new List { - OsuColor.Combo1, - OsuColor.Combo2, - OsuColor.Combo3, - OsuColor.Combo4, + new Color4(17, 136, 170, 255), + new Color4(102, 136, 0, 255), + new Color4(204, 102, 0, 255), + new Color4(121, 9, 13, 255), }; if (colours.Count == 0) return; diff --git a/osu.Game/Graphics/OsuColor.cs b/osu.Game/Graphics/OsuColor.cs deleted file mode 100644 index af62e29f27..0000000000 --- a/osu.Game/Graphics/OsuColor.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using OpenTK.Graphics; -using osu.Framework.Graphics.Colour; - -namespace osu.Game.Graphics -{ - public static class OsuColor - { - public static Color4 Opacity(this Color4 color, float a) => new Color4(color.R, color.G, color.B, a); - public static Color4 Opacity(this Color4 color, byte a) => new Color4(color.R, color.G, color.B, a / 255f); - public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f); - public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255); - - public static readonly Color4 OsuPink = new Color4(255, 102, 170, 255); - - public static readonly Color4 BeatmapPanelUnselected = new Color4(20, 43, 51, 255); - public static readonly ColourInfo BeatmapPanelSelected = ColourInfo.GradientVertical( - new Color4(20, 43, 51, 255), - new Color4(40, 86, 102, 255)); - - public static readonly ColourInfo BeatmapHeaderBackgroundA = - ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.9f)); - public static readonly ColourInfo BeatmapHeaderBackgroundB = - ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)); - public static readonly ColourInfo BeatmapHeaderBackgroundC = - ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)); - - public static readonly Color4 PanelBorder = new Color4(221, 255, 255, 255); - public static readonly Color4 PanelGlowSelected = new Color4(130, 204, 255, 150); - public static readonly Color4 PanelGlowUnselected = new Color4(0, 0, 0, 100); - - public static readonly Color4 Combo1 = new Color4(17, 136, 170, 255); - public static readonly Color4 Combo2 = new Color4(102, 136, 0, 255); - public static readonly Color4 Combo3 = new Color4(204, 102, 0, 255); - public static readonly Color4 Combo4 = new Color4(121, 9, 13, 255); - - public static readonly Color4 BackButtonLeft = new Color4(195, 40, 140, 255); - public static readonly Color4 BackButtonRight = new Color4(238, 51, 153, 255); - - public static readonly Color4 Button = new Color4(14, 132, 165, 255); - - public static readonly Color4 PlayButton = new Color4(238, 51, 153, 255); - - public static readonly Color4 MusicControllerBackground = new Color4(150, 150, 150, 255); - public static readonly Color4 MusicControllerProgress = new Color4(255, 204, 34, 255); - - public static readonly Color4 CheckBoxHover = new Color4(255, 221, 238, 255); - public static readonly Color4 CheckBoxGlow = new Color4(187, 17, 119, 0); - - public static readonly Color4 DropDownBackground = new Color4(0, 0, 0, 128); - public static readonly Color4 DropDownHover = new Color4(187, 17, 119, 255); - - public static readonly Color4 OptionSectionHeader = new Color4(247, 198, 35, 255); - - public static readonly Color4 SidebarButtonBackground = new Color4(60, 60, 60, 255); - public static readonly Color4 SidebarButtonSelectionIndicator = new Color4(247, 198, 35, 255); - - public static readonly Color4 SliderbarBackground = new Color4(255, 102, 170, 255); - public static readonly Color4 SliderbarNub = new Color4(255, 102, 170, 255); - - public static readonly Color4 ToolbarModeButtonIcon = new Color4(255, 194, 224, 255); - public static readonly Color4 ToolbarModeButtonIconActiveGlow = new Color4(255, 194, 224, 100); - - public static readonly Color4 BeatmapInfoWedgeBorder = new Color4(221, 255, 255, 255); - public static readonly Color4 BeatmapInfoWedgeGlow = new Color4(130, 204, 255, 150); - } -} \ No newline at end of file diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs new file mode 100644 index 0000000000..3c9d4fd7ee --- /dev/null +++ b/osu.Game/Graphics/OsuColour.cs @@ -0,0 +1,57 @@ +using System; +using OpenTK.Graphics; +using osu.Framework.Graphics.Colour; + +namespace osu.Game.Graphics +{ + public static class OsuColour + { + public static Color4 Opacity(this Color4 color, float a) => new Color4(color.R, color.G, color.B, a); + public static Color4 Opacity(this Color4 color, byte a) => new Color4(color.R, color.G, color.B, a / 255f); + public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f); + public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255); + + private static Color4 FromHex(string hex) + { + return new Color4( + Convert.ToByte(hex.Substring(1, 2), 16), + Convert.ToByte(hex.Substring(3, 2), 16), + Convert.ToByte(hex.Substring(5, 2), 16), + 255); + } + + // See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less + + public static readonly Color4 PurpleLighter = FromHex(@"eeeeff"); + public static readonly Color4 PurpleLight = FromHex(@"aa88ff"); + public static readonly Color4 Purple = FromHex(@"8866ee"); + public static readonly Color4 PurpleDark = FromHex(@"6644cc"); + public static readonly Color4 PurpleDarker = FromHex(@"441188"); + + public static readonly Color4 PinkLighter = FromHex(@"ffddee"); + public static readonly Color4 PinkLight = FromHex(@"ff99cc"); + public static readonly Color4 Pink = FromHex(@"ff66aa"); + public static readonly Color4 PinkDark = FromHex(@"cc5288"); + public static readonly Color4 PinkDarker = FromHex(@"bb1177"); + + public static readonly Color4 BlueLighter = FromHex(@"ddffff"); + public static readonly Color4 BlueLight = FromHex(@"99eeff"); + public static readonly Color4 Blue = FromHex(@"66ccff"); + public static readonly Color4 BlueDark = FromHex(@"44aadd"); + public static readonly Color4 BlueDarker = FromHex(@"2299bb"); + + public static readonly Color4 YellowLighter = FromHex(@"ffffdd"); + public static readonly Color4 YellowLight = FromHex(@"ffdd55"); + public static readonly Color4 Yellow = FromHex(@"ffcc22"); + public static readonly Color4 YellowDark = FromHex(@"eeaa00"); + public static readonly Color4 YellowDarker = FromHex(@"cc6600"); + + public static readonly Color4 GreenLighter = FromHex(@"eeffcc"); + public static readonly Color4 GreenLight = FromHex(@"b3d944"); + public static readonly Color4 Green = FromHex(@"88b300"); + public static readonly Color4 GreenDark = FromHex(@"668800"); + public static readonly Color4 GreenDarker = FromHex(@"445500"); + + public static readonly Color4 Red = FromHex(@"fc4549"); + } +} diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index faa47eae2b..130eb0553e 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -46,7 +46,7 @@ namespace osu.Game.Graphics.UserInterface leftBox = new Box { RelativeSizeAxes = Axes.Both, - Colour = OsuColor.BackButtonLeft, + Colour = OsuColour.PinkDark, Shear = new Vector2(shear, 0), }, icon = new TextAwesome @@ -67,7 +67,7 @@ namespace osu.Game.Graphics.UserInterface { rightBox = new Box { - Colour = OsuColor.BackButtonRight, + Colour = OsuColour.Pink, Origin = Anchor.TopLeft, Anchor = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 48922de6ae..cecd16c1b7 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -12,7 +12,7 @@ namespace osu.Game.Graphics.UserInterface public OsuButton() { Height = 25; - Colour = OsuColor.Button; + Colour = OsuColour.BlueDark; } } } \ No newline at end of file diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Modes/Objects/HitObject.cs index dbf95d658c..b2043fa94c 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Modes/Objects/HitObject.cs @@ -18,7 +18,7 @@ namespace osu.Game.Modes.Objects public bool NewCombo { get; set; } - public Color4 Colour = OsuColor.Combo1; + public Color4 Colour = new Color4(17, 136, 170, 255); public double Duration => EndTime - StartTime; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index a3ae3ca876..17a1a2604a 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays { Depth = float.MaxValue, RelativeSizeAxes = Axes.Both, - Colour = OsuColor.Gray(0.1f).Opacity(0.4f), + Colour = OsuColour.Gray(0.1f).Opacity(0.4f), }, content = new Container { diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 932306d033..8861b3117d 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -171,7 +171,7 @@ namespace osu.Game.Overlays Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, Height = 10, - Colour = OsuColor.MusicControllerProgress, + Colour = OsuColour.Yellow, SeekRequested = seek } }; @@ -393,7 +393,7 @@ namespace osu.Game.Overlays { sprite = new Sprite { - Colour = OsuColor.MusicControllerBackground, + Colour = OsuColour.Gray(150), FillMode = FillMode.Fill, }, new Box diff --git a/osu.Game/Overlays/Options/CheckBoxOption.cs b/osu.Game/Overlays/Options/CheckBoxOption.cs index f50fed844a..bb0ed48d17 100644 --- a/osu.Game/Overlays/Options/CheckBoxOption.cs +++ b/osu.Game/Overlays/Options/CheckBoxOption.cs @@ -148,11 +148,11 @@ namespace osu.Game.Overlays.Options Masking = true; - Colour = OsuColor.OsuPink; + Colour = OsuColour.Pink; EdgeEffect = new EdgeEffect { - Colour = OsuColor.CheckBoxGlow, + Colour = OsuColour.PinkDarker, Type = EdgeEffectType.Glow, Radius = 10, Roundness = 8, @@ -179,13 +179,13 @@ namespace osu.Game.Overlays.Options { if (value) { - FadeColour(OsuColor.CheckBoxHover, 500, EasingTypes.OutQuint); + FadeColour(OsuColour.PinkLighter, 500, EasingTypes.OutQuint); FadeGlowTo(1, 500, EasingTypes.OutQuint); } else { FadeGlowTo(0, 500); - FadeColour(OsuColor.OsuPink, 500); + FadeColour(OsuColour.Pink, 500); } } } diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index aa552d788d..86d61380e0 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -131,8 +131,8 @@ namespace osu.Game.Overlays.Options private class StyledDropDownComboBox : DropDownComboBox { - protected override Color4 BackgroundColour => OsuColor.DropDownBackground; - protected override Color4 BackgroundColourHover => OsuColor.DropDownHover; + protected override Color4 BackgroundColour => Color4.Black.Opacity(0.5f); + protected override Color4 BackgroundColourHover => OsuColour.PinkDarker; private SpriteText label; protected override string Label @@ -161,9 +161,9 @@ namespace osu.Game.Overlays.Options private class StyledDropDownMenuItem : DropDownMenuItem { - protected override Color4 BackgroundColour => OsuColor.DropDownBackground; - protected override Color4 BackgroundColourSelected => OsuColor.DropDownBackground; - protected override Color4 BackgroundColourHover => OsuColor.DropDownHover; + protected override Color4 BackgroundColour => Color4.Black.Opacity(0.5f); + protected override Color4 BackgroundColourSelected => Color4.Black.Opacity(0.5f); + protected override Color4 BackgroundColourHover => OsuColour.PinkDarker; public StyledDropDownMenuItem(string text, U value) : base(text, value) { diff --git a/osu.Game/Overlays/Options/OptionsSection.cs b/osu.Game/Overlays/Options/OptionsSection.cs index 9e23e72d61..e123afb1b2 100644 --- a/osu.Game/Overlays/Options/OptionsSection.cs +++ b/osu.Game/Overlays/Options/OptionsSection.cs @@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Options new SpriteText { TextSize = headerSize, - Colour = OsuColor.OptionSectionHeader, + Colour = OsuColour.Pink, Text = Header, }, content = new FlowContainer diff --git a/osu.Game/Overlays/Options/SidebarButton.cs b/osu.Game/Overlays/Options/SidebarButton.cs index 76af193691..a3b007b189 100644 --- a/osu.Game/Overlays/Options/SidebarButton.cs +++ b/osu.Game/Overlays/Options/SidebarButton.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Options { RelativeSizeAxes = Axes.Both, BlendingMode = BlendingMode.Additive, - Colour = OsuColor.SidebarButtonBackground, + Colour = OsuColour.Gray(60), Alpha = 0, }, new Container @@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Options Width = 5, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Colour = OsuColor.SidebarButtonSelectionIndicator + Colour = OsuColour.Pink } }; } diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index 2571db8ec2..5f29a3cde3 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Options RelativeSizeAxes = Axes.None, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Colour = OsuColor.OsuPink, + Colour = OsuColour.Pink, }, rightBox = new Box { @@ -93,7 +93,7 @@ namespace osu.Game.Overlays.Options RelativeSizeAxes = Axes.None, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Colour = OsuColor.SliderbarBackground, + Colour = OsuColour.Pink, Alpha = 0.5f, }, nub = new Container @@ -105,13 +105,13 @@ namespace osu.Game.Overlays.Options AutoSizeAxes = Axes.None, RelativeSizeAxes = Axes.None, Masking = true, - BorderColour = OsuColor.SliderbarNub, + BorderColour = OsuColour.Pink, BorderThickness = 3, Children = new[] { new Box { - Colour = OsuColor.SliderbarNub.Opacity(0), + Colour = OsuColour.Pink.Opacity(0), RelativeSizeAxes = Axes.Both } } diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index fb4bdb35d0..523c05513f 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -95,7 +95,7 @@ namespace osu.Game.Overlays }, new SpriteText { - Colour = OsuColor.OsuPink, + Colour = OsuColour.Pink, Text = "Change the way osu! behaves", TextSize = 18, Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 }, diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 3ff127e964..783f7b65da 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Toolbar solidBackground = new Box { RelativeSizeAxes = Axes.Both, - Colour = OsuColor.Gray(0.1f), + Colour = OsuColour.Gray(0.1f), Alpha = alpha_normal, }, gradientBackground = new Box @@ -76,7 +76,7 @@ namespace osu.Game.Overlays.Toolbar Alpha = 0, Height = 90, ColourInfo = ColourInfo.GradientVertical( - OsuColor.Gray(0.1f).Opacity(0.5f), OsuColor.Gray(0.1f).Opacity(0)), + OsuColour.Gray(0.1f).Opacity(0.5f), OsuColour.Gray(0.1f).Opacity(0)), }, new FlowContainer { diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 1d8999d2a4..47f2df8d3f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Toolbar HoverBackground = new Box { RelativeSizeAxes = Axes.Both, - Colour = OsuColor.Gray(80).Opacity(180), + Colour = OsuColour.Gray(80).Opacity(180), BlendingMode = BlendingMode.Additive, Alpha = 0, }, @@ -174,7 +174,7 @@ namespace osu.Game.Overlays.Toolbar new Box { RelativeSizeAxes = Axes.Both, - Colour = OsuColor.Gray(30) + Colour = OsuColour.Gray(30) }, new Triangles { diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs index 3f88349f00..60ce228164 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Toolbar DrawableIcon.EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, - Colour = OsuColor.ToolbarModeButtonIconActiveGlow, + Colour = new Color4(255, 194, 224, 100), Radius = 15, Roundness = 15, }; @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Toolbar else { DrawableIcon.Masking = false; - DrawableIcon.Colour = OsuColor.ToolbarModeButtonIcon; + DrawableIcon.Colour = new Color4(255, 194, 224, 255); } } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 2405705d1b..68ae31e934 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -53,7 +53,7 @@ namespace osu.Game.Overlays.Toolbar EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, - Colour = OsuColor.ToolbarModeButtonIconActiveGlow, + Colour = new Color4(255, 194, 224, 100), Radius = 15, Roundness = 15, }, diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index c4bec26767..3e8a1831aa 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Toolbar Add(StateBackground = new Box { RelativeSizeAxes = Axes.Both, - Colour = OsuColor.Gray(150).Opacity(180), + Colour = OsuColour.Gray(150).Opacity(180), BlendingMode = BlendingMode.Additive, Depth = 2, Alpha = 0, diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index c2b9513d56..8825f9474b 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -72,7 +72,7 @@ namespace osu.Game.Screens.Menu { RelativeSizeAxes = Axes.Both, Size = new Vector2(2, 1), - Colour = OsuColor.Gray(50), + Colour = OsuColour.Gray(50), Anchor = Anchor.Centre, Origin = Anchor.Centre, }, diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index e451aa9991..aad2982544 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -30,12 +30,12 @@ namespace osu.Game.Screens.Select { Shear = wedged_container_shear; Masking = true; - BorderColour = OsuColor.BeatmapInfoWedgeBorder; + BorderColour = new Color4(221, 255, 255, 255); BorderThickness = 2.5f; EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, - Colour = OsuColor.BeatmapInfoWedgeGlow, + Colour = new Color4(130, 204, 255, 150), Radius = 20, Roundness = 15, }; @@ -94,53 +94,53 @@ namespace osu.Game.Screens.Select }, }, // Text for beatmap info - new FlowContainer - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Direction = FlowDirection.VerticalOnly, - Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 40 }, - AutoSizeAxes = Axes.Both, - Children = new[] - { - new SpriteText - { - Font = @"Exo2.0-MediumItalic", - Text = beatmapSetInfo.Metadata.Artist + " -- " + beatmapSetInfo.Metadata.Title, - TextSize = 28, - Shadow = true, - }, - new SpriteText - { - Font = @"Exo2.0-MediumItalic", - Text = beatmapInfo.Version, - TextSize = 17, - Shadow = true, - }, - new FlowContainer + new FlowContainer + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FlowDirection.VerticalOnly, + Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 40 }, + AutoSizeAxes = Axes.Both, + Children = new[] + { + new SpriteText + { + Font = @"Exo2.0-MediumItalic", + Text = beatmapSetInfo.Metadata.Artist + " -- " + beatmapSetInfo.Metadata.Title, + TextSize = 28, + Shadow = true, + }, + new SpriteText + { + Font = @"Exo2.0-MediumItalic", + Text = beatmapInfo.Version, + TextSize = 17, + Shadow = true, + }, + new FlowContainer { Margin = new MarginPadding { Top = 10 }, Direction = FlowDirection.HorizontalOnly, AutoSizeAxes = Axes.Both, Children = new [] { - new SpriteText - { - Font = @"Exo2.0-Medium", - Text = "mapped by ", - TextSize = 15, - Shadow = true, + new SpriteText + { + Font = @"Exo2.0-Medium", + Text = "mapped by ", + TextSize = 15, + Shadow = true, }, - new SpriteText - { - Font = @"Exo2.0-Bold", - Text = beatmapSetInfo.Metadata.Author, - TextSize = 15, - Shadow = true, + new SpriteText + { + Font = @"Exo2.0-Bold", + Text = beatmapSetInfo.Metadata.Author, + TextSize = 15, + Shadow = true, }, } - } - } + } + } } } }).Preload(game, delegate(Drawable d) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index f2df737d7f..b933fdc006 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -143,7 +143,7 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.Y, Width = 100, Text = "Play", - Colour = OsuColor.PlayButton, + Colour = OsuColour.Pink, Action = start }, } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 78c78fd5a8..a4da659718 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -231,7 +231,7 @@ - + From f5f545df624d23862352e77614c5d08283d96c48 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 12 Jan 2017 23:49:05 -0500 Subject: [PATCH 69/71] Refactor OsuColour into injected instance class Which should allow you to change the color palette in the future for skinning purposes. --- osu.Game/Graphics/OsuColour.cs | 64 ++++++------ osu.Game/Graphics/UserInterface/BackButton.cs | 99 +++++++++---------- osu.Game/Graphics/UserInterface/OsuButton.cs | 8 +- osu.Game/OsuGameBase.cs | 2 + osu.Game/Overlays/MusicController.cs | 51 +++++----- osu.Game/Overlays/Options/CheckBoxOption.cs | 31 +++--- osu.Game/Overlays/Options/DropdownOption.cs | 23 +++-- osu.Game/Overlays/Options/OptionsSection.cs | 18 +++- osu.Game/Overlays/Options/SidebarButton.cs | 70 +++++++------ osu.Game/Overlays/Options/SliderOption.cs | 11 ++- osu.Game/Overlays/OptionsOverlay.cs | 19 ++-- osu.Game/Screens/Select/PlaySongSelect.cs | 62 ++++++------ 12 files changed, 248 insertions(+), 210 deletions(-) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 3c9d4fd7ee..1ab5ec8f7c 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -4,54 +4,58 @@ using osu.Framework.Graphics.Colour; namespace osu.Game.Graphics { - public static class OsuColour + public static class OsuColourExtensions { public static Color4 Opacity(this Color4 color, float a) => new Color4(color.R, color.G, color.B, a); public static Color4 Opacity(this Color4 color, byte a) => new Color4(color.R, color.G, color.B, a / 255f); + } + + public class OsuColour + { public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f); public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255); private static Color4 FromHex(string hex) { return new Color4( - Convert.ToByte(hex.Substring(1, 2), 16), - Convert.ToByte(hex.Substring(3, 2), 16), - Convert.ToByte(hex.Substring(5, 2), 16), + Convert.ToByte(hex.Substring(0, 2), 16), + Convert.ToByte(hex.Substring(2, 2), 16), + Convert.ToByte(hex.Substring(4, 2), 16), 255); } // See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less - public static readonly Color4 PurpleLighter = FromHex(@"eeeeff"); - public static readonly Color4 PurpleLight = FromHex(@"aa88ff"); - public static readonly Color4 Purple = FromHex(@"8866ee"); - public static readonly Color4 PurpleDark = FromHex(@"6644cc"); - public static readonly Color4 PurpleDarker = FromHex(@"441188"); + public Color4 PurpleLighter = FromHex(@"eeeeff"); + public Color4 PurpleLight = FromHex(@"aa88ff"); + public Color4 Purple = FromHex(@"8866ee"); + public Color4 PurpleDark = FromHex(@"6644cc"); + public Color4 PurpleDarker = FromHex(@"441188"); - public static readonly Color4 PinkLighter = FromHex(@"ffddee"); - public static readonly Color4 PinkLight = FromHex(@"ff99cc"); - public static readonly Color4 Pink = FromHex(@"ff66aa"); - public static readonly Color4 PinkDark = FromHex(@"cc5288"); - public static readonly Color4 PinkDarker = FromHex(@"bb1177"); + public Color4 PinkLighter = FromHex(@"ffddee"); + public Color4 PinkLight = FromHex(@"ff99cc"); + public Color4 Pink = FromHex(@"ff66aa"); + public Color4 PinkDark = FromHex(@"cc5288"); + public Color4 PinkDarker = FromHex(@"bb1177"); - public static readonly Color4 BlueLighter = FromHex(@"ddffff"); - public static readonly Color4 BlueLight = FromHex(@"99eeff"); - public static readonly Color4 Blue = FromHex(@"66ccff"); - public static readonly Color4 BlueDark = FromHex(@"44aadd"); - public static readonly Color4 BlueDarker = FromHex(@"2299bb"); + public Color4 BlueLighter = FromHex(@"ddffff"); + public Color4 BlueLight = FromHex(@"99eeff"); + public Color4 Blue = FromHex(@"66ccff"); + public Color4 BlueDark = FromHex(@"44aadd"); + public Color4 BlueDarker = FromHex(@"2299bb"); - public static readonly Color4 YellowLighter = FromHex(@"ffffdd"); - public static readonly Color4 YellowLight = FromHex(@"ffdd55"); - public static readonly Color4 Yellow = FromHex(@"ffcc22"); - public static readonly Color4 YellowDark = FromHex(@"eeaa00"); - public static readonly Color4 YellowDarker = FromHex(@"cc6600"); + public Color4 YellowLighter = FromHex(@"ffffdd"); + public Color4 YellowLight = FromHex(@"ffdd55"); + public Color4 Yellow = FromHex(@"ffcc22"); + public Color4 YellowDark = FromHex(@"eeaa00"); + public Color4 YellowDarker = FromHex(@"cc6600"); - public static readonly Color4 GreenLighter = FromHex(@"eeffcc"); - public static readonly Color4 GreenLight = FromHex(@"b3d944"); - public static readonly Color4 Green = FromHex(@"88b300"); - public static readonly Color4 GreenDark = FromHex(@"668800"); - public static readonly Color4 GreenDarker = FromHex(@"445500"); + public Color4 GreenLighter = FromHex(@"eeffcc"); + public Color4 GreenLight = FromHex(@"b3d944"); + public Color4 Green = FromHex(@"88b300"); + public Color4 GreenDark = FromHex(@"668800"); + public Color4 GreenDarker = FromHex(@"445500"); - public static readonly Color4 Red = FromHex(@"fc4549"); + public Color4 Red = FromHex(@"fc4549"); } } diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index 130eb0553e..2f9a026b8f 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -34,55 +34,6 @@ namespace osu.Game.Graphics.UserInterface public BackButton() { Size = size_retracted; - - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Width = 0.4f, - Children = new Drawable[] - { - leftBox = new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.PinkDark, - Shear = new Vector2(shear, 0), - }, - icon = new TextAwesome - { - Anchor = Anchor.Centre, - TextSize = 25, - Icon = FontAwesome.fa_osu_left_o - }, - } - }, - new Container - { - Origin = Anchor.TopRight, - Anchor = Anchor.TopRight, - RelativeSizeAxes = Axes.Both, - Width = 0.6f, - Children = new Drawable[] - { - rightBox = new Box - { - Colour = OsuColour.Pink, - Origin = Anchor.TopLeft, - Anchor = Anchor.TopLeft, - RelativeSizeAxes = Axes.Both, - Shear = new Vector2(shear, 0), - EdgeSmoothness = new Vector2(1.5f, 0), - }, - new SpriteText - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Text = @"Back", - } - } - } - }; } public override bool Contains(Vector2 screenSpacePos) => leftBox.Contains(screenSpacePos) || rightBox.Contains(screenSpacePos); @@ -140,9 +91,57 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load(AudioManager audio, OsuColour colours) { sampleClick = audio.Sample.Get(@"Menu/menuback"); + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Width = 0.4f, + Children = new Drawable[] + { + leftBox = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colours.PinkDark, + Shear = new Vector2(shear, 0), + }, + icon = new TextAwesome + { + Anchor = Anchor.Centre, + TextSize = 25, + Icon = FontAwesome.fa_osu_left_o + }, + } + }, + new Container + { + Origin = Anchor.TopRight, + Anchor = Anchor.TopRight, + RelativeSizeAxes = Axes.Both, + Width = 0.6f, + Children = new Drawable[] + { + rightBox = new Box + { + Colour = colours.Pink, + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, + RelativeSizeAxes = Axes.Both, + Shear = new Vector2(shear, 0), + EdgeSmoothness = new Vector2(1.5f, 0), + }, + new SpriteText + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Text = @"Back", + } + } + } + }; } protected override bool OnClick(InputState state) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index cecd16c1b7..2afcf56140 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -3,6 +3,7 @@ using System; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface @@ -12,7 +13,12 @@ namespace osu.Game.Graphics.UserInterface public OsuButton() { Height = 25; - Colour = OsuColour.BlueDark; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.BlueDark; } } } \ No newline at end of file diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 7c1f620c93..d29fe0032c 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -13,6 +13,7 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.IO; using osu.Game.Configuration; using osu.Game.Database; +using osu.Game.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Processing; using osu.Game.Online.API; @@ -41,6 +42,7 @@ namespace osu.Game Dependencies.Cache(this); Dependencies.Cache(Config); Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host)); + Dependencies.Cache(new OsuColour()); //this completely overrides the framework default. will need to change once we make a proper FontStore. Dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 0.01f }, true); diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 8861b3117d..5052840848 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -65,7 +65,31 @@ namespace osu.Game.Overlays Origin = Anchor.TopRight; Position = start_position; Margin = new MarginPadding(10); + } + protected override bool OnDragStart(InputState state) => true; + + protected override bool OnDrag(InputState state) + { + Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value); + + // Diminish the drag distance as we go further to simulate "rubber band" feeling. + change *= (float)Math.Pow(change.Length, 0.7f) / change.Length; + + MoveTo(start_position + change); + return base.OnDrag(state); + } + + protected override bool OnDragEnd(InputState state) + { + MoveTo(start_position, 800, EasingTypes.OutElastic); + return base.OnDragEnd(state); + } + + [BackgroundDependencyLoader] + private void load(OsuGameBase osuGame, BeatmapDatabase beatmaps, AudioManager audio, + TextureStore textures, OsuColour colours) + { Children = new Drawable[] { title = new SpriteText @@ -171,34 +195,11 @@ namespace osu.Game.Overlays Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, Height = 10, - Colour = OsuColour.Yellow, + Colour = colours.Yellow, SeekRequested = seek } }; - } - - protected override bool OnDragStart(InputState state) => true; - - protected override bool OnDrag(InputState state) - { - Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value); - - // Diminish the drag distance as we go further to simulate "rubber band" feeling. - change *= (float)Math.Pow(change.Length, 0.7f) / change.Length; - - MoveTo(start_position + change); - return base.OnDrag(state); - } - - protected override bool OnDragEnd(InputState state) - { - MoveTo(start_position, 800, EasingTypes.OutElastic); - return base.OnDragEnd(state); - } - - [BackgroundDependencyLoader] - private void load(OsuGameBase osuGame, BeatmapDatabase beatmaps, AudioManager audio, TextureStore textures) - { + this.beatmaps = beatmaps; trackManager = osuGame.Audio.Track; config = osuGame.Config; diff --git a/osu.Game/Overlays/Options/CheckBoxOption.cs b/osu.Game/Overlays/Options/CheckBoxOption.cs index bb0ed48d17..310d33580d 100644 --- a/osu.Game/Overlays/Options/CheckBoxOption.cs +++ b/osu.Game/Overlays/Options/CheckBoxOption.cs @@ -141,22 +141,13 @@ namespace osu.Game.Overlays.Options private Box fill; const float border_width = 3; + private Color4 glowingColour, idleColour; public Light() { Size = new Vector2(40, 12); - Masking = true; - - Colour = OsuColour.Pink; - - EdgeEffect = new EdgeEffect - { - Colour = OsuColour.PinkDarker, - Type = EdgeEffectType.Glow, - Radius = 10, - Roundness = 8, - }; + Masking = true; CornerRadius = Height / 2; Masking = true; @@ -173,19 +164,33 @@ namespace osu.Game.Overlays.Options }; } + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = idleColour = colours.Pink; + + EdgeEffect = new EdgeEffect + { + Colour = glowingColour = colours.PinkDarker, + Type = EdgeEffectType.Glow, + Radius = 10, + Roundness = 8, + }; + } + public bool Glowing { set { if (value) { - FadeColour(OsuColour.PinkLighter, 500, EasingTypes.OutQuint); + FadeColour(glowingColour, 500, EasingTypes.OutQuint); FadeGlowTo(1, 500, EasingTypes.OutQuint); } else { FadeGlowTo(0, 500); - FadeColour(OsuColour.Pink, 500); + FadeColour(idleColour, 500); } } } diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index 86d61380e0..6262673734 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Reflection; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -131,9 +132,6 @@ namespace osu.Game.Overlays.Options private class StyledDropDownComboBox : DropDownComboBox { - protected override Color4 BackgroundColour => Color4.Black.Opacity(0.5f); - protected override Color4 BackgroundColourHover => OsuColour.PinkDarker; - private SpriteText label; protected override string Label { @@ -157,14 +155,17 @@ namespace osu.Game.Overlays.Options } }; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + BackgroundColour = Color4.Black.Opacity(0.5f); + BackgroundColourHover = colours.PinkDarker; + } } private class StyledDropDownMenuItem : DropDownMenuItem { - protected override Color4 BackgroundColour => Color4.Black.Opacity(0.5f); - protected override Color4 BackgroundColourSelected => Color4.Black.Opacity(0.5f); - protected override Color4 BackgroundColourHover => OsuColour.PinkDarker; - public StyledDropDownMenuItem(string text, U value) : base(text, value) { AutoSizeAxes = Axes.None; @@ -193,6 +194,14 @@ namespace osu.Game.Overlays.Options } }; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + BackgroundColour = Color4.Black.Opacity(0.5f); + BackgroundColourHover = colours.PinkDarker; + BackgroundColourSelected = Color4.Black.Opacity(0.5f); + } } } } diff --git a/osu.Game/Overlays/Options/OptionsSection.cs b/osu.Game/Overlays/Options/OptionsSection.cs index e123afb1b2..5a5f22275b 100644 --- a/osu.Game/Overlays/Options/OptionsSection.cs +++ b/osu.Game/Overlays/Options/OptionsSection.cs @@ -3,6 +3,7 @@ using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; @@ -19,14 +20,16 @@ namespace osu.Game.Overlays.Options public abstract FontAwesome Icon { get; } public abstract string Header { get; } + private SpriteText headerLabel; + public OptionsSection() { Margin = new MarginPadding { Top = 20 }; - - const int headerSize = 26, headerMargin = 25; - const int borderSize = 2; AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; + + const int headerSize = 26, headerMargin = 25; + const int borderSize = 2; AddInternal(new Drawable[] { new Box @@ -48,10 +51,9 @@ namespace osu.Game.Overlays.Options AutoSizeAxes = Axes.Y, Children = new[] { - new SpriteText + headerLabel = new SpriteText { TextSize = headerSize, - Colour = OsuColour.Pink, Text = Header, }, content = new FlowContainer @@ -66,5 +68,11 @@ namespace osu.Game.Overlays.Options }, }); } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + headerLabel.Colour = colours.Pink; + } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/SidebarButton.cs b/osu.Game/Overlays/Options/SidebarButton.cs index a3b007b189..da2704ee60 100644 --- a/osu.Game/Overlays/Options/SidebarButton.cs +++ b/osu.Game/Overlays/Options/SidebarButton.cs @@ -4,6 +4,7 @@ using System; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -55,44 +56,49 @@ namespace osu.Game.Overlays.Options RelativeSizeAxes = Axes.X; Children = new Drawable[] { - backgroundBox = new Box + backgroundBox = new Box + { + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive, + Colour = OsuColour.Gray(60), + Alpha = 0, + }, + new Container + { + Width = OptionsSidebar.default_width, + RelativeSizeAxes = Axes.Y, + Children = new[] { - RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Colour = OsuColour.Gray(60), - Alpha = 0, - }, - new Container - { - Width = OptionsSidebar.default_width, - RelativeSizeAxes = Axes.Y, - Children = new[] + drawableIcon = new TextAwesome { - drawableIcon = new TextAwesome - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - } - }, - headerText = new SpriteText - { - Position = new Vector2(OptionsSidebar.default_width + 10, 0), - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - }, - selectionIndicator = new Box - { - Alpha = 0, - RelativeSizeAxes = Axes.Y, - Width = 5, - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Colour = OsuColour.Pink + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, } + }, + headerText = new SpriteText + { + Position = new Vector2(OptionsSidebar.default_width + 10, 0), + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + }, + selectionIndicator = new Box + { + Alpha = 0, + RelativeSizeAxes = Axes.Y, + Width = 5, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + } }; } + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + selectionIndicator.Colour = colours.Pink; + } + protected override bool OnClick(InputState state) { Action?.Invoke(); diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index 5f29a3cde3..e2e387d348 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -17,6 +17,7 @@ using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics; +using System.Linq; namespace osu.Game.Overlays.Options { @@ -85,7 +86,6 @@ namespace osu.Game.Overlays.Options RelativeSizeAxes = Axes.None, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Colour = OsuColour.Pink, }, rightBox = new Box { @@ -93,7 +93,6 @@ namespace osu.Game.Overlays.Options RelativeSizeAxes = Axes.None, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Colour = OsuColour.Pink, Alpha = 0.5f, }, nub = new Container @@ -105,13 +104,11 @@ namespace osu.Game.Overlays.Options AutoSizeAxes = Axes.None, RelativeSizeAxes = Axes.None, Masking = true, - BorderColour = OsuColour.Pink, BorderThickness = 3, Children = new[] { new Box { - Colour = OsuColour.Pink.Opacity(0), RelativeSizeAxes = Axes.Both } } @@ -120,9 +117,13 @@ namespace osu.Game.Overlays.Options } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load(AudioManager audio, OsuColour colours) { sample = audio.Sample.Get(@"Sliderbar/sliderbar"); + leftBox.Colour = colours.Pink; + rightBox.Colour = colours.Pink; + nub.BorderColour = colours.Pink; + (nub.Children.First() as Box).Colour = colours.Pink.Opacity(0); } private void playSample() diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 523c05513f..0767a70739 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -46,6 +46,13 @@ namespace osu.Game.Overlays private float lastKnownScroll; public OptionsOverlay() + { + RelativeSizeAxes = Axes.Y; + AutoSizeAxes = Axes.X; + } + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(OsuGame game, OsuColour colours) { sections = new OptionsSection[] { @@ -59,10 +66,6 @@ namespace osu.Game.Overlays new OnlineSection(), new MaintenanceSection(), }; - - RelativeSizeAxes = Axes.Y; - AutoSizeAxes = Axes.X; - Children = new Drawable[] { new Box @@ -95,7 +98,7 @@ namespace osu.Game.Overlays }, new SpriteText { - Colour = OsuColour.Pink, + Colour = colours.Pink, Text = "Change the way osu! behaves", TextSize = 18, Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 }, @@ -124,11 +127,7 @@ namespace osu.Game.Overlays ).ToArray() } }; - } - - [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuGame game) - { + scrollContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 }; } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index b933fdc006..aba48f2401 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -81,7 +81,34 @@ namespace osu.Game.Screens.Select } } - public PlaySongSelect() + Player player; + + private void start() + { + if (player != null) + return; + + //in the future we may want to move this logic to a PlayerLoader gamemode or similar, so we can rely on the SongSelect transition + //and provide a better loading experience (at the moment song select is still accepting input during preload). + player = new Player + { + BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, + PreferredPlayMode = playMode.Value + }; + + player.Preload(Game, delegate + { + if (!Push(player)) + { + player = null; + //error occured? + } + }); + } + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game, + OsuGame osuGame, OsuColour colours) { const float carouselWidth = 640; const float bottomToolHeight = 50; @@ -143,42 +170,13 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.Y, Width = 100, Text = "Play", - Colour = OsuColour.Pink, + Colour = colours.Pink, Action = start }, } } }; - } - - Player player; - - private void start() - { - if (player != null) - return; - - //in the future we may want to move this logic to a PlayerLoader gamemode or similar, so we can rely on the SongSelect transition - //and provide a better loading experience (at the moment song select is still accepting input during preload). - player = new Player - { - BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, - PreferredPlayMode = playMode.Value - }; - - player.Preload(Game, delegate - { - if (!Push(player)) - { - player = null; - //error occured? - } - }); - } - - [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game, OsuGame osuGame) - { + if (osuGame != null) { playMode = osuGame.PlayMode; From e81073695fdc667c2c82f5a2a6e5485875716478 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 13 Jan 2017 17:17:04 -0500 Subject: [PATCH 70/71] Implement disable mouse buttons --- osu.Game/Screens/Play/Player.cs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index ca4245504b..67f7e99a75 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -177,25 +177,39 @@ namespace osu.Game.Screens.Play bool leftViaKeyboard; bool rightViaKeyboard; + Bindable mouseDisabled; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + mouseDisabled = config.GetBindable(OsuConfig.MouseDisableButtons) + ?? new Bindable(false); + } protected override void TransformState(InputState state) { base.TransformState(state); - MouseState mouse = (MouseState)state.Mouse; - if (state.Keyboard != null) { leftViaKeyboard = state.Keyboard.Keys.Contains(Key.Z); rightViaKeyboard = state.Keyboard.Keys.Contains(Key.X); } - + + MouseState mouse = (MouseState)state.Mouse; if (state.Mouse != null) { - if (leftViaKeyboard) mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true; - if (rightViaKeyboard) mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true; + if (mouseDisabled.Value) + { + mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = false; + mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = false; + } + + if (leftViaKeyboard) + mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true; + if (rightViaKeyboard) + mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true; } - } } } From 6d0fe92d33d5704086174028b5d45de55fd4fdf2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 14 Jan 2017 06:49:21 +0800 Subject: [PATCH 71/71] Update submodules. --- osu-framework | 2 +- osu-resources | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu-framework b/osu-framework index b84b391c7f..f2eec2adf5 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit b84b391c7fed14023ad309f42169909f4151d69b +Subproject commit f2eec2adf590d60e91dda77de6f11d757ad6055f diff --git a/osu-resources b/osu-resources index 30031c02af..7c42cf0a56 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 30031c02aff374f0c5558f2d732614559301f658 +Subproject commit 7c42cf0a565ca125edcf335fabcb2ba3961d202d