From 0da950beac62018f4edaecf14b1996df40b75993 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Mar 2017 12:31:09 +0900 Subject: [PATCH 1/9] Fix KeyCounter M1 M2 display. --- osu.Game/Screens/Play/KeyCounterMouse.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 037d890a9e..425bcffee5 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -10,11 +10,25 @@ namespace osu.Game.Screens.Play public class KeyCounterMouse : KeyCounter { public MouseButton Button { get; } - public KeyCounterMouse(MouseButton button) : base(button.ToString()) + + public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button)) { Button = button; } + private static string getStringRepresentation(MouseButton button) + { + switch (button) + { + default: + return button.ToString(); + case MouseButton.Left: + return @"M1"; + case MouseButton.Right: + return @"M2"; + } + } + public override bool Contains(Vector2 screenSpacePos) => true; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) From 1f68731a0957a608791274393a349426939081db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Mar 2017 16:00:35 +0900 Subject: [PATCH 2/9] Split PlayerInputManager into two classes, allowing more precise handling of input (for KeyCounter). --- .../OsuKeyConversionInputManager.cs | 56 +++++++++++++++++++ osu.Game.Modes.Osu/UI/OsuHitRenderer.cs | 3 + osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj | 1 + osu.Game/Modes/UI/HitRenderer.cs | 9 ++- .../Screens/Play/KeyConversionInputManager.cs | 16 ++++++ osu.Game/Screens/Play/PlayerInputManager.cs | 45 --------------- osu.Game/osu.Game.csproj | 1 + 7 files changed, 85 insertions(+), 46 deletions(-) create mode 100644 osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs create mode 100644 osu.Game/Screens/Play/KeyConversionInputManager.cs diff --git a/osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs b/osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs new file mode 100644 index 0000000000..986240b37f --- /dev/null +++ b/osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs @@ -0,0 +1,56 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Input; +using osu.Game.Configuration; +using osu.Game.Screens.Play; +using OpenTK.Input; +using KeyboardState = osu.Framework.Input.KeyboardState; +using MouseState = osu.Framework.Input.MouseState; + +namespace osu.Game.Modes.Osu +{ + public class OsuKeyConversionInputManager : KeyConversionInputManager + { + private bool leftViaKeyboard; + private bool rightViaKeyboard; + private Bindable mouseDisabled; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + mouseDisabled = config.GetBindable(OsuConfig.MouseDisableButtons); + } + + protected override void TransformState(InputState state) + { + base.TransformState(state); + + var mouse = state.Mouse as MouseState; + var keyboard = state.Keyboard as KeyboardState; + + if (keyboard != null) + { + leftViaKeyboard = keyboard.Keys.Contains(Key.Z); + rightViaKeyboard = keyboard.Keys.Contains(Key.X); + } + + if (mouse != null) + { + if (mouseDisabled.Value) + { + mouse.PressedButtons.Remove(MouseButton.Left); + mouse.PressedButtons.Remove(MouseButton.Right); + } + + if (leftViaKeyboard) + mouse.PressedButtons.Add(MouseButton.Left); + if (rightViaKeyboard) + mouse.PressedButtons.Add(MouseButton.Right); + } + } + } +} diff --git a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs index 8b7606e61e..5a09629f79 100644 --- a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs @@ -7,6 +7,7 @@ using osu.Game.Modes.Osu.Beatmaps; using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.Objects.Drawables; using osu.Game.Modes.UI; +using osu.Game.Screens.Play; namespace osu.Game.Modes.Osu.UI { @@ -21,6 +22,8 @@ namespace osu.Game.Modes.Osu.UI protected override Playfield CreatePlayfield() => new OsuPlayfield(); + protected override KeyConversionInputManager CreateKeyConversionInputManager() => new OsuKeyConversionInputManager(); + protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { var circle = h as HitCircle; diff --git a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj index 47f94b1026..6d05f64534 100644 --- a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj +++ b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj @@ -73,6 +73,7 @@ + diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index e08570522f..ec1ac9b170 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -44,6 +44,8 @@ namespace osu.Game.Modes.UI public abstract class HitRenderer : HitRenderer where TObject : HitObject { + internal readonly KeyConversionInputManager KeyConversionInputManager; + public override Func MapPlayfieldToScreenSpace => Playfield.ScaledContent.ToScreenSpace; public IEnumerable DrawableObjects => Playfield.HitObjects.Children; @@ -61,12 +63,16 @@ namespace osu.Game.Modes.UI RelativeSizeAxes = Axes.Both; + KeyConversionInputManager = CreateKeyConversionInputManager(); + KeyConversionInputManager.RelativeSizeAxes = Axes.Both; + KeyConversionInputManager.Add(Playfield = CreatePlayfield()); + InputManager.Add(content = new Container { RelativeSizeAxes = Axes.Both, Children = new[] { - Playfield = CreatePlayfield(), + KeyConversionInputManager } }); @@ -102,5 +108,6 @@ namespace osu.Game.Modes.UI protected abstract DrawableHitObject GetVisualRepresentation(TObject h); protected abstract Playfield CreatePlayfield(); protected abstract IBeatmapConverter CreateBeatmapConverter(); + protected virtual KeyConversionInputManager CreateKeyConversionInputManager() => new KeyConversionInputManager(); } } diff --git a/osu.Game/Screens/Play/KeyConversionInputManager.cs b/osu.Game/Screens/Play/KeyConversionInputManager.cs new file mode 100644 index 0000000000..f3ca764bd7 --- /dev/null +++ b/osu.Game/Screens/Play/KeyConversionInputManager.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Input; + +namespace osu.Game.Screens.Play +{ + /// + /// An InputManager primarily used to map keys to new functions. + /// By default this does nothing; override TransformState to make alterations. + /// + public class KeyConversionInputManager : PassThroughInputManager + { + + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index 3eab30c50d..32d20118af 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -1,25 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Input; -using osu.Game.Configuration; -using System.Linq; using osu.Framework.Timing; using osu.Game.Input.Handlers; -using OpenTK.Input; -using KeyboardState = osu.Framework.Input.KeyboardState; -using MouseState = osu.Framework.Input.MouseState; namespace osu.Game.Screens.Play { public class PlayerInputManager : PassThroughInputManager { - private bool leftViaKeyboard; - private bool rightViaKeyboard; - private Bindable mouseDisabled; - private ManualClock clock = new ManualClock(); private IFrameBasedClock parentClock; @@ -47,40 +36,6 @@ namespace osu.Game.Screens.Play Clock = new FramedClock(clock); } - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - mouseDisabled = config.GetBindable(OsuConfig.MouseDisableButtons); - } - - protected override void TransformState(InputState state) - { - base.TransformState(state); - - var mouse = state.Mouse as MouseState; - var keyboard = state.Keyboard as KeyboardState; - - if (keyboard != null) - { - leftViaKeyboard = keyboard.Keys.Contains(Key.Z); - rightViaKeyboard = keyboard.Keys.Contains(Key.X); - } - - if (mouse != null) - { - if (mouseDisabled.Value) - { - mouse.PressedButtons.Remove(MouseButton.Left); - mouse.PressedButtons.Remove(MouseButton.Right); - } - - if (leftViaKeyboard) - mouse.PressedButtons.Add(MouseButton.Left); - if (rightViaKeyboard) - mouse.PressedButtons.Add(MouseButton.Right); - } - } - protected override void Update() { base.Update(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 4a8f41b1ac..cc4685ec01 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -167,6 +167,7 @@ + From 69e1fa98ef108b64de4dfdfab2e9670ae44ee293 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Mar 2017 16:09:05 +0900 Subject: [PATCH 3/9] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index e52af1e5ad..0493e39a61 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit e52af1e5ada07468512e19c86b6dcd5a23fe3707 +Subproject commit 0493e39a610f633d43c9fe44a5e9f26459695343 From 71959b161d02074abf3389a77d9c97461bc9ea2d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Mar 2017 17:39:32 +0900 Subject: [PATCH 4/9] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 0493e39a61..4834d27107 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 0493e39a610f633d43c9fe44a5e9f26459695343 +Subproject commit 4834d27107198b9dc2f0e073be484cf0b92e0416 From 31c41e3e143757afacfb78d1f1c59377bce86719 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Mar 2017 20:23:07 +0900 Subject: [PATCH 5/9] Don't overwrite newer config files (doesn't seem to fix anything buut..). --- osu.Desktop.Deploy/osu.Desktop.Deploy.csproj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj index 6bed6bb049..7a3719a25b 100644 --- a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj +++ b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj @@ -104,7 +104,9 @@ osu.licenseheader - + + PreserveNewest + From c192de9ebd0a9ab4ed617e102d36abf2b194ed22 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Mar 2017 20:23:18 +0900 Subject: [PATCH 6/9] Give deploy uploads more time before dying. --- osu.Desktop.Deploy/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index 7141b6d52f..d3166a4fdc 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -198,7 +198,7 @@ namespace osu.Desktop.Deploy write($"- Creating release {version}...", ConsoleColor.Yellow); var req = new JsonWebRequest($"{GitHubApiEndpoint}") { - Method = HttpMethod.POST + Method = HttpMethod.POST, }; req.AddRaw(JsonConvert.SerializeObject(new GitHubRelease { @@ -215,6 +215,7 @@ namespace osu.Desktop.Deploy var upload = new WebRequest(assetUploadUrl, Path.GetFileName(a)) { Method = HttpMethod.POST, + Timeout = 240000, ContentType = "application/octet-stream", }; From 1699c9fb1d763259290f18de8363a60529bae727 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Mar 2017 20:23:37 +0900 Subject: [PATCH 7/9] Don't download executables when pulling down existing assets. --- osu.Desktop.Deploy/Program.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index d3166a4fdc..e47c6b3a01 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -283,6 +283,8 @@ namespace osu.Desktop.Deploy foreach (var a in assets) { + if (a.Name.EndsWith(".exe")) continue; + write($"- Downloading {a.Name}...", ConsoleColor.Yellow); new FileWebRequest(Path.Combine(ReleasesFolder, a.Name), $"{GitHubApiEndpoint}/assets/{a.Id}").AuthenticatedBlockingPerform(); } From 864a97fa45a9968c1ddf9405f853092b92f843eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Mar 2017 20:23:53 +0900 Subject: [PATCH 8/9] Output StandardError when an error occurs with a command line invocation. --- osu.Desktop.Deploy/Program.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index e47c6b3a01..f14506ce72 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -340,6 +340,7 @@ namespace osu.Desktop.Deploy WorkingDirectory = solutionPath, CreateNoWindow = true, RedirectStandardOutput = true, + RedirectStandardError = true, UseShellExecute = false, WindowStyle = ProcessWindowStyle.Hidden }; @@ -348,6 +349,7 @@ namespace osu.Desktop.Deploy if (p == null) return false; string output = p.StandardOutput.ReadToEnd(); + output += p.StandardError.ReadToEnd(); if (p.ExitCode == 0) return true; From 10ab015501a067e2b84c8979e789f736d76883d2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Mar 2017 20:23:58 +0900 Subject: [PATCH 9/9] Fix typo. --- osu.Desktop.Deploy/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index f14506ce72..00ec215e8a 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -262,7 +262,7 @@ namespace osu.Desktop.Deploy if (!File.Exists(Path.Combine(ReleasesFolder, nupkgDistroFilename(lastRelease.Name)))) { - write("Last verion's package not found locally.", ConsoleColor.Red); + write("Last version's package not found locally.", ConsoleColor.Red); requireDownload = true; } else