From e8462ac134d0026f65f419c570912cdd4cbead8a Mon Sep 17 00:00:00 2001 From: gabixdev Date: Sun, 17 Sep 2017 00:47:55 +0200 Subject: [PATCH 01/13] Add option to disable cursor rotation. --- osu.Game/Configuration/OsuConfigManager.cs | 3 ++ osu.Game/Graphics/Cursor/MenuCursor.cs | 42 ++++++++++++------- .../Sections/Graphics/DetailSettings.cs | 16 +++++++ 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 44a6af841c..42474ce80b 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -54,6 +54,8 @@ namespace osu.Game.Configuration // Graphics Set(OsuSetting.ShowFpsDisplay, false); + Set(OsuSetting.CursorRotation, true); + Set(OsuSetting.MenuParallax, true); Set(OsuSetting.SnakingInSliders, true); @@ -96,6 +98,7 @@ namespace osu.Game.Configuration AudioOffset, MenuMusic, MenuVoice, + CursorRotation, MenuParallax, BeatmapDetailTab, Username, diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 36f23d1ae9..c20bcce1a4 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -26,26 +26,28 @@ namespace osu.Game.Graphics.Cursor protected override bool OnMouseMove(InputState state) { - if (dragging) - { - Debug.Assert(state.Mouse.PositionMouseDown != null); + if (((Cursor)ActiveCursor).DragRotating) { + if (dragging) { + Debug.Assert (state.Mouse.PositionMouseDown != null); - // don't start rotating until we're moved a minimum distance away from the mouse down location, - // else it can have an annoying effect. - startRotation |= Vector2Extensions.Distance(state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30; + // don't start rotating until we're moved a minimum distance away from the mouse down location, + // else it can have an annoying effect. + startRotation |= Vector2Extensions.Distance (state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30; - if (startRotation) - { - Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown.Value; - float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; + if (startRotation) { + Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown.Value; + float degrees = (float)MathHelper.RadiansToDegrees (Math.Atan2 (-offset.X, offset.Y)) + 24.3f; - // Always rotate in the direction of least distance - float diff = (degrees - ActiveCursor.Rotation) % 360; - if (diff < -180) diff += 360; - if (diff > 180) diff -= 360; - degrees = ActiveCursor.Rotation + diff; + // Always rotate in the direction of least distance + float diff = (degrees - ActiveCursor.Rotation) % 360; + if (diff < -180) + diff += 360; + if (diff > 180) + diff -= 360; + degrees = ActiveCursor.Rotation + diff; - ActiveCursor.RotateTo(degrees, 600, Easing.OutQuint); + ActiveCursor.RotateTo (degrees, 600, Easing.OutQuint); + } } } @@ -106,10 +108,14 @@ namespace osu.Game.Graphics.Cursor { private Container cursorContainer; private Bindable cursorScale; + public Bindable cursorRotate; + private const float base_scale = 0.15f; public Sprite AdditiveLayer; + public bool DragRotating; + public Cursor() { AutoSizeAxes = Axes.Both; @@ -143,6 +149,10 @@ namespace osu.Game.Graphics.Cursor cursorScale = config.GetBindable(OsuSetting.MenuCursorSize); cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale); cursorScale.TriggerChange(); + + cursorRotate = config.GetBindable (OsuSetting.CursorRotation); + cursorRotate.ValueChanged += newValue => this.DragRotating = newValue; + cursorRotate.TriggerChange(); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs index c068da8129..3d44a30254 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs @@ -1,10 +1,26 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; +using osu.Game.Configuration; + namespace osu.Game.Overlays.Settings.Sections.Graphics { public class DetailSettings : SettingsSubsection { protected override string Header => "Detail Settings"; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + Children = new[] + { + new SettingsCheckbox + { + LabelText = "Rotate cursor when dragging", + Bindable = config.GetBindable(OsuSetting.CursorRotation) + }, + }; + } } } From bfe1febef211fe85bc046f51e79c36baa8cb1def Mon Sep 17 00:00:00 2001 From: gabixdev Date: Sun, 17 Sep 2017 01:00:44 +0200 Subject: [PATCH 02/13] Fix field access + remove unneeded this --- osu.Game/Graphics/Cursor/MenuCursor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index c20bcce1a4..e3d30c5a7c 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -108,7 +108,7 @@ namespace osu.Game.Graphics.Cursor { private Container cursorContainer; private Bindable cursorScale; - public Bindable cursorRotate; + private Bindable cursorRotate; private const float base_scale = 0.15f; @@ -151,7 +151,7 @@ namespace osu.Game.Graphics.Cursor cursorScale.TriggerChange(); cursorRotate = config.GetBindable (OsuSetting.CursorRotation); - cursorRotate.ValueChanged += newValue => this.DragRotating = newValue; + cursorRotate.ValueChanged += newValue => DragRotating = newValue; cursorRotate.TriggerChange(); } } From 846838c621afa90299a0643a19f34b3eaec80f89 Mon Sep 17 00:00:00 2001 From: gabixdev Date: Sun, 17 Sep 2017 01:14:33 +0200 Subject: [PATCH 03/13] Move to MenuCursor --- osu.Game/Graphics/Cursor/MenuCursor.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index e3d30c5a7c..bfa7b30fc2 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -20,13 +20,16 @@ namespace osu.Game.Graphics.Cursor { protected override Drawable CreateCursor() => new Cursor(); + private Bindable cursorRotate; + private bool dragRotating; + private bool dragging; private bool startRotation; protected override bool OnMouseMove(InputState state) { - if (((Cursor)ActiveCursor).DragRotating) { + if (dragRotating) { if (dragging) { Debug.Assert (state.Mouse.PositionMouseDown != null); @@ -104,18 +107,23 @@ namespace osu.Game.Graphics.Cursor ActiveCursor.ScaleTo(0, 500, Easing.In); } + [BackgroundDependencyLoader] + private void load(OsuConfigManager config, TextureStore textures, OsuColour colour) + { + cursorRotate = config.GetBindable (OsuSetting.CursorRotation); + cursorRotate.ValueChanged += newValue => dragRotating = newValue; + cursorRotate.TriggerChange(); + } + public class Cursor : Container { private Container cursorContainer; private Bindable cursorScale; - private Bindable cursorRotate; private const float base_scale = 0.15f; public Sprite AdditiveLayer; - public bool DragRotating; - public Cursor() { AutoSizeAxes = Axes.Both; @@ -149,10 +157,6 @@ namespace osu.Game.Graphics.Cursor cursorScale = config.GetBindable(OsuSetting.MenuCursorSize); cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale); cursorScale.TriggerChange(); - - cursorRotate = config.GetBindable (OsuSetting.CursorRotation); - cursorRotate.ValueChanged += newValue => DragRotating = newValue; - cursorRotate.TriggerChange(); } } } From a8ada75633265a78cb1350336ed0d5f7c4db21a8 Mon Sep 17 00:00:00 2001 From: gabixdev Date: Sun, 17 Sep 2017 01:28:02 +0200 Subject: [PATCH 04/13] CODE STYLE XD --- osu.Game/Graphics/Cursor/MenuCursor.cs | 39 ++++++++++++-------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index bfa7b30fc2..9f8808539d 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -21,7 +21,6 @@ namespace osu.Game.Graphics.Cursor protected override Drawable CreateCursor() => new Cursor(); private Bindable cursorRotate; - private bool dragRotating; private bool dragging; @@ -29,28 +28,27 @@ namespace osu.Game.Graphics.Cursor protected override bool OnMouseMove(InputState state) { - if (dragRotating) { - if (dragging) { - Debug.Assert (state.Mouse.PositionMouseDown != null); + if (cursorRotate && dragging) + { + Debug.Assert (state.Mouse.PositionMouseDown != null); - // don't start rotating until we're moved a minimum distance away from the mouse down location, - // else it can have an annoying effect. - startRotation |= Vector2Extensions.Distance (state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30; + // don't start rotating until we're moved a minimum distance away from the mouse down location, + // else it can have an annoying effect. + startRotation |= Vector2Extensions.Distance (state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30; - if (startRotation) { - Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown.Value; - float degrees = (float)MathHelper.RadiansToDegrees (Math.Atan2 (-offset.X, offset.Y)) + 24.3f; + if (startRotation) { + Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown.Value; + float degrees = (float)MathHelper.RadiansToDegrees (Math.Atan2 (-offset.X, offset.Y)) + 24.3f; - // Always rotate in the direction of least distance - float diff = (degrees - ActiveCursor.Rotation) % 360; - if (diff < -180) - diff += 360; - if (diff > 180) - diff -= 360; - degrees = ActiveCursor.Rotation + diff; + // Always rotate in the direction of least distance + float diff = (degrees - ActiveCursor.Rotation) % 360; + if (diff < -180) + diff += 360; + if (diff > 180) + diff -= 360; + degrees = ActiveCursor.Rotation + diff; - ActiveCursor.RotateTo (degrees, 600, Easing.OutQuint); - } + ActiveCursor.RotateTo (degrees, 600, Easing.OutQuint); } } @@ -108,10 +106,9 @@ namespace osu.Game.Graphics.Cursor } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, TextureStore textures, OsuColour colour) + private void load(OsuConfigManager config) { cursorRotate = config.GetBindable (OsuSetting.CursorRotation); - cursorRotate.ValueChanged += newValue => dragRotating = newValue; cursorRotate.TriggerChange(); } From 48008cd7e655673a0b8f87e4bd2c4e51ade8ca6a Mon Sep 17 00:00:00 2001 From: gabixdev Date: Sun, 17 Sep 2017 01:34:56 +0200 Subject: [PATCH 05/13] ... --- osu.Game/Graphics/Cursor/MenuCursor.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 9f8808539d..1b126edf4a 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -109,7 +109,6 @@ namespace osu.Game.Graphics.Cursor private void load(OsuConfigManager config) { cursorRotate = config.GetBindable (OsuSetting.CursorRotation); - cursorRotate.TriggerChange(); } public class Cursor : Container From a33dfbba25f41ad40a1adcc551d416f76849bac6 Mon Sep 17 00:00:00 2001 From: gabixdev Date: Sun, 17 Sep 2017 01:40:38 +0200 Subject: [PATCH 06/13] Code reformat --- osu.Game/Graphics/Cursor/MenuCursor.cs | 81 ++++++++++++-------------- osu.Game/osu.Game.csproj | 18 ++++-- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 1b126edf4a..fe356b5dc1 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -18,7 +18,7 @@ namespace osu.Game.Graphics.Cursor { public class MenuCursor : CursorContainer { - protected override Drawable CreateCursor() => new Cursor(); + protected override Drawable CreateCursor () => new Cursor(); private Bindable cursorRotate; @@ -26,10 +26,9 @@ namespace osu.Game.Graphics.Cursor private bool startRotation; - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove (InputState state) { - if (cursorRotate && dragging) - { + if (cursorRotate && dragging) { Debug.Assert (state.Mouse.PositionMouseDown != null); // don't start rotating until we're moved a minimum distance away from the mouse down location, @@ -52,61 +51,60 @@ namespace osu.Game.Graphics.Cursor } } - return base.OnMouseMove(state); + return base.OnMouseMove (state); } - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart (InputState state) { dragging = true; - return base.OnDragStart(state); + return base.OnDragStart (state); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown (InputState state, MouseDownEventArgs args) { - ActiveCursor.Scale = new Vector2(1); - ActiveCursor.ScaleTo(0.90f, 800, Easing.OutQuint); + ActiveCursor.Scale = new Vector2 (1); + ActiveCursor.ScaleTo (0.90f, 800, Easing.OutQuint); ((Cursor)ActiveCursor).AdditiveLayer.Alpha = 0; - ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); - return base.OnMouseDown(state, args); + ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero (800, Easing.OutQuint); + return base.OnMouseDown (state, args); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp (InputState state, MouseUpEventArgs args) { - if (!state.Mouse.HasMainButtonPressed) - { + if (!state.Mouse.HasMainButtonPressed) { dragging = false; startRotation = false; - ((Cursor)ActiveCursor).AdditiveLayer.FadeOut(500, Easing.OutQuint); - ActiveCursor.RotateTo(0, 600 * (1 + Math.Abs(ActiveCursor.Rotation / 720)), Easing.OutElasticHalf); - ActiveCursor.ScaleTo(1, 500, Easing.OutElastic); + ((Cursor)ActiveCursor).AdditiveLayer.FadeOut (500, Easing.OutQuint); + ActiveCursor.RotateTo (0, 600 * (1 + Math.Abs (ActiveCursor.Rotation / 720)), Easing.OutElasticHalf); + ActiveCursor.ScaleTo (1, 500, Easing.OutElastic); } - return base.OnMouseUp(state, args); + return base.OnMouseUp (state, args); } - protected override bool OnClick(InputState state) + protected override bool OnClick (InputState state) { - ((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); + ((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne (500, Easing.OutQuint); - return base.OnClick(state); + return base.OnClick (state); } - protected override void PopIn() + protected override void PopIn () { - ActiveCursor.FadeTo(1, 250, Easing.OutQuint); - ActiveCursor.ScaleTo(1, 400, Easing.OutQuint); + ActiveCursor.FadeTo (1, 250, Easing.OutQuint); + ActiveCursor.ScaleTo (1, 400, Easing.OutQuint); } - protected override void PopOut() + protected override void PopOut () { - ActiveCursor.FadeTo(0, 900, Easing.OutQuint); - ActiveCursor.ScaleTo(0, 500, Easing.In); + ActiveCursor.FadeTo (0, 900, Easing.OutQuint); + ActiveCursor.ScaleTo (0, 500, Easing.In); } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load (OsuConfigManager config) { cursorRotate = config.GetBindable (OsuSetting.CursorRotation); } @@ -120,7 +118,7 @@ namespace osu.Game.Graphics.Cursor public Sprite AdditiveLayer; - public Cursor() + public Cursor () { AutoSizeAxes = Axes.Both; } @@ -128,30 +126,25 @@ namespace osu.Game.Graphics.Cursor [BackgroundDependencyLoader] private void load(OsuConfigManager config, TextureStore textures, OsuColour colour) { - Children = new Drawable[] - { - cursorContainer = new Container - { + Children = new Drawable[] { + cursorContainer = new Container { AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new Sprite - { - Texture = textures.Get(@"Cursor/menu-cursor"), + Children = new Drawable[] { + new Sprite { + Texture = textures.Get (@"Cursor/menu-cursor"), }, - AdditiveLayer = new Sprite - { + AdditiveLayer = new Sprite { Blending = BlendingMode.Additive, Colour = colour.Pink, Alpha = 0, - Texture = textures.Get(@"Cursor/menu-cursor-additive"), + Texture = textures.Get (@"Cursor/menu-cursor-additive"), }, } } }; - cursorScale = config.GetBindable(OsuSetting.MenuCursorSize); - cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale); + cursorScale = config.GetBindable (OsuSetting.MenuCursorSize); + cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2 ((float)newScale * base_scale); cursorScale.TriggerChange(); } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 92bcaf90f0..2bd7cbef77 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -1,5 +1,5 @@  - + Debug @@ -23,7 +23,6 @@ DEBUG;TRACE prompt 4 - false 6 @@ -33,7 +32,6 @@ TRACE prompt 4 - false @@ -561,11 +559,11 @@ - {c76bf5b3-985e-4d39-95fe-97c9c879b83a} + {C76BF5B3-985E-4D39-95FE-97C9C879B83A} osu.Framework - {d9a367c9-4c1a-489f-9b05-a0cea2b53b58} + {D9A367C9-4C1A-489F-9B05-A0CEA2B53B58} osu.Game.Resources @@ -585,4 +583,14 @@ --> + + + + + + + + + + \ No newline at end of file From 3c00a7cc513f925f9e0a0ceabe9ee7b9f001086d Mon Sep 17 00:00:00 2001 From: gabixdev Date: Sun, 17 Sep 2017 01:44:49 +0200 Subject: [PATCH 07/13] Reformat again... --- osu.Game/Graphics/Cursor/MenuCursor.cs | 94 ++++++++++++++------------ 1 file changed, 51 insertions(+), 43 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index fe356b5dc1..ae37aca6a4 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -18,7 +18,7 @@ namespace osu.Game.Graphics.Cursor { public class MenuCursor : CursorContainer { - protected override Drawable CreateCursor () => new Cursor(); + protected override Drawable CreateCursor() => new Cursor(); private Bindable cursorRotate; @@ -26,18 +26,20 @@ namespace osu.Game.Graphics.Cursor private bool startRotation; - protected override bool OnMouseMove (InputState state) + protected override bool OnMouseMove(InputState state) { - if (cursorRotate && dragging) { - Debug.Assert (state.Mouse.PositionMouseDown != null); + if (cursorRotate && dragging) + { + Debug.Assert(state.Mouse.PositionMouseDown != null); // don't start rotating until we're moved a minimum distance away from the mouse down location, // else it can have an annoying effect. - startRotation |= Vector2Extensions.Distance (state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30; + startRotation |= Vector2Extensions.Distance(state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30; - if (startRotation) { + if (startRotation) + { Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown.Value; - float degrees = (float)MathHelper.RadiansToDegrees (Math.Atan2 (-offset.X, offset.Y)) + 24.3f; + float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; // Always rotate in the direction of least distance float diff = (degrees - ActiveCursor.Rotation) % 360; @@ -47,66 +49,67 @@ namespace osu.Game.Graphics.Cursor diff -= 360; degrees = ActiveCursor.Rotation + diff; - ActiveCursor.RotateTo (degrees, 600, Easing.OutQuint); + ActiveCursor.RotateTo(degrees, 600, Easing.OutQuint); } } - return base.OnMouseMove (state); + return base.OnMouseMove(state); } - protected override bool OnDragStart (InputState state) + protected override bool OnDragStart(InputState state) { dragging = true; - return base.OnDragStart (state); + return base.OnDragStart(state); } - protected override bool OnMouseDown (InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - ActiveCursor.Scale = new Vector2 (1); - ActiveCursor.ScaleTo (0.90f, 800, Easing.OutQuint); + ActiveCursor.Scale = new Vector2(1); + ActiveCursor.ScaleTo(0.90f, 800, Easing.OutQuint); ((Cursor)ActiveCursor).AdditiveLayer.Alpha = 0; - ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero (800, Easing.OutQuint); - return base.OnMouseDown (state, args); + ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); + return base.OnMouseDown(state, args); } - protected override bool OnMouseUp (InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - if (!state.Mouse.HasMainButtonPressed) { + if (!state.Mouse.HasMainButtonPressed) + { dragging = false; startRotation = false; - ((Cursor)ActiveCursor).AdditiveLayer.FadeOut (500, Easing.OutQuint); - ActiveCursor.RotateTo (0, 600 * (1 + Math.Abs (ActiveCursor.Rotation / 720)), Easing.OutElasticHalf); - ActiveCursor.ScaleTo (1, 500, Easing.OutElastic); + ((Cursor)ActiveCursor).AdditiveLayer.FadeOut(500, Easing.OutQuint); + ActiveCursor.RotateTo(0, 600 * (1 + Math.Abs(ActiveCursor.Rotation / 720)), Easing.OutElasticHalf); + ActiveCursor.ScaleTo(1, 500, Easing.OutElastic); } - return base.OnMouseUp (state, args); + return base.OnMouseUp(state, args); } - protected override bool OnClick (InputState state) + protected override bool OnClick(InputState state) { - ((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne (500, Easing.OutQuint); + ((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); - return base.OnClick (state); + return base.OnClick(state); } - protected override void PopIn () + protected override void PopIn() { - ActiveCursor.FadeTo (1, 250, Easing.OutQuint); - ActiveCursor.ScaleTo (1, 400, Easing.OutQuint); + ActiveCursor.FadeTo(1, 250, Easing.OutQuint); + ActiveCursor.ScaleTo(1, 400, Easing.OutQuint); } - protected override void PopOut () + protected override void PopOut() { - ActiveCursor.FadeTo (0, 900, Easing.OutQuint); - ActiveCursor.ScaleTo (0, 500, Easing.In); + ActiveCursor.FadeTo(0, 900, Easing.OutQuint); + ActiveCursor.ScaleTo(0, 500, Easing.In); } [BackgroundDependencyLoader] - private void load (OsuConfigManager config) + private void load(OsuConfigManager config) { - cursorRotate = config.GetBindable (OsuSetting.CursorRotation); + cursorRotate = config.GetBindable(OsuSetting.CursorRotation); } public class Cursor : Container @@ -118,7 +121,7 @@ namespace osu.Game.Graphics.Cursor public Sprite AdditiveLayer; - public Cursor () + public Cursor() { AutoSizeAxes = Axes.Both; } @@ -126,25 +129,30 @@ namespace osu.Game.Graphics.Cursor [BackgroundDependencyLoader] private void load(OsuConfigManager config, TextureStore textures, OsuColour colour) { - Children = new Drawable[] { - cursorContainer = new Container { + Children = new Drawable[] + { + cursorContainer = new Container + { AutoSizeAxes = Axes.Both, - Children = new Drawable[] { - new Sprite { - Texture = textures.Get (@"Cursor/menu-cursor"), + Children = new Drawable[] + { + new Sprite + { + Texture = textures.Get(@"Cursor/menu-cursor"), }, - AdditiveLayer = new Sprite { + AdditiveLayer = new Sprite + { Blending = BlendingMode.Additive, Colour = colour.Pink, Alpha = 0, - Texture = textures.Get (@"Cursor/menu-cursor-additive"), + Texture = textures.Get(@"Cursor/menu-cursor-additive"), }, } } }; - cursorScale = config.GetBindable (OsuSetting.MenuCursorSize); - cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2 ((float)newScale * base_scale); + cursorScale = config.GetBindable(OsuSetting.MenuCursorSize); + cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale); cursorScale.TriggerChange(); } } From 387705b2b63ec0d709eddb15cf26db5b40ae9ce8 Mon Sep 17 00:00:00 2001 From: gabixdev Date: Sun, 17 Sep 2017 19:43:53 +0200 Subject: [PATCH 08/13] revert csproj --- osu.Game/osu.Game.csproj | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2bd7cbef77..92bcaf90f0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -1,5 +1,5 @@  - + Debug @@ -23,6 +23,7 @@ DEBUG;TRACE prompt 4 + false 6 @@ -32,6 +33,7 @@ TRACE prompt 4 + false @@ -559,11 +561,11 @@ - {C76BF5B3-985E-4D39-95FE-97C9C879B83A} + {c76bf5b3-985e-4d39-95fe-97c9c879b83a} osu.Framework - {D9A367C9-4C1A-489F-9B05-A0CEA2B53B58} + {d9a367c9-4c1a-489f-9b05-a0cea2b53b58} osu.Game.Resources @@ -583,14 +585,4 @@ --> - - - - - - - - - - \ No newline at end of file From 2923af19461383a71cc86889eeee388a0c85c6cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Sep 2017 23:35:23 +0900 Subject: [PATCH 09/13] Allow deploy script to deploy multiple project targets --- osu.Desktop.Deploy/Program.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index a181a6fa5e..785f915a3e 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -29,7 +29,7 @@ namespace osu.Desktop.Deploy public static string SolutionName = ConfigurationManager.AppSettings["SolutionName"]; public static string ProjectName = ConfigurationManager.AppSettings["ProjectName"]; public static string NuSpecName = ConfigurationManager.AppSettings["NuSpecName"]; - public static string TargetName = ConfigurationManager.AppSettings["TargetName"]; + public static string TargetNames = ConfigurationManager.AppSettings["TargetName"]; public static string PackageName = ConfigurationManager.AppSettings["PackageName"]; public static string IconName = ConfigurationManager.AppSettings["IconName"]; public static string CodeSigningCertificate = ConfigurationManager.AppSettings["CodeSigningCertificate"]; @@ -100,7 +100,8 @@ namespace osu.Desktop.Deploy updateAssemblyInfo(version); write("Running build process..."); - runCommand(msbuild_path, $"/v:quiet /m /t:{TargetName.Replace('.', '_')} /p:OutputPath={stagingPath};Targets=\"Clean;Build\";Configuration=Release {SolutionName}.sln"); + foreach (string targetName in TargetNames.Split(',')) + runCommand(msbuild_path, $"/v:quiet /m /t:{targetName.Replace('.', '_')} /p:OutputPath={stagingPath};Targets=\"Clean;Build\";Configuration=Release {SolutionName}.sln"); write("Creating NuGet deployment package..."); runCommand(nuget_path, $"pack {NuSpecName} -Version {version} -Properties Configuration=Deploy -OutputDirectory {stagingPath} -BasePath {stagingPath}"); From 120446e4a72ddef607693884800d07b01547dfc1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Sep 2017 14:31:17 +0900 Subject: [PATCH 10/13] Ensure only one dialog is being displayed by the SongSelect footer at a time Fixes #1208 --- osu.Game/Screens/Select/Footer.cs | 26 +++++++++++++++++++++++ osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index bb6d16da0f..6636dbde76 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Linq; using OpenTK; using OpenTK.Graphics; @@ -58,6 +59,31 @@ namespace osu.Game.Screens.Select Action = action, }); + private readonly List overlays = new List(); + + /// Text on the button. + /// Colour of the button. + /// Hotkey of the button. + /// The to be toggled by this button. + /// + /// Higher depth to be put on the left, and lower to be put on the right. + /// Notice this is different to ! + /// + public void AddButton(string text, Color4 colour, OverlayContainer overlay, Key? hotkey = null, float depth = 0) + { + overlays.Add(overlay); + AddButton(text, colour, () => + { + foreach (var o in overlays) + { + if (o == overlay) + overlay.ToggleVisibility(); + else + overlay.Hide(); + } + }, hotkey, depth); + } + private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, Easing.OutQuint); public Footer() diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 7e03707d18..e0a3693371 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -45,7 +45,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colours) { - Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, float.MaxValue); + Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 84457b77a7..836ed465c3 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Select if (Footer != null) { Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); - Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3); + Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3); BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, () => promptDelete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); } From 8438ea1267c28a2e86b210d099fb8a83dc904c6f Mon Sep 17 00:00:00 2001 From: gabixdev Date: Thu, 21 Sep 2017 22:11:35 +0200 Subject: [PATCH 11/13] Fix formatting ;_; --- osu.Game/Graphics/Cursor/MenuCursor.cs | 8 ++------ .../Overlays/Settings/Sections/Graphics/DetailSettings.cs | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index ae37aca6a4..da117a94c1 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -21,7 +21,6 @@ namespace osu.Game.Graphics.Cursor protected override Drawable CreateCursor() => new Cursor(); private Bindable cursorRotate; - private bool dragging; private bool startRotation; @@ -43,10 +42,8 @@ namespace osu.Game.Graphics.Cursor // Always rotate in the direction of least distance float diff = (degrees - ActiveCursor.Rotation) % 360; - if (diff < -180) - diff += 360; - if (diff > 180) - diff -= 360; + if (diff < -180) diff += 360; + if (diff > 180) diff -= 360; degrees = ActiveCursor.Rotation + diff; ActiveCursor.RotateTo(degrees, 600, Easing.OutQuint); @@ -116,7 +113,6 @@ namespace osu.Game.Graphics.Cursor { private Container cursorContainer; private Bindable cursorScale; - private const float base_scale = 0.15f; public Sprite AdditiveLayer; diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs index 3d44a30254..0e348f3791 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Game.Configuration; - namespace osu.Game.Overlays.Settings.Sections.Graphics { public class DetailSettings : SettingsSubsection From e04526222cbf4f4024f680855b329b3251b84340 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Fri, 22 Sep 2017 22:47:26 +0200 Subject: [PATCH 12/13] URL encode beatmap filename --- osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs index 15e20a3d55..934ef7ffa2 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -10,7 +10,7 @@ namespace osu.Game.Online.API.Requests { private readonly BeatmapInfo beatmap; - private string lookupString => beatmap.OnlineBeatmapID > 0 ? beatmap.OnlineBeatmapID.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={beatmap.Path}"; + private string lookupString => beatmap.OnlineBeatmapID > 0 ? beatmap.OnlineBeatmapID.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={System.Uri.EscapeUriString(beatmap.Path)}"; public GetBeatmapDetailsRequest(BeatmapInfo beatmap) { From 442259d9e0b66d6a14a05bbd4ec36aee229f996b Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sat, 23 Sep 2017 19:47:23 +0800 Subject: [PATCH 13/13] Fix overlay toggling in song select. --- osu.Game/Screens/Select/Footer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 6636dbde76..00f311e522 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -77,9 +77,9 @@ namespace osu.Game.Screens.Select foreach (var o in overlays) { if (o == overlay) - overlay.ToggleVisibility(); + o.ToggleVisibility(); else - overlay.Hide(); + o.Hide(); } }, hotkey, depth); }