From 74fa33669323d9970b3cb1685203325306f9ef71 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 14:25:46 +0900 Subject: [PATCH 01/57] Update vscode launch/task configuration. Adds debug/release launching. Cleans up much. Also updates tasks.json schema to 2.0.0 which supports multiple commands. Can't use until https://github.com/Microsoft/vscode/issues/22250 is fixed. --- .vscode/launch.json | 40 +++++++++++++++-------- .vscode/tasks.json | 77 ++++++++++++++++++++++----------------------- 2 files changed, 65 insertions(+), 52 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 0e07b0a067..b3b86da42f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,46 +2,60 @@ "version": "0.2.0", "configurations": [ { - "name": "Launch VisualTests", + "name": "VisualTests (debug)", "windows": { "type": "clr" }, "type": "mono", "request": "launch", "program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe", - "args": [], "cwd": "${workspaceRoot}", - "preLaunchTask": "build", + "preLaunchTask": "Build (Debug)", "runtimeExecutable": null, "env": {}, "console": "internalConsole" }, { - "name": "Launch Desktop", + "name": "VisualTests (release)", + "windows": { + "type": "clr" + }, + "type": "mono", + "request": "launch", + "program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Release/osu!.exe", + "cwd": "${workspaceRoot}", + "preLaunchTask": "Build (Release)", + "runtimeExecutable": null, + "env": {}, + "console": "internalConsole" + }, + { + "name": "osu! (debug)", "windows": { "type": "clr" }, "type": "mono", "request": "launch", "program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe", - "args": [], "cwd": "${workspaceRoot}", - "preLaunchTask": "build", + "preLaunchTask": "Build (Debug)", "runtimeExecutable": null, "env": {}, "console": "internalConsole" }, { - "name": "Attach", + "name": "osu! (release)", "windows": { - "type": "clr", - "request": "attach", - "processName": "osu!" + "type": "clr" }, "type": "mono", - "request": "attach", - "address": "localhost", - "port": 55555 + "request": "launch", + "program": "${workspaceRoot}/osu.Desktop/bin/Release/osu!.exe", + "cwd": "${workspaceRoot}", + "preLaunchTask": "Build (Release)", + "runtimeExecutable": null, + "env": {}, + "console": "internalConsole" } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5eaeaa9899..f285ebde67 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,51 +1,50 @@ { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format - "version": "0.1.0", - "taskSelector": "/t:", + "version": "2.0.0", + "problemMatcher": "$msCompile", + "isShellCommand": true, + "command": "msbuild", + "suppressTaskName": true, + "showOutput": "silent", + "args": [ + "/property:GenerateFullPaths=true", + "/property:DebugType=portable" + ], + "windows": { + "args": [ + "/property:GenerateFullPaths=true", + "/property:DebugType=portable", + "/m" //parallel compiling support. doesn't work well with mono atm + ] + }, "tasks": [ { - "taskName": "build", - "isShellCommand": true, - "showOutput": "silent", - "command": "msbuild", - "args": [ - "/property:GenerateFullPaths=true", - "/property:DebugType=portable" - ], - "windows": { - "args": [ - "/property:GenerateFullPaths=true", - "/property:DebugType=portable", - "/m" //parallel compiling support. doesn't work well with mono atm - ] - }, - // Use the standard MS compiler pattern to detect errors, warnings and infos - "problemMatcher": "$msCompile", + "taskName": "Build (Debug)", "isBuildCommand": true }, { - "taskName": "rebuild", - "isShellCommand": true, - "showOutput": "silent", - "command": "msbuild", + "taskName": "Build (Release)", "args": [ - // Ask msbuild to generate full paths for file names. - "/property:GenerateFullPaths=true", - "/property:DebugType=portable", - "/target:Clean,Build" - ], - "windows": { - "args": [ - "/property:GenerateFullPaths=true", - "/property:DebugType=portable", - "/target:Clean,Build", - "/m" //parallel compiling support. doesn't work well with mono atm - ] - }, - // Use the standard MS compiler pattern to detect errors, warnings and infos - "problemMatcher": "$msCompile", - "isBuildCommand": true + "/property:Configuration=Release" + ] + }, + { + "taskName": "Clean All", + "dependsOn": ["Clean (Debug)", "Clean (Release)"] + }, + { + "taskName": "Clean (Debug)", + "args": [ + "/target:Clean" + ] + }, + { + "taskName": "Clean (Release)", + "args": [ + "/target:Clean", + "/property:Configuration=Release" + ] } ] } \ No newline at end of file From 4aea18b673a752afe24b83be4e3d2560010c2ef2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 1 May 2017 17:00:41 +0900 Subject: [PATCH 02/57] Add initial column design. --- .../Tests/TestCaseManiaPlayfield.cs | 217 ++++++++++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + 2 files changed, 218 insertions(+) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs new file mode 100644 index 0000000000..5932d0d7eb --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -0,0 +1,217 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using osu.Framework.Testing; +using osu.Game.Graphics; +using osu.Framework.Graphics.Primitives; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseManiaPlayfield : TestCase + { + public override string Description => @"Mania playfield"; + + public override void Reset() + { + base.Reset(); + + Add(new Column + { + AccentColour = new Color4(187, 17, 119, 255) + }); + } + } + + public class Column : Container, IHasAccentColour + { + private const float key_size = 50; + + private const float key_icon_size = 10; + private const float key_icon_corner_radius = 3; + private const float key_icon_border_radius = 2; + + private const float hit_target_height = 10; + private const float hit_target_bar_height = 2; + + private const float column_width = 45; + private const float special_column_width = 70; + + private Color4 accentColour; + public Color4 AccentColour + { + get { return accentColour; } + set + { + if (accentColour == value) + return; + accentColour = value; + + setAccentColour(); + } + } + + private bool isSpecialColumn; + public bool IsSpecialColumn + { + get { return isSpecialColumn; } + set + { + isSpecialColumn = value; + Width = isSpecialColumn ? special_column_width : column_width; + } + } + + private Box foreground; + private Container hitTargetBar; + private Container keyIcon; + + public Column() + { + RelativeSizeAxes = Axes.Y; + Width = column_width; + + Children = new Drawable[] + { + new Box + { + Name = "Background", + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = 1, Right = 1 }, + Children = new[] + { + foreground = new Box + { + Name = "Foreground", + RelativeSizeAxes = Axes.Both, + Alpha = 0.2f + }, + } + }, + new FillFlowContainer + { + Name = "Key + hit target", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new[] + { + new Container + { + Name = "Key", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = key_size, + Children = new Drawable[] + { + new Box + { + Name = "Key gradient", + RelativeSizeAxes = Axes.Both, + ColourInfo = ColourInfo.GradientVertical(Color4.Black, Color4.Black.Opacity(0)), + Alpha = 0.5f + }, + new Box + { + Name = "Key down foreground", + Alpha = 0f, + }, + keyIcon = new Container + { + Name = "Key icon", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(key_icon_size), + Masking = true, + CornerRadius = key_icon_corner_radius, + BorderThickness = 2, + BorderColour = Color4.White, // Not true + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + } + } + }, + new Container + { + Name = "Hit target", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = hit_target_height, + Children = new Drawable[] + { + new Box + { + Name = "Background", + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black + }, + hitTargetBar = new Container + { + Name = "Bar", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = hit_target_bar_height, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both + } + } + } + } + } + } + } + }; + } + + private void setAccentColour() + { + foreground.Colour = AccentColour; + + hitTargetBar.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Radius = 5, + Colour = AccentColour.Opacity(0.5f), + }; + + keyIcon.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Radius = 5, + Colour = AccentColour.Opacity(0.5f), + }; + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 135e4596c7..6a5d082aa3 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -190,6 +190,7 @@ + From 82cbb63af5dfab171f96f721ec08e4501f01a8f9 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 1 May 2017 17:24:35 +0900 Subject: [PATCH 03/57] Add column generation + put spacing one level up. --- .../Tests/TestCaseManiaPlayfield.cs | 73 ++++++++++++++----- 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 5932d0d7eb..65978a030c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -23,14 +23,63 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Mania playfield"; + private FlowContainer columns; + public override void Reset() { base.Reset(); - Add(new Column + Add(new Container { - AccentColour = new Color4(187, 17, 119, 255) + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black + }, + columns = new FillFlowContainer + { + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Padding = new MarginPadding { Left = 1, Right = 1 }, + Spacing = new Vector2(1, 0) + } + } }); + + var colours = new Color4[] + { + new Color4(187, 17, 119, 255), + new Color4(96, 204, 0, 255), + new Color4(17, 136, 170, 255) + }; + + int num_columns = 7; + int half_columns = num_columns / 2; + + for (int i = 0; i < num_columns; i++) + columns.Add(new Column()); + + for (int i = 0; i < half_columns; i++) + { + Color4 accent = colours[i % 2]; + columns.Children.ElementAt(i).AccentColour = accent; + columns.Children.ElementAt(num_columns - 1 - i).AccentColour = accent; + } + + bool hasSpecial = half_columns * 2 < num_columns; + if (hasSpecial) + { + Column specialColumn = columns.Children.ElementAt(half_columns); + specialColumn.IsSpecialColumn = true; + specialColumn.AccentColour = colours[2]; + } } } @@ -84,25 +133,11 @@ namespace osu.Desktop.VisualTests.Tests Children = new Drawable[] { - new Box + foreground = new Box { - Name = "Background", + Name = "Foreground", RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 1, Right = 1 }, - Children = new[] - { - foreground = new Box - { - Name = "Foreground", - RelativeSizeAxes = Axes.Both, - Alpha = 0.2f - }, - } + Alpha = 0.2f }, new FillFlowContainer { From 80ebd04e856487b3c3bdb5e71be5631ab3979165 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 1 May 2017 20:48:43 +0900 Subject: [PATCH 04/57] Add keys to columns and add key down transformations. --- .../Tests/TestCaseManiaPlayfield.cs | 46 +++++++++++++++---- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 65978a030c..9ee09883aa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -16,6 +16,8 @@ using System.Threading.Tasks; using osu.Framework.Testing; using osu.Game.Graphics; using osu.Framework.Graphics.Primitives; +using osu.Framework.Input; +using OpenTK.Input; namespace osu.Desktop.VisualTests.Tests { @@ -60,11 +62,18 @@ namespace osu.Desktop.VisualTests.Tests new Color4(17, 136, 170, 255) }; + var keys = new Key[] { Key.S, Key.D, Key.F, Key.Space, Key.J, Key.K, Key.L }; + int num_columns = 7; int half_columns = num_columns / 2; for (int i = 0; i < num_columns; i++) - columns.Add(new Column()); + { + columns.Add(new Column + { + Key = keys[i] + }); + } for (int i = 0; i < half_columns; i++) { @@ -122,7 +131,9 @@ namespace osu.Desktop.VisualTests.Tests } } - private Box foreground; + public Key Key; + + private Box background; private Container hitTargetBar; private Container keyIcon; @@ -133,7 +144,7 @@ namespace osu.Desktop.VisualTests.Tests Children = new Drawable[] { - foreground = new Box + background = new Box { Name = "Foreground", RelativeSizeAxes = Axes.Both, @@ -165,11 +176,6 @@ namespace osu.Desktop.VisualTests.Tests ColourInfo = ColourInfo.GradientVertical(Color4.Black, Color4.Black.Opacity(0)), Alpha = 0.5f }, - new Box - { - Name = "Key down foreground", - Alpha = 0f, - }, keyIcon = new Container { Name = "Key icon", @@ -232,7 +238,7 @@ namespace osu.Desktop.VisualTests.Tests private void setAccentColour() { - foreground.Colour = AccentColour; + background.Colour = AccentColour; hitTargetBar.EdgeEffect = new EdgeEffect { @@ -248,5 +254,27 @@ namespace osu.Desktop.VisualTests.Tests Colour = AccentColour.Opacity(0.5f), }; } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Key == Key && !args.Repeat) + { + background.FadeTo(background.Alpha + 0.2f, 50, EasingTypes.OutQuint); + keyIcon.ScaleTo(1.4f, 50, EasingTypes.OutQuint); + } + + return false; + } + + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + { + if (args.Key == Key) + { + background.FadeTo(0.2f, 800, EasingTypes.OutQuart); + keyIcon.ScaleTo(1f, 400, EasingTypes.OutQuart); + } + + return false; + } } } From 116e92a5423ce66a774f7a0b490ea3fd34594269 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 17:00:30 +0900 Subject: [PATCH 05/57] Remove silly platform specific logic. --- osu.Game/Overlays/Options/Sections/AudioSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Options/Sections/AudioSection.cs b/osu.Game/Overlays/Options/Sections/AudioSection.cs index 1412fdea34..3de2bb4901 100644 --- a/osu.Game/Overlays/Options/Sections/AudioSection.cs +++ b/osu.Game/Overlays/Options/Sections/AudioSection.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Options.Sections { Children = new Drawable[] { - new AudioDevicesOptions { Alpha = RuntimeInfo.IsWindows ? 1 : 0 }, + new AudioDevicesOptions(), new VolumeOptions(), new OffsetOptions(), }; From bef15fe6375025990123c1197fe51db8a487be6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 17:45:22 +0900 Subject: [PATCH 06/57] Improve organisation of some options and config code. --- osu.Game/Configuration/OsuConfigManager.cs | 69 ++++++++++--------- .../Options/Sections/Audio/MainMenuOptions.cs | 32 +++++++++ .../Overlays/Options/Sections/AudioSection.cs | 2 +- .../Sections/Graphics/MainMenuOptions.cs | 10 --- osu.Game/osu.Game.csproj | 1 + 5 files changed, 72 insertions(+), 42 deletions(-) create mode 100644 osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 30cd31c113..91652e8ef4 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -12,42 +12,61 @@ namespace osu.Game.Configuration { protected override void InitialiseDefaults() { -#pragma warning disable CS0612 // Type or member is obsolete + // UI/selection defaults + + Set(OsuConfig.Ruleset, 0, 0, int.MaxValue); + Set(OsuConfig.BeatmapDetailTab, BeatmapDetailTab.Details); + + // Online settings Set(OsuConfig.Username, string.Empty); Set(OsuConfig.Token, string.Empty); - Set(OsuConfig.Ruleset, 0, 0, int.MaxValue); + Set(OsuConfig.SavePassword, false).ValueChanged += delegate + { + if (Get(OsuConfig.SavePassword)) Set(OsuConfig.SaveUsername, true); + }; + + Set(OsuConfig.SaveUsername, true).ValueChanged += delegate + { + if (!Get(OsuConfig.SaveUsername)) Set(OsuConfig.SavePassword, false); + }; + + // Audio Set(OsuConfig.AudioDevice, string.Empty); - Set(OsuConfig.SavePassword, false); - Set(OsuConfig.SaveUsername, true); - - Set(OsuConfig.MenuCursorSize, 1.0, 0.5f, 2); - Set(OsuConfig.GameplayCursorSize, 1.0, 0.5f, 2); - Set(OsuConfig.DimLevel, 0.3, 0, 1); - - Set(OsuConfig.MouseDisableButtons, false); - Set(OsuConfig.MouseDisableWheel, false); - - Set(OsuConfig.SnakingInSliders, true); - Set(OsuConfig.SnakingOutSliders, true); - - Set(OsuConfig.MenuParallax, true); Set(OsuConfig.MenuVoice, true); Set(OsuConfig.MenuMusic, true); - Set(OsuConfig.BeatmapDetailTab, BeatmapDetailTab.Details); + Set(OsuConfig.AudioOffset, 0, -500.0, 500.0); + + // Input + + Set(OsuConfig.MenuCursorSize, 1.0, 0.5f, 2); + Set(OsuConfig.GameplayCursorSize, 1.0, 0.5f, 2); + + Set(OsuConfig.MouseDisableButtons, false); + Set(OsuConfig.MouseDisableWheel, false); + + // Graphics + + Set(OsuConfig.MenuParallax, true); + + Set(OsuConfig.SnakingInSliders, true); + Set(OsuConfig.SnakingOutSliders, true); + + // Gameplay + + Set(OsuConfig.DimLevel, 0.3, 0, 1); Set(OsuConfig.ShowInterface, true); Set(OsuConfig.KeyOverlay, false); //todo: implement all settings below this line (remove the Disabled set when doing so). - Set(OsuConfig.AudioOffset, 0, -500.0, 500.0); Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; - Set(OsuConfig.BeatmapDirectory, @"Songs").Disabled = true; // TODO: use thi.Disabled = trues + Set(OsuConfig.BeatmapDirectory, @"Songs").Disabled = true; Set(OsuConfig.AllowPublicInvites, true).Disabled = true; Set(OsuConfig.AutoChatHide, true).Disabled = true; Set(OsuConfig.AutomaticDownload, true).Disabled = true; @@ -166,18 +185,6 @@ namespace osu.Game.Configuration Set(OsuConfig.Ticker, false).Disabled = true; Set(OsuConfig.CompatibilityContext, false).Disabled = true; Set(OsuConfig.CanForceOptimusCompatibility, true).Disabled = true; - Set(OsuConfig.ConfineMouse, Get(OsuConfig.ConfineMouseToFullscreen) ? - ConfineMouseMode.Fullscreen : ConfineMouseMode.Never).Disabled = true; - - GetOriginalBindable(OsuConfig.SavePassword).ValueChanged += delegate - { - if (Get(OsuConfig.SavePassword)) Set(OsuConfig.SaveUsername, true); - }; - GetOriginalBindable(OsuConfig.SaveUsername).ValueChanged += delegate - { - if (!Get(OsuConfig.SaveUsername)) Set(OsuConfig.SavePassword, false); - }; -#pragma warning restore CS0612 // Type or member is obsolete } public OsuConfigManager(Storage storage) : base(storage) diff --git a/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs new file mode 100644 index 0000000000..9de74e1b02 --- /dev/null +++ b/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs @@ -0,0 +1,32 @@ +// 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; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Options.Sections.Audio +{ + public class MainMenuOptions : OptionsSubsection + { + protected override string Header => "Main Menu"; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + Children = new[] + { + new OsuCheckbox + { + LabelText = "Interface voices", + Bindable = config.GetBindable(OsuConfig.MenuVoice) + }, + new OsuCheckbox + { + LabelText = "osu! music theme", + Bindable = config.GetBindable(OsuConfig.MenuMusic) + }, + }; + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Sections/AudioSection.cs b/osu.Game/Overlays/Options/Sections/AudioSection.cs index 3de2bb4901..a9f8265a68 100644 --- a/osu.Game/Overlays/Options/Sections/AudioSection.cs +++ b/osu.Game/Overlays/Options/Sections/AudioSection.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework; using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Overlays.Options.Sections.Audio; @@ -20,6 +19,7 @@ namespace osu.Game.Overlays.Options.Sections new AudioDevicesOptions(), new VolumeOptions(), new OffsetOptions(), + new MainMenuOptions(), }; } } diff --git a/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs index c5000d8547..13683edb32 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs @@ -31,16 +31,6 @@ namespace osu.Game.Overlays.Options.Sections.Graphics LabelText = "Menu tips", Bindable = config.GetBindable(OsuConfig.ShowMenuTips) }, - new OsuCheckbox - { - LabelText = "Interface voices", - Bindable = config.GetBindable(OsuConfig.MenuVoice) - }, - new OsuCheckbox - { - LabelText = "osu! music theme", - Bindable = config.GetBindable(OsuConfig.MenuMusic) - }, }; } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2a1195135a..fb364ccdf5 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -78,6 +78,7 @@ + From 1b0f353af3fc400b11abaa21b7eb1c698c9bbd48 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 17:45:42 +0900 Subject: [PATCH 07/57] Add support for framework-level mouse confining. --- osu.Desktop.VisualTests/VisualTestGame.cs | 2 +- osu.Desktop/OsuGameDesktop.cs | 2 +- osu.Game/Configuration/ConfineMouseMode.cs | 12 ---------- .../Options/Sections/Input/MouseOptions.cs | 22 ++++++++++--------- osu.Game/osu.Game.csproj | 1 - 5 files changed, 14 insertions(+), 25 deletions(-) delete mode 100644 osu.Game/Configuration/ConfineMouseMode.cs diff --git a/osu.Desktop.VisualTests/VisualTestGame.cs b/osu.Desktop.VisualTests/VisualTestGame.cs index e0d168390b..5c5bcd9e21 100644 --- a/osu.Desktop.VisualTests/VisualTestGame.cs +++ b/osu.Desktop.VisualTests/VisualTestGame.cs @@ -29,7 +29,7 @@ namespace osu.Desktop.VisualTests host.DrawThread.InactiveHz = host.DrawThread.ActiveHz; host.InputThread.InactiveHz = host.InputThread.ActiveHz; - host.Window.CursorState = CursorState.Hidden; + host.Window.CursorState |= CursorState.Hidden; } } } diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index c2bb39ac4a..299f64d998 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -43,7 +43,7 @@ namespace osu.Desktop var desktopWindow = host.Window as DesktopGameWindow; if (desktopWindow != null) { - desktopWindow.CursorState = CursorState.Hidden; + desktopWindow.CursorState |= CursorState.Hidden; desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); desktopWindow.Title = Name; diff --git a/osu.Game/Configuration/ConfineMouseMode.cs b/osu.Game/Configuration/ConfineMouseMode.cs deleted file mode 100644 index 527f26cf6b..0000000000 --- a/osu.Game/Configuration/ConfineMouseMode.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Configuration -{ - public enum ConfineMouseMode - { - Never, - Fullscreen, - Always - } -} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs index 4a48c9ec86..27b8159d63 100644 --- a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs @@ -2,7 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Input; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; @@ -13,44 +15,44 @@ namespace osu.Game.Overlays.Options.Sections.Input protected override string Header => "Mouse"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(OsuConfigManager osuConfig, FrameworkConfigManager config) { Children = new Drawable[] { new OptionSlider { LabelText = "Sensitivity", - Bindable = config.GetBindable(OsuConfig.MouseSpeed) + Bindable = osuConfig.GetBindable(OsuConfig.MouseSpeed) }, new OsuCheckbox { LabelText = "Raw input", - Bindable = config.GetBindable(OsuConfig.RawInput) + Bindable = osuConfig.GetBindable(OsuConfig.RawInput) }, new OsuCheckbox { LabelText = "Map absolute raw input to the osu! window", - Bindable = config.GetBindable(OsuConfig.AbsoluteToOsuWindow) + Bindable = osuConfig.GetBindable(OsuConfig.AbsoluteToOsuWindow) }, new OptionEnumDropdown { LabelText = "Confine mouse cursor", - Bindable = config.GetBindable(OsuConfig.ConfineMouse), + Bindable = config.GetBindable(FrameworkConfig.ConfineMouseMode), }, new OsuCheckbox { - LabelText = "Disable mouse wheel in play mode", - Bindable = config.GetBindable(OsuConfig.MouseDisableWheel) + LabelText = "Disable mouse wheel during gameplay", + Bindable = osuConfig.GetBindable(OsuConfig.MouseDisableWheel) }, new OsuCheckbox { - LabelText = "Disable mouse buttons in play mode", - Bindable = config.GetBindable(OsuConfig.MouseDisableButtons) + LabelText = "Disable mouse buttons during gameplay", + Bindable = osuConfig.GetBindable(OsuConfig.MouseDisableButtons) }, new OsuCheckbox { LabelText = "Cursor ripples", - Bindable = config.GetBindable(OsuConfig.CursorRipple) + Bindable = osuConfig.GetBindable(OsuConfig.CursorRipple) }, }; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fb364ccdf5..7b034c2838 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -385,7 +385,6 @@ - From 57c2dd1f49c26ce19cd21a10e5c18b78b835d7d0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 18:35:23 +0900 Subject: [PATCH 08/57] Fix options dropdown labels never being displayed. --- osu.Game/Overlays/Options/OptionDropdown.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Options/OptionDropdown.cs b/osu.Game/Overlays/Options/OptionDropdown.cs index 8642b132df..6837e71c2c 100644 --- a/osu.Game/Overlays/Options/OptionDropdown.cs +++ b/osu.Game/Overlays/Options/OptionDropdown.cs @@ -24,6 +24,7 @@ namespace osu.Game.Overlays.Options set { text.Text = value; + text.Alpha = !string.IsNullOrEmpty(value) ? 1 : 0; } } From d4045ee2c095467dee0fdb247e8da42b136a60e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 18:40:30 +0900 Subject: [PATCH 09/57] We only have one release stream, so let's unlock it. --- osu.Game/Configuration/OsuConfigManager.cs | 7 +++++-- .../Overlays/Options/Sections/General/UpdateOptions.cs | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 91652e8ef4..0e4c987e5c 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -56,13 +56,17 @@ namespace osu.Game.Configuration Set(OsuConfig.SnakingInSliders, true); Set(OsuConfig.SnakingOutSliders, true); - // Gameplay + // Gameplay Set(OsuConfig.DimLevel, 0.3, 0, 1); Set(OsuConfig.ShowInterface, true); Set(OsuConfig.KeyOverlay, false); + // Update + + Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer); + //todo: implement all settings below this line (remove the Disabled set when doing so). Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; @@ -177,7 +181,6 @@ namespace osu.Game.Configuration Set(OsuConfig.AlternativeChatFont, false).Disabled = true; Set(OsuConfig.DisplayStarsMaximum, 10.0, 0.0, 10.0).Disabled = true; Set(OsuConfig.DisplayStarsMinimum, 0.0, 0.0, 10.0).Disabled = true; - Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer).Disabled = true; Set(OsuConfig.UpdateFailCount, 0).Disabled = true; //Set(OsuConfig.TreeSortMode, TreeGroupMode.Show_All).Disabled = true; //Set(OsuConfig.TreeSortMode2, TreeSortMode.Title).Disabled = true; diff --git a/osu.Game/Overlays/Options/Sections/General/UpdateOptions.cs b/osu.Game/Overlays/Options/Sections/General/UpdateOptions.cs index 2b2939e432..1d9a5a7d72 100644 --- a/osu.Game/Overlays/Options/Sections/General/UpdateOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/UpdateOptions.cs @@ -23,7 +23,6 @@ namespace osu.Game.Overlays.Options.Sections.General LabelText = "Release stream", Bindable = config.GetBindable(OsuConfig.ReleaseStream), }, - new OptionLabel { Text = "Your osu! is up to date" }, // TODO: map this to reality new OsuButton { RelativeSizeAxes = Axes.X, From f9de7331285a4c2add1a83f5466a5f6f16b11729 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 18:53:33 +0900 Subject: [PATCH 10/57] Formatting. --- osu.Game/Overlays/Options/OptionSlider.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 42bf4170fa..2d98bc991a 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -12,11 +12,14 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options { - public class OptionSlider : OptionSlider> where T: struct + public class OptionSlider : OptionSlider> + where T : struct { } - public class OptionSlider : FillFlowContainer where T : struct where U : SliderBar, new() + public class OptionSlider : FillFlowContainer + where T : struct + where U : SliderBar, new() { private readonly SliderBar slider; private readonly SpriteText text; From 691742b8282cb81a5938259787a3882133636fe4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 19:40:30 +0900 Subject: [PATCH 11/57] Remove most options which have not yet been implemented. --- osu.Game/Configuration/OsuConfigManager.cs | 256 +----------------- osu.Game/Configuration/ProgressBarType.cs | 18 -- .../Options/Sections/Audio/VolumeOptions.cs | 9 +- .../Options/Sections/EditorSection.cs | 58 ---- .../Sections/Gameplay/GeneralOptions.cs | 30 -- .../Sections/General/LanguageOptions.cs | 9 +- .../Sections/Graphics/DetailOptions.cs | 35 --- .../Sections/Graphics/LayoutOptions.cs | 1 - .../Sections/Graphics/MainMenuOptions.cs | 12 +- .../Sections/Graphics/RendererOptions.cs | 19 +- .../Graphics/SongSelectGraphicsOptions.cs | 27 -- .../Options/Sections/GraphicsSection.cs | 1 - .../Options/Sections/Input/KeyboardOptions.cs | 7 +- .../Options/Sections/Input/MouseOptions.cs | 20 -- .../Sections/Input/OtherInputOptions.cs | 34 --- .../Overlays/Options/Sections/InputSection.cs | 1 - .../Options/Sections/MaintenanceSection.cs | 22 +- .../Sections/Online/InGameChatOptions.cs | 53 ---- .../Sections/Online/IntegrationOptions.cs | 43 --- .../Sections/Online/NotificationsOptions.cs | 53 ---- .../Options/Sections/Online/PrivacyOptions.cs | 33 --- .../Options/Sections/OnlineSection.cs | 5 - .../Overlays/Options/Sections/SkinSection.cs | 42 --- osu.Game/Overlays/OptionsOverlay.cs | 1 - osu.Game/osu.Game.csproj | 8 - 25 files changed, 13 insertions(+), 784 deletions(-) delete mode 100644 osu.Game/Configuration/ProgressBarType.cs delete mode 100644 osu.Game/Overlays/Options/Sections/EditorSection.cs delete mode 100644 osu.Game/Overlays/Options/Sections/Graphics/SongSelectGraphicsOptions.cs delete mode 100644 osu.Game/Overlays/Options/Sections/Input/OtherInputOptions.cs delete mode 100644 osu.Game/Overlays/Options/Sections/Online/InGameChatOptions.cs delete mode 100644 osu.Game/Overlays/Options/Sections/Online/IntegrationOptions.cs delete mode 100644 osu.Game/Overlays/Options/Sections/Online/NotificationsOptions.cs delete mode 100644 osu.Game/Overlays/Options/Sections/Online/PrivacyOptions.cs diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 0e4c987e5c..1fcb33b248 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Configuration; using osu.Framework.Platform; using osu.Game.Screens.Select; @@ -17,6 +16,9 @@ namespace osu.Game.Configuration Set(OsuConfig.Ruleset, 0, 0, int.MaxValue); Set(OsuConfig.BeatmapDetailTab, BeatmapDetailTab.Details); + Set(OsuConfig.DisplayStarsMinimum, 0.0, 0, 10); + Set(OsuConfig.DisplayStarsMaximum, 10.0, 0, 10); + // Online settings Set(OsuConfig.Username, string.Empty); @@ -66,128 +68,6 @@ namespace osu.Game.Configuration // Update Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer); - - //todo: implement all settings below this line (remove the Disabled set when doing so). - - Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; - Set(OsuConfig.BeatmapDirectory, @"Songs").Disabled = true; - Set(OsuConfig.AllowPublicInvites, true).Disabled = true; - Set(OsuConfig.AutoChatHide, true).Disabled = true; - Set(OsuConfig.AutomaticDownload, true).Disabled = true; - Set(OsuConfig.AutomaticDownloadNoVideo, false).Disabled = true; - Set(OsuConfig.BlockNonFriendPM, false).Disabled = true; - Set(OsuConfig.Bloom, false).Disabled = true; - Set(OsuConfig.BloomSoftening, false).Disabled = true; - Set(OsuConfig.BossKeyFirstActivation, true).Disabled = true; - Set(OsuConfig.ChatAudibleHighlight, true).Disabled = true; - Set(OsuConfig.ChatChannels, string.Empty).Disabled = true; - Set(OsuConfig.ChatFilter, false).Disabled = true; - Set(OsuConfig.ChatHighlightName, true).Disabled = true; - Set(OsuConfig.ChatMessageNotification, true).Disabled = true; - Set(OsuConfig.ChatLastChannel, string.Empty).Disabled = true; - Set(OsuConfig.ChatRemoveForeign, false).Disabled = true; - //Set(OsuConfig.ChatSortMode, UserSortMode.Rank).Disabled = true; - Set(OsuConfig.ComboBurst, true).Disabled = true; - Set(OsuConfig.ComboFire, false).Disabled = true; - Set(OsuConfig.ComboFireHeight, 3).Disabled = true; - Set(OsuConfig.ConfirmExit, false).Disabled = true; - Set(OsuConfig.AutoSendNowPlaying, true).Disabled = true; - Set(OsuConfig.AutomaticCursorSizing, false).Disabled = true; - Set(OsuConfig.Display, 1).Disabled = true; - Set(OsuConfig.DisplayCityLocation, false).Disabled = true; - Set(OsuConfig.DistanceSpacingEnabled, true).Disabled = true; - Set(OsuConfig.EditorTip, 0).Disabled = true; - Set(OsuConfig.VideoEditor, true).Disabled = true; - Set(OsuConfig.EditorDefaultSkin, false).Disabled = true; - Set(OsuConfig.EditorSnakingSliders, true).Disabled = true; - Set(OsuConfig.EditorHitAnimations, false).Disabled = true; - Set(OsuConfig.EditorFollowPoints, true).Disabled = true; - Set(OsuConfig.EditorStacking, true).Disabled = true; - Set(OsuConfig.ForceSliderRendering, false).Disabled = true; - Set(OsuConfig.FpsCounter, false).Disabled = true; - Set(OsuConfig.FrameTimeDisplay, false).Disabled = true; - Set(OsuConfig.GuideTips, @"").Disabled = true; - Set(OsuConfig.CursorRipple, false).Disabled = true; - Set(OsuConfig.HighlightWords, string.Empty).Disabled = true; - Set(OsuConfig.HighResolution, false).Disabled = true; - Set(OsuConfig.HitLighting, true).Disabled = true; - Set(OsuConfig.IgnoreBarline, false).Disabled = true; - Set(OsuConfig.IgnoreBeatmapSamples, false).Disabled = true; - Set(OsuConfig.IgnoreBeatmapSkins, false).Disabled = true; - Set(OsuConfig.IgnoreList, string.Empty).Disabled = true; - Set(OsuConfig.AllowNowPlayingHighlights, false).Disabled = true; - Set(OsuConfig.LastVersion, string.Empty).Disabled = true; - Set(OsuConfig.LastVersionPermissionsFailed, string.Empty).Disabled = true; - Set(OsuConfig.LoadSubmittedThread, true).Disabled = true; - Set(OsuConfig.LobbyPlayMode, -1).Disabled = true; - Set(OsuConfig.ShowInterfaceDuringRelax, false).Disabled = true; - Set(OsuConfig.LobbyShowExistingOnly, false).Disabled = true; - Set(OsuConfig.LobbyShowFriendsOnly, false).Disabled = true; - Set(OsuConfig.LobbyShowFull, false).Disabled = true; - Set(OsuConfig.LobbyShowInProgress, true).Disabled = true; - Set(OsuConfig.LobbyShowPassworded, true).Disabled = true; - Set(OsuConfig.LogPrivateMessages, false).Disabled = true; - Set(OsuConfig.LowResolution, false).Disabled = true; - //Set(OsuConfig.ManiaSpeed, SpeedMania.SPEED_DEFAULT, SpeedMania.SPEED_MIN, SpeedMania.SPEED_MAX).Disabled = true; - Set(OsuConfig.UsePerBeatmapManiaSpeed, true).Disabled = true; - Set(OsuConfig.ManiaSpeedBPMScale, true).Disabled = true; - Set(OsuConfig.MenuTip, 0).Disabled = true; - Set(OsuConfig.MouseSpeed, 1, 0.4, 6).Disabled = true; - Set(OsuConfig.ScoreMeterScale, 1, 0.5, 2).Disabled = true; - //Set(OsuConfig.ScoreMeterScale, 1, 0.5, OsuGame.Tournament ? 10 : 2).Disabled = true; - Set(OsuConfig.DistanceSpacing, 0.8, 0.1, 6).Disabled = true; - Set(OsuConfig.EditorBeatDivisor, 1, 1, 16).Disabled = true; - Set(OsuConfig.EditorGridSize, 32, 4, 32).Disabled = true; - Set(OsuConfig.EditorGridSizeDesign, 32, 4, 32).Disabled = true; - Set(OsuConfig.CustomFrameLimit, 240, 240, 999).Disabled = true; - Set(OsuConfig.MsnIntegration, false).Disabled = true; - Set(OsuConfig.MyPcSucks, false).Disabled = true; - Set(OsuConfig.NotifyFriends, true).Disabled = true; - Set(OsuConfig.NotifySubmittedThread, true).Disabled = true; - Set(OsuConfig.PopupDuringGameplay, true).Disabled = true; - Set(OsuConfig.ProgressBarType, ProgressBarType.Pie).Disabled = true; - Set(OsuConfig.RankType, RankingType.Top).Disabled = true; - Set(OsuConfig.RefreshRate, 60).Disabled = true; - Set(OsuConfig.OverrideRefreshRate, Get(OsuConfig.RefreshRate) != 60).Disabled = true; - //Set(OsuConfig.ScaleMode, ScaleMode.WidescreenConservative).Disabled = true; - Set(OsuConfig.ScoreboardVisible, true).Disabled = true; - Set(OsuConfig.ScoreMeter, ScoreMeterType.Error).Disabled = true; - //Set(OsuConfig.ScoreMeter, OsuGame.Tournament ? ScoreMeterType.Colour : ScoreMeterType.Error).Disabled = true; - Set(OsuConfig.ScreenshotId, 0).Disabled = true; - Set(OsuConfig.MenuSnow, false).Disabled = true; - Set(OsuConfig.MenuTriangles, true).Disabled = true; - Set(OsuConfig.SongSelectThumbnails, true).Disabled = true; - Set(OsuConfig.ScreenshotFormat, ScreenshotFormat.Jpg).Disabled = true; - Set(OsuConfig.ShowReplayComments, true).Disabled = true; - Set(OsuConfig.ShowSpectators, true).Disabled = true; - Set(OsuConfig.ShowStoryboard, true).Disabled = true; - //Set(OsuConfig.Skin, SkinManager.DEFAULT_SKIN).Disabled = true; - Set(OsuConfig.SkinSamples, true).Disabled = true; - Set(OsuConfig.SkipTablet, false).Disabled = true; - Set(OsuConfig.Tablet, false).Disabled = true; - Set(OsuConfig.UpdatePending, false).Disabled = true; - Set(OsuConfig.UseSkinCursor, false).Disabled = true; - Set(OsuConfig.UseTaikoSkin, false).Disabled = true; - Set(OsuConfig.Video, true).Disabled = true; - Set(OsuConfig.Wiimote, false).Disabled = true; - Set(OsuConfig.YahooIntegration, false).Disabled = true; - Set(OsuConfig.ForceFrameFlush, false).Disabled = true; - Set(OsuConfig.DetectPerformanceIssues, true).Disabled = true; - Set(OsuConfig.RawInput, false).Disabled = true; - Set(OsuConfig.AbsoluteToOsuWindow, Get(OsuConfig.RawInput)).Disabled = true; - Set(OsuConfig.ShowMenuTips, true).Disabled = true; - Set(OsuConfig.HiddenShowFirstApproach, true).Disabled = true; - Set(OsuConfig.ComboColourSliderBall, true).Disabled = true; - Set(OsuConfig.AlternativeChatFont, false).Disabled = true; - Set(OsuConfig.DisplayStarsMaximum, 10.0, 0.0, 10.0).Disabled = true; - Set(OsuConfig.DisplayStarsMinimum, 0.0, 0.0, 10.0).Disabled = true; - Set(OsuConfig.UpdateFailCount, 0).Disabled = true; - //Set(OsuConfig.TreeSortMode, TreeGroupMode.Show_All).Disabled = true; - //Set(OsuConfig.TreeSortMode2, TreeSortMode.Title).Disabled = true; - Set(OsuConfig.PermanentSongInfo, false).Disabled = true; - Set(OsuConfig.Ticker, false).Disabled = true; - Set(OsuConfig.CompatibilityContext, false).Disabled = true; - Set(OsuConfig.CanForceOptimusCompatibility, true).Disabled = true; } public OsuConfigManager(Storage storage) : base(storage) @@ -197,150 +77,28 @@ namespace osu.Game.Configuration public enum OsuConfig { - // New osu: Ruleset, Token, - // Imported from old osu: - BeatmapDirectory, - AllowPublicInvites, - AutoChatHide, - AutomaticDownload, - AutomaticDownloadNoVideo, - BlockNonFriendPM, - Bloom, - BloomSoftening, - BossKeyFirstActivation, - ChatAudibleHighlight, - ChatChannels, - ChatFilter, - ChatHighlightName, - ChatMessageNotification, - ChatLastChannel, - ChatRemoveForeign, - ChatSortMode, - ComboBurst, - ComboFire, - ComboFireHeight, - ConfirmExit, - AutoSendNowPlaying, MenuCursorSize, GameplayCursorSize, - AutomaticCursorSizing, DimLevel, - Display, - DisplayCityLocation, - DistanceSpacingEnabled, - EditorTip, - VideoEditor, - EditorDefaultSkin, - EditorSnakingSliders, - EditorHitAnimations, - EditorFollowPoints, - EditorStacking, - ForceSliderRendering, - FpsCounter, - FrameTimeDisplay, - GuideTips, - CursorRipple, - HighlightWords, - HighResolution, - HitLighting, - IgnoreBarline, - IgnoreBeatmapSamples, - IgnoreBeatmapSkins, - IgnoreList, KeyOverlay, - Language, - LastPlayMode, - AllowNowPlayingHighlights, - LastVersion, - LastVersionPermissionsFailed, - LoadSubmittedThread, - LobbyPlayMode, ShowInterface, - ShowInterfaceDuringRelax, - LobbyShowExistingOnly, - LobbyShowFriendsOnly, - LobbyShowFull, - LobbyShowInProgress, - LobbyShowPassworded, - LogPrivateMessages, - LowResolution, - ManiaSpeed, - UsePerBeatmapManiaSpeed, - ManiaSpeedBPMScale, - MenuTip, MouseDisableButtons, MouseDisableWheel, - MouseSpeed, AudioOffset, - ScoreMeterScale, - DistanceSpacing, - EditorBeatDivisor, - EditorGridSize, - EditorGridSizeDesign, - CustomFrameLimit, - MsnIntegration, - MyPcSucks, - NotifyFriends, - NotifySubmittedThread, - PopupDuringGameplay, - ProgressBarType, - RankType, - RefreshRate, - OverrideRefreshRate, - ScaleMode, - ScoreboardVisible, - ScoreMeter, - ScreenshotId, - MenuSnow, - MenuTriangles, - SongSelectThumbnails, - ScreenshotFormat, - ShowReplayComments, - ShowSpectators, - ShowStoryboard, - Skin, - SkinSamples, - SkipTablet, - SnakingInSliders, - SnakingOutSliders, - Tablet, - UpdatePending, - UserFilter, - UseSkinCursor, - UseTaikoSkin, - Video, - Wiimote, - YahooIntegration, - ForceFrameFlush, - DetectPerformanceIssues, MenuMusic, MenuVoice, MenuParallax, BeatmapDetailTab, - RawInput, - AbsoluteToOsuWindow, - ConfineMouse, - [Obsolete] - ConfineMouseToFullscreen, - ShowMenuTips, - HiddenShowFirstApproach, - ComboColourSliderBall, - AlternativeChatFont, Username, - DisplayStarsMaximum, - DisplayStarsMinimum, AudioDevice, ReleaseStream, - UpdateFailCount, SavePassword, SaveUsername, - TreeSortMode, - TreeSortMode2, - PermanentSongInfo, - Ticker, - CompatibilityContext, - CanForceOptimusCompatibility, + DisplayStarsMinimum, + DisplayStarsMaximum, + SnakingInSliders, + SnakingOutSliders } } diff --git a/osu.Game/Configuration/ProgressBarType.cs b/osu.Game/Configuration/ProgressBarType.cs deleted file mode 100644 index a768b9f129..0000000000 --- a/osu.Game/Configuration/ProgressBarType.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.ComponentModel; - -namespace osu.Game.Configuration -{ - public enum ProgressBarType - { - Off, - Pie, - [Description("Top Right")] - TopRight, - [Description("Bottom Right")] - BottomRight, - Bottom - } -} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Sections/Audio/VolumeOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/VolumeOptions.cs index d8e8964b17..c3eb04da13 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/VolumeOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/VolumeOptions.cs @@ -4,8 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Graphics; -using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Audio { @@ -14,18 +12,13 @@ namespace osu.Game.Overlays.Options.Sections.Audio protected override string Header => "Volume"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config, AudioManager audio) + private void load(AudioManager audio) { Children = new Drawable[] { new OptionSlider { LabelText = "Master", Bindable = audio.Volume }, new OptionSlider { LabelText = "Effect", Bindable = audio.VolumeSample }, new OptionSlider { LabelText = "Music", Bindable = audio.VolumeTrack }, - new OsuCheckbox - { - LabelText = "Ignore beatmap hitsounds", - Bindable = config.GetBindable(OsuConfig.IgnoreBeatmapSamples) - } }; } } diff --git a/osu.Game/Overlays/Options/Sections/EditorSection.cs b/osu.Game/Overlays/Options/Sections/EditorSection.cs deleted file mode 100644 index 513d89c601..0000000000 --- a/osu.Game/Overlays/Options/Sections/EditorSection.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Configuration; -using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; -using OpenTK; - -namespace osu.Game.Overlays.Options.Sections -{ - public class EditorSection : OptionsSection - { - public override string Header => "Editor"; - public override FontAwesome Icon => FontAwesome.fa_pencil; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - FlowContent.Spacing = new Vector2(0, 5); - Children = new Drawable[] - { - new OsuCheckbox - { - LabelText = "Background video", - Bindable = config.GetBindable(OsuConfig.VideoEditor) - }, - new OsuCheckbox - { - LabelText = "Always use default skin", - Bindable = config.GetBindable(OsuConfig.EditorDefaultSkin) - }, - new OsuCheckbox - { - LabelText = "Snaking sliders", - Bindable = config.GetBindable(OsuConfig.EditorSnakingSliders) - }, - new OsuCheckbox - { - LabelText = "Hit animations", - Bindable = config.GetBindable(OsuConfig.EditorHitAnimations) - }, - new OsuCheckbox - { - LabelText = "Follow points", - Bindable = config.GetBindable(OsuConfig.EditorFollowPoints) - }, - new OsuCheckbox - { - LabelText = "Stacking", - Bindable = config.GetBindable(OsuConfig.EditorStacking) - }, - }; - } - } -} - diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs index 99f9ecbaed..c278b59a51 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs @@ -22,21 +22,6 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay LabelText = "Background dim", Bindable = config.GetBindable(OsuConfig.DimLevel) }, - new OptionEnumDropdown - { - LabelText = "Progress display", - Bindable = config.GetBindable(OsuConfig.ProgressBarType) - }, - new OptionEnumDropdown - { - LabelText = "Score meter type", - Bindable = config.GetBindable(OsuConfig.ScoreMeter) - }, - new OptionSlider - { - LabelText = "Score meter size", - Bindable = config.GetBindable(OsuConfig.ScoreMeterScale) - }, new OsuCheckbox { LabelText = "Show score overlay", @@ -47,21 +32,6 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay LabelText = "Always show key overlay", Bindable = config.GetBindable(OsuConfig.KeyOverlay) }, - new OsuCheckbox - { - LabelText = "Show approach circle on first \"Hidden\" object", - Bindable = config.GetBindable(OsuConfig.HiddenShowFirstApproach) - }, - new OsuCheckbox - { - LabelText = "Scale osu!mania scroll speed with BPM", - Bindable = config.GetBindable(OsuConfig.ManiaSpeedBPMScale) - }, - new OsuCheckbox - { - LabelText = "Remember osu!mania scroll speed per beatmap", - Bindable = config.GetBindable(OsuConfig.UsePerBeatmapManiaSpeed) - }, }; } } diff --git a/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs b/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs index 1387f981d3..7bc1a54455 100644 --- a/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.General @@ -14,21 +13,15 @@ namespace osu.Game.Overlays.Options.Sections.General protected override string Header => "Language"; [BackgroundDependencyLoader] - private void load(OsuConfigManager osuConfig, FrameworkConfigManager frameworkConfig) + private void load(FrameworkConfigManager frameworkConfig) { Children = new Drawable[] { - new OptionLabel { Text = "TODO: Dropdown" }, new OsuCheckbox { LabelText = "Prefer metadata in original language", Bindable = frameworkConfig.GetBindable(FrameworkConfig.ShowUnicode) }, - new OsuCheckbox - { - LabelText = "Use alternative font for chat display", - Bindable = osuConfig.GetBindable(OsuConfig.AlternativeChatFont) - }, }; } } diff --git a/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs index 0af8a4c580..d8906d74ba 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs @@ -27,41 +27,6 @@ namespace osu.Game.Overlays.Options.Sections.Graphics LabelText = "Snaking out sliders", Bindable = config.GetBindable(OsuConfig.SnakingOutSliders) }, - new OsuCheckbox - { - LabelText = "Background video", - Bindable = config.GetBindable(OsuConfig.Video) - }, - new OsuCheckbox - { - LabelText = "Storyboards", - Bindable = config.GetBindable(OsuConfig.ShowStoryboard) - }, - new OsuCheckbox - { - LabelText = "Combo bursts", - Bindable = config.GetBindable(OsuConfig.ComboBurst) - }, - new OsuCheckbox - { - LabelText = "Hit lighting", - Bindable = config.GetBindable(OsuConfig.HitLighting) - }, - new OsuCheckbox - { - LabelText = "Shaders", - Bindable = config.GetBindable(OsuConfig.Bloom) - }, - new OsuCheckbox - { - LabelText = "Softening filter", - Bindable = config.GetBindable(OsuConfig.BloomSoftening) - }, - new OptionEnumDropdown - { - LabelText = "Screenshot", - Bindable = config.GetBindable(OsuConfig.ScreenshotFormat) - } }; } } diff --git a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs index 9f5e3458f3..aed39ca764 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs @@ -24,7 +24,6 @@ namespace osu.Game.Overlays.Options.Sections.Graphics Children = new Drawable[] { - new OptionLabel { Text = "Resolution: TODO dropdown" }, new OptionEnumDropdown { LabelText = "Screen mode", diff --git a/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs index 13683edb32..83a2a382ad 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs @@ -9,28 +9,18 @@ namespace osu.Game.Overlays.Options.Sections.Graphics { public class MainMenuOptions : OptionsSubsection { - protected override string Header => "Main Menu"; + protected override string Header => "User Interface"; [BackgroundDependencyLoader] private void load(OsuConfigManager config) { Children = new[] { - new OsuCheckbox - { - LabelText = "Snow", - Bindable = config.GetBindable(OsuConfig.MenuSnow) - }, new OsuCheckbox { LabelText = "Parallax", Bindable = config.GetBindable(OsuConfig.MenuParallax) }, - new OsuCheckbox - { - LabelText = "Menu tips", - Bindable = config.GetBindable(OsuConfig.ShowMenuTips) - }, }; } } diff --git a/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs index c898879167..fafe91cfc5 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs @@ -4,8 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Graphics { @@ -14,7 +12,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics protected override string Header => "Renderer"; [BackgroundDependencyLoader] - private void load(OsuConfigManager osuConfig, FrameworkConfigManager config) + private void load(FrameworkConfigManager config) { // NOTE: Compatability mode omitted Children = new Drawable[] @@ -25,21 +23,6 @@ namespace osu.Game.Overlays.Options.Sections.Graphics LabelText = "Frame limiter", Bindable = config.GetBindable(FrameworkConfig.FrameSync) }, - new OsuCheckbox - { - LabelText = "Show FPS counter", - Bindable = osuConfig.GetBindable(OsuConfig.FpsCounter), - }, - new OsuCheckbox - { - LabelText = "Reduce dropped frames", - Bindable = osuConfig.GetBindable(OsuConfig.ForceFrameFlush), - }, - new OsuCheckbox - { - LabelText = "Detect performance issues", - Bindable = osuConfig.GetBindable(OsuConfig.DetectPerformanceIssues), - }, }; } } diff --git a/osu.Game/Overlays/Options/Sections/Graphics/SongSelectGraphicsOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/SongSelectGraphicsOptions.cs deleted file mode 100644 index cbaeebcee3..0000000000 --- a/osu.Game/Overlays/Options/Sections/Graphics/SongSelectGraphicsOptions.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; - -namespace osu.Game.Overlays.Options.Sections.Graphics -{ - public class SongSelectGraphicsOptions : OptionsSubsection - { - protected override string Header => "Song Select"; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new[] - { - new OsuCheckbox - { - LabelText = "Show thumbnails", - Bindable = config.GetBindable(OsuConfig.SongSelectThumbnails) - } - }; - } - } -} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Sections/GraphicsSection.cs b/osu.Game/Overlays/Options/Sections/GraphicsSection.cs index b537cf4219..dbbcbde2b9 100644 --- a/osu.Game/Overlays/Options/Sections/GraphicsSection.cs +++ b/osu.Game/Overlays/Options/Sections/GraphicsSection.cs @@ -20,7 +20,6 @@ namespace osu.Game.Overlays.Options.Sections new LayoutOptions(), new DetailOptions(), new MainMenuOptions(), - new SongSelectGraphicsOptions(), }; } } diff --git a/osu.Game/Overlays/Options/Sections/Input/KeyboardOptions.cs b/osu.Game/Overlays/Options/Sections/Input/KeyboardOptions.cs index f3f5445259..b7e8598cff 100644 --- a/osu.Game/Overlays/Options/Sections/Input/KeyboardOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Input/KeyboardOptions.cs @@ -17,13 +17,8 @@ namespace osu.Game.Overlays.Options.Sections.Input new OsuButton { RelativeSizeAxes = Axes.X, - Text = "Change keyboard bindings" + Text = "Key Configuration" }, - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "osu!mania layout" - } }; } } diff --git a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs index 27b8159d63..12789aa0ec 100644 --- a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs @@ -19,21 +19,6 @@ namespace osu.Game.Overlays.Options.Sections.Input { Children = new Drawable[] { - new OptionSlider - { - LabelText = "Sensitivity", - Bindable = osuConfig.GetBindable(OsuConfig.MouseSpeed) - }, - new OsuCheckbox - { - LabelText = "Raw input", - Bindable = osuConfig.GetBindable(OsuConfig.RawInput) - }, - new OsuCheckbox - { - LabelText = "Map absolute raw input to the osu! window", - Bindable = osuConfig.GetBindable(OsuConfig.AbsoluteToOsuWindow) - }, new OptionEnumDropdown { LabelText = "Confine mouse cursor", @@ -49,11 +34,6 @@ namespace osu.Game.Overlays.Options.Sections.Input LabelText = "Disable mouse buttons during gameplay", Bindable = osuConfig.GetBindable(OsuConfig.MouseDisableButtons) }, - new OsuCheckbox - { - LabelText = "Cursor ripples", - Bindable = osuConfig.GetBindable(OsuConfig.CursorRipple) - }, }; } diff --git a/osu.Game/Overlays/Options/Sections/Input/OtherInputOptions.cs b/osu.Game/Overlays/Options/Sections/Input/OtherInputOptions.cs deleted file mode 100644 index 9323f7514b..0000000000 --- a/osu.Game/Overlays/Options/Sections/Input/OtherInputOptions.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; - -namespace osu.Game.Overlays.Options.Sections.Input -{ - public class OtherInputOptions : OptionsSubsection - { - protected override string Header => "Other"; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new Drawable[] - { - new OsuCheckbox - { - LabelText = "OS TabletPC support", - Bindable = config.GetBindable(OsuConfig.Tablet) - }, - new OsuCheckbox - { - LabelText = "Wiimote/TaTaCon Drum Support", - Bindable = config.GetBindable(OsuConfig.Wiimote) - }, - }; - } - } -} - diff --git a/osu.Game/Overlays/Options/Sections/InputSection.cs b/osu.Game/Overlays/Options/Sections/InputSection.cs index 69a3e20f6f..d39d0a0e20 100644 --- a/osu.Game/Overlays/Options/Sections/InputSection.cs +++ b/osu.Game/Overlays/Options/Sections/InputSection.cs @@ -18,7 +18,6 @@ namespace osu.Game.Overlays.Options.Sections { new MouseOptions(), new KeyboardOptions(), - new OtherInputOptions(), }; } } diff --git a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs index 638c1c9a64..a50f1f3ff0 100644 --- a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics; using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; using OpenTK; namespace osu.Game.Overlays.Options.Sections @@ -18,26 +17,7 @@ namespace osu.Game.Overlays.Options.Sections FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "Delete all unranked maps", - }, - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "Repair folder permissions", - }, - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "Mark all maps as played", - }, - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "Run osu! updater", - }, + }; } } diff --git a/osu.Game/Overlays/Options/Sections/Online/InGameChatOptions.cs b/osu.Game/Overlays/Options/Sections/Online/InGameChatOptions.cs deleted file mode 100644 index 9a477f40c7..0000000000 --- a/osu.Game/Overlays/Options/Sections/Online/InGameChatOptions.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; - -namespace osu.Game.Overlays.Options.Sections.Online -{ - public class InGameChatOptions : OptionsSubsection - { - protected override string Header => "Chat"; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new Drawable[] - { - new OsuCheckbox - { - LabelText = "Filter offensive words", - Bindable = config.GetBindable(OsuConfig.ChatFilter) - }, - new OsuCheckbox - { - LabelText = "Filter foreign characters", - Bindable = config.GetBindable(OsuConfig.ChatRemoveForeign) - }, - new OsuCheckbox - { - LabelText = "Log private messages", - Bindable = config.GetBindable(OsuConfig.LogPrivateMessages) - }, - new OsuCheckbox - { - LabelText = "Block private messages from non-friends", - Bindable = config.GetBindable(OsuConfig.BlockNonFriendPM) - }, - new OptionLabel { Text = "Chat ignore list (space-seperated list)" }, - new OptionTextBox { - RelativeSizeAxes = Axes.X, - Bindable = config.GetBindable(OsuConfig.IgnoreList) - }, - new OptionLabel { Text = "Chat highlight words (space-seperated list)" }, - new OptionTextBox { - RelativeSizeAxes = Axes.X, - Bindable = config.GetBindable(OsuConfig.HighlightWords) - }, - }; - } - } -} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Sections/Online/IntegrationOptions.cs b/osu.Game/Overlays/Options/Sections/Online/IntegrationOptions.cs deleted file mode 100644 index d4298ee43c..0000000000 --- a/osu.Game/Overlays/Options/Sections/Online/IntegrationOptions.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; - -namespace osu.Game.Overlays.Options.Sections.Online -{ - public class IntegrationOptions : OptionsSubsection - { - protected override string Header => "Integration"; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new Drawable[] - { - new OsuCheckbox - { - LabelText = "Integrate with Yahoo! status display", - Bindable = config.GetBindable(OsuConfig.YahooIntegration) - }, - new OsuCheckbox - { - LabelText = "Integrate with MSN Live status display", - Bindable = config.GetBindable(OsuConfig.MsnIntegration) - }, - new OsuCheckbox - { - LabelText = "Automatically start osu!direct downloads", - Bindable = config.GetBindable(OsuConfig.AutomaticDownload) - }, - new OsuCheckbox - { - LabelText = "Prefer no-video downloads", - Bindable = config.GetBindable(OsuConfig.AutomaticDownloadNoVideo) - }, - }; - } - } -} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Sections/Online/NotificationsOptions.cs b/osu.Game/Overlays/Options/Sections/Online/NotificationsOptions.cs deleted file mode 100644 index 350121db16..0000000000 --- a/osu.Game/Overlays/Options/Sections/Online/NotificationsOptions.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; - -namespace osu.Game.Overlays.Options.Sections.Online -{ - public class NotificationsOptions : OptionsSubsection - { - protected override string Header => "Notifications"; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new Drawable[] - { - new OsuCheckbox - { - LabelText = "Enable chat ticker", - Bindable = config.GetBindable(OsuConfig.Ticker) - }, - new OsuCheckbox - { - LabelText = "Show a notification popup when someone says your name", - Bindable = config.GetBindable(OsuConfig.ChatHighlightName) - }, - new OsuCheckbox - { - LabelText = "Show chat message notifications", - Bindable = config.GetBindable(OsuConfig.ChatMessageNotification) - }, - new OsuCheckbox - { - LabelText = "Play a sound when someone says your name", - Bindable = config.GetBindable(OsuConfig.ChatAudibleHighlight) - }, - new OsuCheckbox - { - LabelText = "Show notification popups instantly during gameplay", - Bindable = config.GetBindable(OsuConfig.PopupDuringGameplay) - }, - new OsuCheckbox - { - LabelText = "Show notification popups when friends change status", - Bindable = config.GetBindable(OsuConfig.NotifyFriends) - }, - }; - } - } -} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Sections/Online/PrivacyOptions.cs b/osu.Game/Overlays/Options/Sections/Online/PrivacyOptions.cs deleted file mode 100644 index 5c4d4c3502..0000000000 --- a/osu.Game/Overlays/Options/Sections/Online/PrivacyOptions.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; - -namespace osu.Game.Overlays.Options.Sections.Online -{ - public class PrivacyOptions : OptionsSubsection - { - protected override string Header => "Privacy"; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new Drawable[] - { - new OsuCheckbox - { - LabelText = "Share your city location with others", - Bindable = config.GetBindable(OsuConfig.DisplayCityLocation) - }, - new OsuCheckbox - { - LabelText = "Allow multiplayer game invites from all users", - Bindable = config.GetBindable(OsuConfig.AllowPublicInvites) - }, - }; - } - } -} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Sections/OnlineSection.cs b/osu.Game/Overlays/Options/Sections/OnlineSection.cs index a27b00e405..1a65a23121 100644 --- a/osu.Game/Overlays/Options/Sections/OnlineSection.cs +++ b/osu.Game/Overlays/Options/Sections/OnlineSection.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics; using osu.Game.Graphics; -using osu.Game.Overlays.Options.Sections.Online; namespace osu.Game.Overlays.Options.Sections { @@ -16,10 +15,6 @@ namespace osu.Game.Overlays.Options.Sections { Children = new Drawable[] { - new InGameChatOptions(), - new PrivacyOptions(), - new NotificationsOptions(), - new IntegrationOptions(), }; } } diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index 0e533928a8..b3c225d00c 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -21,43 +21,6 @@ namespace osu.Game.Overlays.Options.Sections FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { - new OptionLabel { Text = "TODO: Skin preview textures" }, - new OptionLabel { Text = "Current skin: TODO dropdown" }, - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "Preview gameplay", - }, - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "Open skin folder", - }, - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "Export as .osk", - }, - new OsuCheckbox - { - LabelText = "Ignore all beatmap skins", - Bindable = config.GetBindable(OsuConfig.IgnoreBeatmapSkins) - }, - new OsuCheckbox - { - LabelText = "Use skin's sound samples", - Bindable = config.GetBindable(OsuConfig.SkinSamples) - }, - new OsuCheckbox - { - LabelText = "Use Taiko skin for Taiko mode", - Bindable = config.GetBindable(OsuConfig.UseTaikoSkin) - }, - new OsuCheckbox - { - LabelText = "Always use skin cursor", - Bindable = config.GetBindable(OsuConfig.UseSkinCursor) - }, new OptionSlider { LabelText = "Menu cursor size", @@ -68,11 +31,6 @@ namespace osu.Game.Overlays.Options.Sections LabelText = "Gameplay cursor size", Bindable = config.GetBindable(OsuConfig.GameplayCursorSize) }, - new OsuCheckbox - { - LabelText = "Automatic cursor size", - Bindable = config.GetBindable(OsuConfig.AutomaticCursorSizing) - }, }; } diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 0c66cb5881..dcbce80c69 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -51,7 +51,6 @@ namespace osu.Game.Overlays new AudioSection(), new SkinSection(), new InputSection(), - new EditorSection(), new OnlineSection(), new MaintenanceSection(), new DebugSection(), diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7b034c2838..4385e737fd 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -356,7 +356,6 @@ - @@ -367,19 +366,12 @@ - - - - - - - From a036b059e8c31e3fd3d5d7984189f3766691e6cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 21:40:06 +0900 Subject: [PATCH 12/57] Use provided parameters to avoid a second lookup. --- osu.Game/Configuration/OsuConfigManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 1fcb33b248..2c9574905f 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -24,14 +24,14 @@ namespace osu.Game.Configuration Set(OsuConfig.Username, string.Empty); Set(OsuConfig.Token, string.Empty); - Set(OsuConfig.SavePassword, false).ValueChanged += delegate + Set(OsuConfig.SavePassword, false).ValueChanged += val => { - if (Get(OsuConfig.SavePassword)) Set(OsuConfig.SaveUsername, true); + if (val) Set(OsuConfig.SaveUsername, true); }; - Set(OsuConfig.SaveUsername, true).ValueChanged += delegate + Set(OsuConfig.SaveUsername, true).ValueChanged += val => { - if (!Get(OsuConfig.SaveUsername)) Set(OsuConfig.SavePassword, false); + if (!val) Set(OsuConfig.SavePassword, false); }; // Audio From 00a8dbbacfa3d1bd1a40379e388c8f5e2f0af2ec Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 2 May 2017 21:36:55 +0300 Subject: [PATCH 13/57] Added ModType for each mode --- osu.Game.Rulesets.Mania/Mods/ManiaMod.cs | 1 + osu.Game/Rulesets/Mods/Mod.cs | 5 +++++ osu.Game/Rulesets/Mods/ModDoubleTime.cs | 1 + osu.Game/Rulesets/Mods/ModEasy.cs | 1 + osu.Game/Rulesets/Mods/ModFlashlight.cs | 1 + osu.Game/Rulesets/Mods/ModHalfTime.cs | 1 + osu.Game/Rulesets/Mods/ModHardRock.cs | 1 + osu.Game/Rulesets/Mods/ModHidden.cs | 1 + osu.Game/Rulesets/Mods/ModNoFail.cs | 1 + osu.Game/Rulesets/Mods/ModSuddenDeath.cs | 1 + 10 files changed, 14 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaMod.cs b/osu.Game.Rulesets.Mania/Mods/ManiaMod.cs index 68458caeac..b402d3a010 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaMod.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaMod.cs @@ -64,6 +64,7 @@ namespace osu.Game.Rulesets.Mania.Mods { public override string Name => "FadeIn"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden; + public override ModType Type => ModType.DifficultyIncrease; public override double ScoreMultiplier => 1; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) }; diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index a2846c1d2f..c00847b7d8 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -21,6 +21,11 @@ namespace osu.Game.Rulesets.Mods /// public virtual FontAwesome Icon => FontAwesome.fa_question; + /// + /// The type of this mod. + /// + public virtual ModType Type => ModType.Special; + /// /// The user readable description of this mod. /// diff --git a/osu.Game/Rulesets/Mods/ModDoubleTime.cs b/osu.Game/Rulesets/Mods/ModDoubleTime.cs index 377a4c2180..1aab56a9fc 100644 --- a/osu.Game/Rulesets/Mods/ModDoubleTime.cs +++ b/osu.Game/Rulesets/Mods/ModDoubleTime.cs @@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Mods { public override string Name => "Double Time"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime; + public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Zoooooooooom"; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) }; diff --git a/osu.Game/Rulesets/Mods/ModEasy.cs b/osu.Game/Rulesets/Mods/ModEasy.cs index bef3f04af3..8eef9c70d6 100644 --- a/osu.Game/Rulesets/Mods/ModEasy.cs +++ b/osu.Game/Rulesets/Mods/ModEasy.cs @@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods { public override string Name => "Easy"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy; + public override ModType Type => ModType.DifficultyReduction; public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."; public override double ScoreMultiplier => 0.5; public override bool Ranked => true; diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index 63c534dc7d..b5ad859172 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Mods { public override string Name => "Flashlight"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight; + public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Restricted view area."; public override bool Ranked => true; } diff --git a/osu.Game/Rulesets/Mods/ModHalfTime.cs b/osu.Game/Rulesets/Mods/ModHalfTime.cs index 235fc7ad76..207a6ec2a1 100644 --- a/osu.Game/Rulesets/Mods/ModHalfTime.cs +++ b/osu.Game/Rulesets/Mods/ModHalfTime.cs @@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Mods { public override string Name => "Half Time"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime; + public override ModType Type => ModType.DifficultyReduction; public override string Description => "Less zoom"; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) }; diff --git a/osu.Game/Rulesets/Mods/ModHardRock.cs b/osu.Game/Rulesets/Mods/ModHardRock.cs index b729b5ae15..2516c02526 100644 --- a/osu.Game/Rulesets/Mods/ModHardRock.cs +++ b/osu.Game/Rulesets/Mods/ModHardRock.cs @@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods { public override string Name => "Hard Rock"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock; + public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Everything just got a bit harder..."; public override Type[] IncompatibleMods => new[] { typeof(ModEasy) }; } diff --git a/osu.Game/Rulesets/Mods/ModHidden.cs b/osu.Game/Rulesets/Mods/ModHidden.cs index 12c788ce54..89b9b3b62d 100644 --- a/osu.Game/Rulesets/Mods/ModHidden.cs +++ b/osu.Game/Rulesets/Mods/ModHidden.cs @@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Mods { public override string Name => "Hidden"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden; + public override ModType Type => ModType.DifficultyIncrease; public override bool Ranked => true; } } \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModNoFail.cs b/osu.Game/Rulesets/Mods/ModNoFail.cs index 0c8726bbc1..613e1e1d4d 100644 --- a/osu.Game/Rulesets/Mods/ModNoFail.cs +++ b/osu.Game/Rulesets/Mods/ModNoFail.cs @@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods { public override string Name => "NoFail"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail; + public override ModType Type => ModType.DifficultyReduction; public override string Description => "You can't fail, no matter what."; public override double ScoreMultiplier => 0.5; public override bool Ranked => true; diff --git a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs index a7dcbbc9ed..2bf0278046 100644 --- a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs +++ b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs @@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods { public override string Name => "Sudden Death"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath; + public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Miss a note and fail."; public override double ScoreMultiplier => 1; public override bool Ranked => true; From 7e1efcc20bcb2b55eb632809158d8f6e36944111 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 2 May 2017 22:34:07 +0300 Subject: [PATCH 14/57] Added ModsContainer --- osu.Game/Rulesets/UI/HudOverlay.cs | 3 + osu.Game/Rulesets/UI/StandardHudOverlay.cs | 10 ++- osu.Game/Screens/Play/ModsContainer.cs | 88 ++++++++++++++++++++++ osu.Game/Screens/Play/Player.cs | 4 + osu.Game/osu.Game.csproj | 1 + 5 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Screens/Play/ModsContainer.cs diff --git a/osu.Game/Rulesets/UI/HudOverlay.cs b/osu.Game/Rulesets/UI/HudOverlay.cs index 47cf157732..9bd900da4b 100644 --- a/osu.Game/Rulesets/UI/HudOverlay.cs +++ b/osu.Game/Rulesets/UI/HudOverlay.cs @@ -27,6 +27,7 @@ namespace osu.Game.Rulesets.UI public readonly RollingCounter AccuracyCounter; public readonly HealthDisplay HealthDisplay; public readonly SongProgress Progress; + public readonly ModsContainer ModsContainer; private Bindable showKeyCounter; private Bindable showHud; @@ -39,6 +40,7 @@ namespace osu.Game.Rulesets.UI protected abstract ScoreCounter CreateScoreCounter(); protected abstract HealthDisplay CreateHealthDisplay(); protected abstract SongProgress CreateProgress(); + protected abstract ModsContainer CreateModsContainer(); protected HudOverlay() { @@ -56,6 +58,7 @@ namespace osu.Game.Rulesets.UI AccuracyCounter = CreateAccuracyCounter(), HealthDisplay = CreateHealthDisplay(), Progress = CreateProgress(), + ModsContainer = CreateModsContainer(), } }); } diff --git a/osu.Game/Rulesets/UI/StandardHudOverlay.cs b/osu.Game/Rulesets/UI/StandardHudOverlay.cs index c68e29f98a..a51a1ba434 100644 --- a/osu.Game/Rulesets/UI/StandardHudOverlay.cs +++ b/osu.Game/Rulesets/UI/StandardHudOverlay.cs @@ -64,7 +64,15 @@ namespace osu.Game.Rulesets.UI RelativeSizeAxes = Axes.X, }; - [BackgroundDependencyLoader] + protected override ModsContainer CreateModsContainer() => new ModsContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Position = new Vector2(0, 30), + }; + + [BackgroundDependencyLoader] private void load(OsuColour colours) { ComboCounter.AccentColour = colours.BlueLighter; diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs new file mode 100644 index 0000000000..6ee7292dae --- /dev/null +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -0,0 +1,88 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.UI; +using osu.Framework.Graphics; +using OpenTK.Graphics; +using osu.Game.Graphics; +using osu.Framework.Allocation; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Screens.Play +{ + public class ModsContainer : Container + { + private readonly FillFlowContainer iconsContainer; + + private bool showMods; + public bool ShowMods + { + get { return showMods; } + set + { + if (showMods == value) return; + + showMods = value; + } + } + + public ModsContainer() + { + Children = new Drawable[] + { + iconsContainer = new FillFlowContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + }, + new OsuSpriteText + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + Text = @"/UNRANKED/", + Font = @"Venera", + TextSize = 15, + } + }; + } + + public void Add(Mod mod) + { + iconsContainer.Add(new ModIcon + { + AutoSizeAxes = Axes.Both, + Icon = mod.Icon, + Colour = selectColour(mod), + IconSize = 60, + }); + } + + private Color4 selectColour(Mod mod) + { + switch (mod.Type) + { + case ModType.DifficultyIncrease: + return OsuColour.FromHex(@"ffcc22"); + case ModType.DifficultyReduction: + return OsuColour.FromHex(@"88b300"); + case ModType.Special: + return OsuColour.FromHex(@"66ccff"); + + default: return Color4.White; + } + } + + [BackgroundDependencyLoader] + private void load() + { + if (ShowMods) + Show(); + else + Hide(); + } + } +} diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 37b4cf5b45..948594235f 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -169,6 +169,10 @@ namespace osu.Game.Screens.Play hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos); + hudOverlay.ModsContainer.ShowMods = HitRenderer.HasReplayLoaded; + foreach (var mod in Beatmap.Mods.Value) + hudOverlay.ModsContainer.Add(mod); + //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) HitRenderer.OnAllJudged += onCompletion; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2a1195135a..d637660ea9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -227,6 +227,7 @@ + From 37c31339819849a870bd9e449aa8db021d049357 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 2 May 2017 22:46:18 +0300 Subject: [PATCH 15/57] Fixes --- osu.Game/Rulesets/UI/StandardHudOverlay.cs | 2 +- osu.Game/Screens/Play/ModsContainer.cs | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game/Rulesets/UI/StandardHudOverlay.cs b/osu.Game/Rulesets/UI/StandardHudOverlay.cs index a51a1ba434..8d4496ad93 100644 --- a/osu.Game/Rulesets/UI/StandardHudOverlay.cs +++ b/osu.Game/Rulesets/UI/StandardHudOverlay.cs @@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.UI Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, - Position = new Vector2(0, 30), + Position = new Vector2(0, 25), }; [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 6ee7292dae..514d174212 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -20,12 +20,7 @@ namespace osu.Game.Screens.Play public bool ShowMods { get { return showMods; } - set - { - if (showMods == value) return; - - showMods = value; - } + set { showMods = value; } } public ModsContainer() @@ -34,8 +29,8 @@ namespace osu.Game.Screens.Play { iconsContainer = new FillFlowContainer { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, }, From a955f9cbfd894bd464e28267cd69ab05e4c53d66 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 2 May 2017 22:59:36 +0300 Subject: [PATCH 16/57] Simplify hiding logic --- osu.Game/Screens/Play/ModsContainer.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 514d174212..3ae3e0b119 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -16,11 +16,9 @@ namespace osu.Game.Screens.Play { private readonly FillFlowContainer iconsContainer; - private bool showMods; public bool ShowMods { - get { return showMods; } - set { showMods = value; } + set { if (!value) Hide(); } } public ModsContainer() @@ -70,14 +68,5 @@ namespace osu.Game.Screens.Play default: return Color4.White; } } - - [BackgroundDependencyLoader] - private void load() - { - if (ShowMods) - Show(); - else - Hide(); - } } } From 2e30a69b67777a731d8f3d94302f8ce7dc99de38 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 2 May 2017 23:04:36 +0300 Subject: [PATCH 17/57] removed using --- osu.Game/Screens/Play/ModsContainer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 3ae3e0b119..8569bc6db6 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -7,7 +7,6 @@ using osu.Game.Rulesets.UI; using osu.Framework.Graphics; using OpenTK.Graphics; using osu.Game.Graphics; -using osu.Framework.Allocation; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Play From 60c2e2a90af53a2315cab5cc8a6603a03df7f8fd Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 3 May 2017 11:22:09 +0900 Subject: [PATCH 18/57] Fix taiko auto replay generation not working. --- osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs | 2 +- .../{TaikoAutoReplay.cs => TaikoAutoGenerator.cs} | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) rename osu.Game.Rulesets.Taiko/Replays/{TaikoAutoReplay.cs => TaikoAutoGenerator.cs} (90%) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs index 44430fe6bc..8b7a099b9a 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Taiko.Mods protected override Score CreateReplayScore(Beatmap beatmap) => new Score { User = new User { Username = "mekkadosu!" }, - Replay = new TaikoAutoReplay(beatmap).Generate(), + Replay = new TaikoAutoGenerator(beatmap).Generate(), }; } } diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs similarity index 90% rename from osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs rename to osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs index 0af8e2822b..eec614426f 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs @@ -7,16 +7,24 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Replays; +using osu.Game.Users; namespace osu.Game.Rulesets.Taiko.Replays { - public class TaikoAutoReplay : AutoGenerator + public class TaikoAutoGenerator : AutoGenerator { private const double swell_hit_speed = 50; - public TaikoAutoReplay(Beatmap beatmap) + public TaikoAutoGenerator(Beatmap beatmap) : base(beatmap) { + Replay = new Replay + { + User = new User + { + Username = @"Autoplay", + } + }; } protected Replay Replay; From 4d27e0abb6140107f5a6710db082a37011d235f2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 3 May 2017 11:25:54 +0900 Subject: [PATCH 19/57] Oops i didn't save the solution. --- osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index f890e32f90..983dc72d9e 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -79,7 +79,7 @@ - + From b4052a099f3d27bab3597a2e4ea068ae3f5c26fe Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 3 May 2017 12:30:03 +0900 Subject: [PATCH 20/57] Create ManiaPlayfield, support up to 9 columns, improve testcase automation. --- .../Tests/TestCaseManiaPlayfield.cs | 147 ++++++++++++------ 1 file changed, 100 insertions(+), 47 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 9ee09883aa..89d4d5cc22 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -18,6 +18,9 @@ using osu.Game.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Input; using OpenTK.Input; +using osu.Game.Rulesets.UI; +using osu.Framework.Allocation; +using osu.Framework.Extensions.IEnumerableExtensions; namespace osu.Desktop.VisualTests.Tests { @@ -25,69 +28,119 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Mania playfield"; - private FlowContainer columns; + protected override double TimePerAction => 200; public override void Reset() { base.Reset(); - Add(new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black - }, - columns = new FillFlowContainer - { - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Direction = FillDirection.Horizontal, - Padding = new MarginPadding { Left = 1, Right = 1 }, - Spacing = new Vector2(1, 0) - } - } - }); + int max_columns = 9; - var colours = new Color4[] + for (int i = 1; i <= max_columns; i++) { - new Color4(187, 17, 119, 255), - new Color4(96, 204, 0, 255), - new Color4(17, 136, 170, 255) + int tempI = i; + + AddStep($@"{i} column" + (i > 1 ? "s" : ""), () => + { + Clear(); + Add(new ManiaPlayfield(tempI) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + }); + + AddStep($"Trigger keys down", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyDown)); + AddStep($"Trigger keys up", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyUp)); + } + } + + private void triggerKeyDown(Column column) + { + column.TriggerKeyDown(new InputState(), new KeyDownEventArgs + { + Key = column.Key, + Repeat = false + }); + } + + private void triggerKeyUp(Column column) + { + column.TriggerKeyUp(new InputState(), new KeyUpEventArgs + { + Key = column.Key + }); + } + } + + public class ManiaPlayfield : Container + { + public readonly FlowContainer Columns; + + public ManiaPlayfield(int columnCount) + { + if (columnCount > 9) + throw new ArgumentException($@"{columnCount} columns is not supported."); + if (columnCount <= 0) + throw new ArgumentException($@"Can't have zero or fewer columns."); + + RelativeSizeAxes = Axes.Y; + AutoSizeAxes = Axes.X; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black + }, + Columns = new FillFlowContainer + { + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Padding = new MarginPadding { Left = 1, Right = 1 }, + Spacing = new Vector2(1, 0) + } }; - var keys = new Key[] { Key.S, Key.D, Key.F, Key.Space, Key.J, Key.K, Key.L }; + for (int i = 0; i < columnCount; i++) + Columns.Add(new Column()); + } - int num_columns = 7; - int half_columns = num_columns / 2; - - for (int i = 0; i < num_columns; i++) + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + var columnColours = new Color4[] { - columns.Add(new Column - { - Key = keys[i] - }); + colours.RedDark, + colours.GreenDark, + colours.BlueDark // Special column + }; + + int columnCount = Columns.Children.Count(); + int halfColumns = columnCount / 2; + + var keys = new Key[] { Key.A, Key.S, Key.D, Key.F, Key.Space, Key.J, Key.K, Key.L, Key.Semicolon }; + + for (int i = 0; i < halfColumns; i++) + { + Column leftColumn = Columns.Children.ElementAt(i); + Column rightColumn = Columns.Children.ElementAt(columnCount - 1 - i); + + Color4 accent = columnColours[i % 2]; + leftColumn.AccentColour = rightColumn.AccentColour = accent; + leftColumn.Key = keys[keys.Length / 2 - halfColumns + i]; + rightColumn.Key = keys[keys.Length / 2 + halfColumns - i]; } - for (int i = 0; i < half_columns; i++) - { - Color4 accent = colours[i % 2]; - columns.Children.ElementAt(i).AccentColour = accent; - columns.Children.ElementAt(num_columns - 1 - i).AccentColour = accent; - } - - bool hasSpecial = half_columns * 2 < num_columns; + bool hasSpecial = halfColumns * 2 < columnCount; if (hasSpecial) { - Column specialColumn = columns.Children.ElementAt(half_columns); + Column specialColumn = Columns.Children.ElementAt(halfColumns); specialColumn.IsSpecialColumn = true; - specialColumn.AccentColour = colours[2]; + specialColumn.AccentColour = columnColours[2]; + specialColumn.Key = keys[keys.Length / 2]; } } } From 71acf1c57dd0439796ebdb22bd983c7788f26190 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 3 May 2017 12:37:47 +0900 Subject: [PATCH 21/57] Move classes out of test case. --- .../Tests/TestCaseManiaPlayfield.cs | 259 +----------------- osu.Game.Rulesets.Mania/UI/Column.cs | 204 ++++++++++++++ osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 89 +++++- .../osu.Game.Rulesets.Mania.csproj | 1 + 4 files changed, 282 insertions(+), 271 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/UI/Column.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 89d4d5cc22..62abc865a1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -21,6 +21,7 @@ using OpenTK.Input; using osu.Game.Rulesets.UI; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Game.Rulesets.Mania.UI; namespace osu.Desktop.VisualTests.Tests { @@ -72,262 +73,4 @@ namespace osu.Desktop.VisualTests.Tests }); } } - - public class ManiaPlayfield : Container - { - public readonly FlowContainer Columns; - - public ManiaPlayfield(int columnCount) - { - if (columnCount > 9) - throw new ArgumentException($@"{columnCount} columns is not supported."); - if (columnCount <= 0) - throw new ArgumentException($@"Can't have zero or fewer columns."); - - RelativeSizeAxes = Axes.Y; - AutoSizeAxes = Axes.X; - - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black - }, - Columns = new FillFlowContainer - { - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Direction = FillDirection.Horizontal, - Padding = new MarginPadding { Left = 1, Right = 1 }, - Spacing = new Vector2(1, 0) - } - }; - - for (int i = 0; i < columnCount; i++) - Columns.Add(new Column()); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - var columnColours = new Color4[] - { - colours.RedDark, - colours.GreenDark, - colours.BlueDark // Special column - }; - - int columnCount = Columns.Children.Count(); - int halfColumns = columnCount / 2; - - var keys = new Key[] { Key.A, Key.S, Key.D, Key.F, Key.Space, Key.J, Key.K, Key.L, Key.Semicolon }; - - for (int i = 0; i < halfColumns; i++) - { - Column leftColumn = Columns.Children.ElementAt(i); - Column rightColumn = Columns.Children.ElementAt(columnCount - 1 - i); - - Color4 accent = columnColours[i % 2]; - leftColumn.AccentColour = rightColumn.AccentColour = accent; - leftColumn.Key = keys[keys.Length / 2 - halfColumns + i]; - rightColumn.Key = keys[keys.Length / 2 + halfColumns - i]; - } - - bool hasSpecial = halfColumns * 2 < columnCount; - if (hasSpecial) - { - Column specialColumn = Columns.Children.ElementAt(halfColumns); - specialColumn.IsSpecialColumn = true; - specialColumn.AccentColour = columnColours[2]; - specialColumn.Key = keys[keys.Length / 2]; - } - } - } - - public class Column : Container, IHasAccentColour - { - private const float key_size = 50; - - private const float key_icon_size = 10; - private const float key_icon_corner_radius = 3; - private const float key_icon_border_radius = 2; - - private const float hit_target_height = 10; - private const float hit_target_bar_height = 2; - - private const float column_width = 45; - private const float special_column_width = 70; - - private Color4 accentColour; - public Color4 AccentColour - { - get { return accentColour; } - set - { - if (accentColour == value) - return; - accentColour = value; - - setAccentColour(); - } - } - - private bool isSpecialColumn; - public bool IsSpecialColumn - { - get { return isSpecialColumn; } - set - { - isSpecialColumn = value; - Width = isSpecialColumn ? special_column_width : column_width; - } - } - - public Key Key; - - private Box background; - private Container hitTargetBar; - private Container keyIcon; - - public Column() - { - RelativeSizeAxes = Axes.Y; - Width = column_width; - - Children = new Drawable[] - { - background = new Box - { - Name = "Foreground", - RelativeSizeAxes = Axes.Both, - Alpha = 0.2f - }, - new FillFlowContainer - { - Name = "Key + hit target", - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new[] - { - new Container - { - Name = "Key", - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.X, - Height = key_size, - Children = new Drawable[] - { - new Box - { - Name = "Key gradient", - RelativeSizeAxes = Axes.Both, - ColourInfo = ColourInfo.GradientVertical(Color4.Black, Color4.Black.Opacity(0)), - Alpha = 0.5f - }, - keyIcon = new Container - { - Name = "Key icon", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(key_icon_size), - Masking = true, - CornerRadius = key_icon_corner_radius, - BorderThickness = 2, - BorderColour = Color4.White, // Not true - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } - } - } - } - }, - new Container - { - Name = "Hit target", - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.X, - Height = hit_target_height, - Children = new Drawable[] - { - new Box - { - Name = "Background", - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black - }, - hitTargetBar = new Container - { - Name = "Bar", - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.X, - Height = hit_target_bar_height, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both - } - } - } - } - } - } - } - }; - } - - private void setAccentColour() - { - background.Colour = AccentColour; - - hitTargetBar.EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Glow, - Radius = 5, - Colour = AccentColour.Opacity(0.5f), - }; - - keyIcon.EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Glow, - Radius = 5, - Colour = AccentColour.Opacity(0.5f), - }; - } - - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (args.Key == Key && !args.Repeat) - { - background.FadeTo(background.Alpha + 0.2f, 50, EasingTypes.OutQuint); - keyIcon.ScaleTo(1.4f, 50, EasingTypes.OutQuint); - } - - return false; - } - - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) - { - if (args.Key == Key) - { - background.FadeTo(0.2f, 800, EasingTypes.OutQuart); - keyIcon.ScaleTo(1f, 400, EasingTypes.OutQuart); - } - - return false; - } - } } diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs new file mode 100644 index 0000000000..584dfdd09c --- /dev/null +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -0,0 +1,204 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + + +using OpenTK; +using OpenTK.Graphics; +using OpenTK.Input; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Colour; +using osu.Framework.Input; +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mania.UI +{ + public class Column : Container, IHasAccentColour + { + private const float key_size = 50; + + private const float key_icon_size = 10; + private const float key_icon_corner_radius = 3; + private const float key_icon_border_radius = 2; + + private const float hit_target_height = 10; + private const float hit_target_bar_height = 2; + + private const float column_width = 45; + private const float special_column_width = 70; + + private Color4 accentColour; + public Color4 AccentColour + { + get { return accentColour; } + set + { + if (accentColour == value) + return; + accentColour = value; + + setAccentColour(); + } + } + + private bool isSpecialColumn; + public bool IsSpecialColumn + { + get { return isSpecialColumn; } + set + { + isSpecialColumn = value; + Width = isSpecialColumn ? special_column_width : column_width; + } + } + + public Key Key; + + private Box background; + private Container hitTargetBar; + private Container keyIcon; + + public Column() + { + RelativeSizeAxes = Axes.Y; + Width = column_width; + + Children = new Drawable[] + { + background = new Box + { + Name = "Foreground", + RelativeSizeAxes = Axes.Both, + Alpha = 0.2f + }, + new FillFlowContainer + { + Name = "Key + hit target", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new[] + { + new Container + { + Name = "Key", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = key_size, + Children = new Drawable[] + { + new Box + { + Name = "Key gradient", + RelativeSizeAxes = Axes.Both, + ColourInfo = ColourInfo.GradientVertical(Color4.Black, Color4.Black.Opacity(0)), + Alpha = 0.5f + }, + keyIcon = new Container + { + Name = "Key icon", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(key_icon_size), + Masking = true, + CornerRadius = key_icon_corner_radius, + BorderThickness = 2, + BorderColour = Color4.White, // Not true + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + } + } + }, + new Container + { + Name = "Hit target", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = hit_target_height, + Children = new Drawable[] + { + new Box + { + Name = "Background", + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black + }, + hitTargetBar = new Container + { + Name = "Bar", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = hit_target_bar_height, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both + } + } + } + } + } + } + } + }; + } + + private void setAccentColour() + { + background.Colour = AccentColour; + + hitTargetBar.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Radius = 5, + Colour = AccentColour.Opacity(0.5f), + }; + + keyIcon.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Radius = 5, + Colour = AccentColour.Opacity(0.5f), + }; + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Key == Key && !args.Repeat) + { + background.FadeTo(background.Alpha + 0.2f, 50, EasingTypes.OutQuint); + keyIcon.ScaleTo(1.4f, 50, EasingTypes.OutQuint); + } + + return false; + } + + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + { + if (args.Key == Key) + { + background.FadeTo(0.2f, 800, EasingTypes.OutQuart); + keyIcon.ScaleTo(1f, 400, EasingTypes.OutQuart); + } + + return false; + } + } + +} diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 5eea3d70c0..0b7b1df06d 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -8,29 +8,92 @@ using osu.Game.Rulesets.UI; using OpenTK; using OpenTK.Graphics; using osu.Game.Rulesets.Mania.Judgements; +using osu.Framework.Graphics.Containers; +using System; +using osu.Framework.Graphics.Primitives; +using osu.Game.Graphics; +using osu.Framework.Allocation; +using OpenTK.Input; +using System.Linq; namespace osu.Game.Rulesets.Mania.UI { public class ManiaPlayfield : Playfield { + public readonly FlowContainer Columns; + public ManiaPlayfield(int columns) { - Size = new Vector2(0.8f, 1f); - Anchor = Anchor.BottomCentre; - Origin = Anchor.BottomCentre; + if (columns > 9) + throw new ArgumentException($@"{columns} columns is not supported."); + if (columns <= 0) + throw new ArgumentException($@"Can't have zero or fewer columns."); - Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f }); + Children = new Drawable[] + { + new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black + }, + Columns = new FillFlowContainer + { + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Padding = new MarginPadding { Left = 1, Right = 1 }, + Spacing = new Vector2(1, 0) + } + } + } + }; for (int i = 0; i < columns; i++) - Add(new Box - { - RelativeSizeAxes = Axes.Y, - Size = new Vector2(2, 1), - RelativePositionAxes = Axes.Both, - Position = new Vector2((float)i / columns, 0), - Alpha = 0.5f, - Colour = Color4.Black - }); + Columns.Add(new Column()); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + var columnColours = new Color4[] + { + colours.RedDark, + colours.GreenDark, + colours.BlueDark // Special column + }; + + int columnCount = Columns.Children.Count(); + int halfColumns = columnCount / 2; + + var keys = new Key[] { Key.A, Key.S, Key.D, Key.F, Key.Space, Key.J, Key.K, Key.L, Key.Semicolon }; + + for (int i = 0; i < halfColumns; i++) + { + Column leftColumn = Columns.Children.ElementAt(i); + Column rightColumn = Columns.Children.ElementAt(columnCount - 1 - i); + + Color4 accent = columnColours[i % 2]; + leftColumn.AccentColour = rightColumn.AccentColour = accent; + leftColumn.Key = keys[keys.Length / 2 - halfColumns + i]; + rightColumn.Key = keys[keys.Length / 2 + halfColumns - i]; + } + + bool hasSpecial = halfColumns * 2 < columnCount; + if (hasSpecial) + { + Column specialColumn = Columns.Children.ElementAt(halfColumns); + specialColumn.IsSpecialColumn = true; + specialColumn.AccentColour = columnColours[2]; + specialColumn.Key = keys[keys.Length / 2]; + } } } } \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index facffa757c..18ea1de13a 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -56,6 +56,7 @@ + From 7de36b7aa27db5c0c07a75d8516019839c820698 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 3 May 2017 12:58:46 +0900 Subject: [PATCH 22/57] CI cleanups. --- .../Tests/TestCaseManiaPlayfield.cs | 31 +++++-------------- osu.Game.Rulesets.Mania/UI/Column.cs | 6 ++-- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 8 ++--- 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 62abc865a1..4c7433ff5a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -1,27 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using osu.Framework.Testing; -using osu.Game.Graphics; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Input; -using OpenTK.Input; -using osu.Game.Rulesets.UI; -using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Input; +using osu.Framework.Testing; +using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.UI; +using System.Linq; namespace osu.Desktop.VisualTests.Tests { @@ -35,13 +20,13 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - int max_columns = 9; + const int max_columns = 9; for (int i = 1; i <= max_columns; i++) { int tempI = i; - AddStep($@"{i} column" + (i > 1 ? "s" : ""), () => + AddStep($"{i} column" + (i > 1 ? "s" : ""), () => { Clear(); Add(new ManiaPlayfield(tempI) @@ -51,8 +36,8 @@ namespace osu.Desktop.VisualTests.Tests }); }); - AddStep($"Trigger keys down", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyDown)); - AddStep($"Trigger keys up", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyUp)); + AddStep("Trigger keys down", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyDown)); + AddStep("Trigger keys up", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyUp)); } } diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 584dfdd09c..75ae529c4c 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -56,9 +56,9 @@ namespace osu.Game.Rulesets.Mania.UI public Key Key; - private Box background; - private Container hitTargetBar; - private Container keyIcon; + private readonly Box background; + private readonly Container hitTargetBar; + private readonly Container keyIcon; public Column() { diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 0b7b1df06d..08ac4c4a3b 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -25,9 +25,9 @@ namespace osu.Game.Rulesets.Mania.UI public ManiaPlayfield(int columns) { if (columns > 9) - throw new ArgumentException($@"{columns} columns is not supported."); + throw new ArgumentException($"{columns} columns is not supported."); if (columns <= 0) - throw new ArgumentException($@"Can't have zero or fewer columns."); + throw new ArgumentException("Can't have zero or fewer columns."); Children = new Drawable[] { @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Mania.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - var columnColours = new Color4[] + Color4[] columnColours = new[] { colours.RedDark, colours.GreenDark, @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.UI int columnCount = Columns.Children.Count(); int halfColumns = columnCount / 2; - var keys = new Key[] { Key.A, Key.S, Key.D, Key.F, Key.Space, Key.J, Key.K, Key.L, Key.Semicolon }; + Key[] keys = new[] { Key.A, Key.S, Key.D, Key.F, Key.Space, Key.J, Key.K, Key.L, Key.Semicolon }; for (int i = 0; i < halfColumns; i++) { From d21c3358b9839086d863fb7c22d2c5890b195524 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 3 May 2017 13:03:46 +0900 Subject: [PATCH 23/57] Less array explicivity. --- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 08ac4c4a3b..112f91181d 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Mania.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - Color4[] columnColours = new[] + var columnColours = new[] { colours.RedDark, colours.GreenDark, @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.UI int columnCount = Columns.Children.Count(); int halfColumns = columnCount / 2; - Key[] keys = new[] { Key.A, Key.S, Key.D, Key.F, Key.Space, Key.J, Key.K, Key.L, Key.Semicolon }; + var keys = new[] { Key.A, Key.S, Key.D, Key.F, Key.Space, Key.J, Key.K, Key.L, Key.Semicolon }; for (int i = 0; i < halfColumns; i++) { @@ -96,4 +96,4 @@ namespace osu.Game.Rulesets.Mania.UI } } } -} \ No newline at end of file +} From 6ea3629c9a5da836636081ac9e9672372d3a9279 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 3 May 2017 08:23:52 +0300 Subject: [PATCH 24/57] Adjust the size --- osu.Game/Screens/Play/ModsContainer.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 8569bc6db6..280759485f 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using OpenTK.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using OpenTK; namespace osu.Game.Screens.Play { @@ -30,14 +31,15 @@ namespace osu.Game.Screens.Play Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, + Spacing = new Vector2(5,0), }, new OsuSpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.TopCentre, - Text = @"/UNRANKED/", + Text = @"/ UNRANKED /", Font = @"Venera", - TextSize = 15, + TextSize = 12, } }; } @@ -49,7 +51,7 @@ namespace osu.Game.Screens.Play AutoSizeAxes = Axes.Both, Icon = mod.Icon, Colour = selectColour(mod), - IconSize = 60, + Scale = new Vector2((float)0.7), }); } From 898d9495ff8fa4f5f37be1c46f15d103718b620c Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 3 May 2017 08:27:47 +0300 Subject: [PATCH 25/57] line fix --- osu.Game/Rulesets/UI/StandardHudOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/StandardHudOverlay.cs b/osu.Game/Rulesets/UI/StandardHudOverlay.cs index 8d4496ad93..709f8ef395 100644 --- a/osu.Game/Rulesets/UI/StandardHudOverlay.cs +++ b/osu.Game/Rulesets/UI/StandardHudOverlay.cs @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.UI Position = new Vector2(0, 25), }; - [BackgroundDependencyLoader] + [BackgroundDependencyLoader] private void load(OsuColour colours) { ComboCounter.AccentColour = colours.BlueLighter; From e7a8619f01241b83d8cf783c8cf9669fa91f70a1 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 3 May 2017 09:48:10 +0300 Subject: [PATCH 26/57] ModIcon refactor --- osu.Game/Overlays/Mods/AssistedSection.cs | 1 - .../Mods/DifficultyIncreaseSection.cs | 1 - .../Mods/DifficultyReductionSection.cs | 1 - osu.Game/Overlays/Mods/ModButton.cs | 20 +---- osu.Game/Overlays/Mods/ModSection.cs | 20 ----- osu.Game/Rulesets/UI/ModIcon.cs | 75 +++++++++++-------- osu.Game/Screens/Play/ModsContainer.cs | 27 ++----- 7 files changed, 54 insertions(+), 91 deletions(-) diff --git a/osu.Game/Overlays/Mods/AssistedSection.cs b/osu.Game/Overlays/Mods/AssistedSection.cs index b4263fa309..b3cbb410e4 100644 --- a/osu.Game/Overlays/Mods/AssistedSection.cs +++ b/osu.Game/Overlays/Mods/AssistedSection.cs @@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods [BackgroundDependencyLoader] private void load(OsuColour colours) { - ButtonColour = colours.Blue; SelectedColour = colours.BlueLight; } diff --git a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs index 0a293416dc..fc759eb7d9 100644 --- a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs @@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods [BackgroundDependencyLoader] private void load(OsuColour colours) { - ButtonColour = colours.Yellow; SelectedColour = colours.YellowLight; } diff --git a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs index 3a373e6f09..dd3b5965f3 100644 --- a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs @@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods [BackgroundDependencyLoader] private void load(OsuColour colours) { - ButtonColour = colours.Green; SelectedColour = colours.GreenLight; } diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index f380c19d8a..409207dd55 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -71,10 +71,6 @@ namespace osu.Game.Overlays.Mods { if (value == buttonColour) return; buttonColour = value; - foreach (ModIcon icon in iconsContainer.Children) - { - icon.Colour = value; - } } } @@ -180,41 +176,33 @@ namespace osu.Game.Overlays.Mods { iconsContainer.Add(new[] { - new ModIcon + new ModIcon(Mods[0]) { Origin = Anchor.Centre, Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, Position = new Vector2(1.5f), - Colour = ButtonColour }, - foregroundIcon = new ModIcon + foregroundIcon = new ModIcon(Mods[0]) { Origin = Anchor.Centre, Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, Position = new Vector2(-1.5f), - Colour = ButtonColour }, }); } else { - iconsContainer.Add(foregroundIcon = new ModIcon + iconsContainer.Add(foregroundIcon = new ModIcon(Mod) { Origin = Anchor.Centre, Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, - Colour = ButtonColour }); } - } - protected override void LoadComplete() - { - base.LoadComplete(); - foreach (ModIcon icon in iconsContainer.Children) - icon.Colour = ButtonColour; + buttonColour = foregroundIcon.Colour; } public ModButton(Mod m) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index c2af12f49e..b70323fb63 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -50,7 +50,6 @@ namespace osu.Game.Overlays.Mods foreach (ModButton button in value) { - button.ButtonColour = ButtonColour; button.SelectedColour = selectedColour; button.Action = Action; } @@ -59,25 +58,6 @@ namespace osu.Game.Overlays.Mods } } - private Color4 buttonsBolour = Color4.White; - public Color4 ButtonColour - { - get - { - return buttonsBolour; - } - set - { - if (value == buttonsBolour) return; - buttonsBolour = value; - - foreach (ModButton button in buttons) - { - button.ButtonColour = value; - } - } - } - private Color4 selectedColour = Color4.White; public Color4 SelectedColour { diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 8301796c1f..127f1483b8 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -5,6 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.UI { @@ -29,25 +30,42 @@ namespace osu.Game.Rulesets.UI public new Color4 Colour { - get - { - return background.Colour; - } - set - { - background.Colour = value; - } + get { return background?.Colour ?? Color4.Transparent; } + set { background.Colour = value; } } public FontAwesome Icon { - get + get { return modIcon.Icon; } + set { modIcon.Icon = value; } + } + + public ModIcon(Mod m) + { + if(m!= null) { - return modIcon.Icon; - } - set - { - modIcon.Icon = value; + Children = new Drawable[] + { + background = new TextAwesome + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Icon = FontAwesome.fa_osu_mod_bg, + Colour = selectColour(m), + Shadow = true, + TextSize = 20 + }, + modIcon = new TextAwesome + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Colour = OsuColour.Gray(84), + TextSize = 20, + Icon = m.Icon, + }, + }; + + reapplySize(); } } @@ -57,28 +75,19 @@ namespace osu.Game.Rulesets.UI modIcon.TextSize = iconSize - 35; } - public ModIcon() + private Color4 selectColour(Mod mod) { - Children = new Drawable[] + switch (mod.Type) { - background = new TextAwesome - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Icon = FontAwesome.fa_osu_mod_bg, - Shadow = true, - TextSize = 20 - }, - modIcon = new TextAwesome - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Colour = OsuColour.Gray(84), - TextSize = 20 - }, - }; + case ModType.DifficultyIncrease: + return OsuColour.FromHex(@"ffcc22"); + case ModType.DifficultyReduction: + return OsuColour.FromHex(@"88b300"); + case ModType.Special: + return OsuColour.FromHex(@"66ccff"); - reapplySize(); + default: return Color4.White; + } } } } \ No newline at end of file diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 280759485f..ddb24bfb31 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -16,9 +16,15 @@ namespace osu.Game.Screens.Play { private readonly FillFlowContainer iconsContainer; + private bool showMods; public bool ShowMods { - set { if (!value) Hide(); } + set + { + showMods = value; + if (!showMods) Hide(); + } + get { return ShowMods; } } public ModsContainer() @@ -46,28 +52,11 @@ namespace osu.Game.Screens.Play public void Add(Mod mod) { - iconsContainer.Add(new ModIcon + iconsContainer.Add(new ModIcon(mod) { AutoSizeAxes = Axes.Both, - Icon = mod.Icon, - Colour = selectColour(mod), Scale = new Vector2((float)0.7), }); } - - private Color4 selectColour(Mod mod) - { - switch (mod.Type) - { - case ModType.DifficultyIncrease: - return OsuColour.FromHex(@"ffcc22"); - case ModType.DifficultyReduction: - return OsuColour.FromHex(@"88b300"); - case ModType.Special: - return OsuColour.FromHex(@"66ccff"); - - default: return Color4.White; - } - } } } From 06e014708a92f66ef906d555ce0c1525e9ddccfe Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 3 May 2017 15:56:54 +0900 Subject: [PATCH 27/57] Defer virtual method to load(). --- osu.Game/Rulesets/UI/HitRenderer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index 25d8bae205..69e0e73664 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -202,8 +202,6 @@ namespace osu.Game.Rulesets.UI protected HitRenderer(WorkingBeatmap beatmap) : base(beatmap) { - KeyConversionInputManager.Add(Playfield = CreatePlayfield()); - InputManager.Add(content = new Container { RelativeSizeAxes = Axes.Both, @@ -216,6 +214,8 @@ namespace osu.Game.Rulesets.UI [BackgroundDependencyLoader] private void load() { + KeyConversionInputManager.Add(Playfield = CreatePlayfield()); + loadObjects(); if (InputManager?.ReplayInputHandler != null) From 14e4714f08209fabd8f548967bd19493d4189e7e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 3 May 2017 19:38:15 +0900 Subject: [PATCH 28/57] Rewrite a lot of ManiaPlayfield/Column to support left/right special styles and arbitrary number of columns. --- .../Tests/TestCaseManiaPlayfield.cs | 4 +- osu.Game.Rulesets.Mania/UI/Column.cs | 74 ++++++----- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 118 ++++++++++++++---- .../UI/SpecialColumnStyle.cs | 21 ++++ .../osu.Game.Rulesets.Mania.csproj | 1 + 5 files changed, 155 insertions(+), 63 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/UI/SpecialColumnStyle.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 4c7433ff5a..9573ab154e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -20,7 +20,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - const int max_columns = 9; + const int max_columns = 10; for (int i = 1; i <= max_columns; i++) { @@ -38,6 +38,8 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Trigger keys down", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyDown)); AddStep("Trigger keys up", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyUp)); + AddStep("Left special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnStyle = SpecialColumnStyle.Left); + AddStep("Right special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnStyle = SpecialColumnStyle.Right); } } diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 75ae529c4c..d2fccb2c58 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -29,31 +29,6 @@ namespace osu.Game.Rulesets.Mania.UI private const float column_width = 45; private const float special_column_width = 70; - private Color4 accentColour; - public Color4 AccentColour - { - get { return accentColour; } - set - { - if (accentColour == value) - return; - accentColour = value; - - setAccentColour(); - } - } - - private bool isSpecialColumn; - public bool IsSpecialColumn - { - get { return isSpecialColumn; } - set - { - isSpecialColumn = value; - Width = isSpecialColumn ? special_column_width : column_width; - } - } - public Key Key; private readonly Box background; @@ -159,23 +134,46 @@ namespace osu.Game.Rulesets.Mania.UI }; } - private void setAccentColour() + private bool isSpecial; + public bool IsSpecial { - background.Colour = AccentColour; - - hitTargetBar.EdgeEffect = new EdgeEffect + get { return isSpecial; } + set { - Type = EdgeEffectType.Glow, - Radius = 5, - Colour = AccentColour.Opacity(0.5f), - }; + if (isSpecial == value) + return; + isSpecial = value; - keyIcon.EdgeEffect = new EdgeEffect + Width = isSpecial ? special_column_width : column_width; + } + } + + private Color4 accentColour; + public Color4 AccentColour + { + get { return accentColour; } + set { - Type = EdgeEffectType.Glow, - Radius = 5, - Colour = AccentColour.Opacity(0.5f), - }; + if (accentColour == value) + return; + accentColour = value; + + background.Colour = accentColour; + + hitTargetBar.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Radius = 5, + Colour = accentColour.Opacity(0.5f), + }; + + keyIcon.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Radius = 5, + Colour = accentColour.Opacity(0.5f), + }; + } } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 112f91181d..471051e3f9 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -15,18 +15,50 @@ using osu.Game.Graphics; using osu.Framework.Allocation; using OpenTK.Input; using System.Linq; +using System.Collections.Generic; namespace osu.Game.Rulesets.Mania.UI { public class ManiaPlayfield : Playfield { + /// + /// Default column keys, expanding outwards from the middle as more column are added. + /// E.g. 2 columns use FJ, 4 columns use DFJK, 6 use SDFJKL, etc... + /// + private static readonly Key[] default_keys = new[] { Key.A, Key.S, Key.D, Key.F, Key.J, Key.K, Key.L, Key.Semicolon }; + + private SpecialColumnStyle specialColumnStyle; + /// + /// The style to use for the special column. + /// + public SpecialColumnStyle SpecialColumnStyle + { + get { return specialColumnStyle; } + set + { + if (specialColumnStyle == value) + return; + specialColumnStyle = value; + + if (!IsLoaded) + return; + + updateColumnStyle(); + } + } + public readonly FlowContainer Columns; - public ManiaPlayfield(int columns) + private List normalColumnColours = new List(); + private Color4 specialColumnColour; + + private readonly int columnCount; + + public ManiaPlayfield(int columnCount) { - if (columns > 9) - throw new ArgumentException($"{columns} columns is not supported."); - if (columns <= 0) + this.columnCount = columnCount; + + if (columnCount <= 0) throw new ArgumentException("Can't have zero or fewer columns."); Children = new Drawable[] @@ -56,43 +88,81 @@ namespace osu.Game.Rulesets.Mania.UI } }; - for (int i = 0; i < columns; i++) + for (int i = 0; i < columnCount; i++) Columns.Add(new Column()); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - var columnColours = new[] + normalColumnColours = new List { colours.RedDark, - colours.GreenDark, - colours.BlueDark // Special column + colours.GreenDark }; - int columnCount = Columns.Children.Count(); - int halfColumns = columnCount / 2; + specialColumnColour = colours.BlueDark; - var keys = new[] { Key.A, Key.S, Key.D, Key.F, Key.Space, Key.J, Key.K, Key.L, Key.Semicolon }; + updateColumnStyle(); + } - for (int i = 0; i < halfColumns; i++) + /// + /// Updates the column style (special style/colours) + keys. + /// + private void updateColumnStyle() + { + // Set the special column + colour + key + for (int i = 0; i < columnCount; i++) { - Column leftColumn = Columns.Children.ElementAt(i); - Column rightColumn = Columns.Children.ElementAt(columnCount - 1 - i); + Column column = Columns.Children.ElementAt(i); + column.IsSpecial = isSpecialColumn(i); - Color4 accent = columnColours[i % 2]; - leftColumn.AccentColour = rightColumn.AccentColour = accent; - leftColumn.Key = keys[keys.Length / 2 - halfColumns + i]; - rightColumn.Key = keys[keys.Length / 2 + halfColumns - i]; + if (!column.IsSpecial) + continue; + + column.Key = Key.Space; + column.AccentColour = specialColumnColour; } - bool hasSpecial = halfColumns * 2 < columnCount; - if (hasSpecial) + var nonSpecialColumns = Columns.Children.Where(c => !c.IsSpecial).ToList(); + + // We'll set the colours of the non-special columns in a separate loop, because the non-special + // column colours are mirrored across their centre and special styles mess with this + for (int i = 0; i < Math.Ceiling(nonSpecialColumns.Count / 2f); i++) { - Column specialColumn = Columns.Children.ElementAt(halfColumns); - specialColumn.IsSpecialColumn = true; - specialColumn.AccentColour = columnColours[2]; - specialColumn.Key = keys[keys.Length / 2]; + Color4 colour = normalColumnColours[i % normalColumnColours.Count]; + nonSpecialColumns[i].AccentColour = colour; + nonSpecialColumns[nonSpecialColumns.Count - 1 - i].AccentColour = colour; + } + + // We'll set the keys for non-special columns in another separate loop because it's not mirrored like the above colours + // Todo: This needs to go when we get to bindings and use Button1, ..., ButtonN instead + for (int i = 0; i < nonSpecialColumns.Count; i++) + { + Column column = nonSpecialColumns[i]; + + int keyOffset = default_keys.Length / 2 - nonSpecialColumns.Count / 2 + i; + if (keyOffset >= 0 && keyOffset < default_keys.Length) + column.Key = default_keys[keyOffset]; + } + } + + /// + /// Whether the column index is a special column for this playfield. + /// + /// The 0-based column index. + /// Whether the column is a special column. + private bool isSpecialColumn(int column) + { + switch (SpecialColumnStyle) + { + default: + case SpecialColumnStyle.Normal: + return columnCount % 2 == 1 && column == columnCount / 2; + case SpecialColumnStyle.Left: + return column == 0; + case SpecialColumnStyle.Right: + return column == columnCount - 1; } } } diff --git a/osu.Game.Rulesets.Mania/UI/SpecialColumnStyle.cs b/osu.Game.Rulesets.Mania/UI/SpecialColumnStyle.cs new file mode 100644 index 0000000000..5acb147312 --- /dev/null +++ b/osu.Game.Rulesets.Mania/UI/SpecialColumnStyle.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Mania.UI +{ + public enum SpecialColumnStyle + { + /// + /// The special column will lie in the center of the columns. + /// + Normal, + /// + /// The special column will lie to the left of the columns. + /// + Left, + /// + /// The special column will lie to the right of the columns. + /// + Right + } +} diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 18ea1de13a..0a781aa30d 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -61,6 +61,7 @@ + From 8d82a52942c03ffccd48af1790f5bfe8b96f806c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 3 May 2017 19:38:27 +0900 Subject: [PATCH 29/57] Add revert to normal special style after all steps. --- osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 9573ab154e..259dd6b4eb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -41,6 +41,8 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Left special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnStyle = SpecialColumnStyle.Left); AddStep("Right special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnStyle = SpecialColumnStyle.Right); } + + AddStep("Normal special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnStyle = SpecialColumnStyle.Normal); } private void triggerKeyDown(Column column) From 8aa6bb636c2f8eec8125aa4d76023eaf27edb822 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 3 May 2017 19:42:20 +0900 Subject: [PATCH 30/57] Reset column key when it can't be set. --- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 471051e3f9..947b067b02 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -144,6 +144,10 @@ namespace osu.Game.Rulesets.Mania.UI int keyOffset = default_keys.Length / 2 - nonSpecialColumns.Count / 2 + i; if (keyOffset >= 0 && keyOffset < default_keys.Length) column.Key = default_keys[keyOffset]; + else + // There is no default key defined for this column. Let's set this to Unknown for now + // however note that this will be gone after bindings are in place + column.Key = Key.Unknown; } } From 9e35eb8d978be13c4664d378967fe7443ddbd744 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 3 May 2017 13:53:45 +0300 Subject: [PATCH 31/57] Fixes --- osu.Game/Rulesets/UI/ModIcon.cs | 47 ++++++++++++-------------- osu.Game/Screens/Play/ModsContainer.cs | 2 -- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 127f1483b8..710ea22a5b 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.UI public new Color4 Colour { - get { return background?.Colour ?? Color4.Transparent; } + get { return background.Colour; } set { background.Colour = value; } } @@ -42,31 +42,28 @@ namespace osu.Game.Rulesets.UI public ModIcon(Mod m) { - if(m!= null) + Children = new Drawable[] { - Children = new Drawable[] + background = new TextAwesome { - background = new TextAwesome - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Icon = FontAwesome.fa_osu_mod_bg, - Colour = selectColour(m), - Shadow = true, - TextSize = 20 - }, - modIcon = new TextAwesome - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Colour = OsuColour.Gray(84), - TextSize = 20, - Icon = m.Icon, - }, - }; + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Icon = FontAwesome.fa_osu_mod_bg, + Colour = pickColour(m), + Shadow = true, + TextSize = 20 + }, + modIcon = new TextAwesome + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Colour = OsuColour.Gray(84), + TextSize = 20, + Icon = m?.Icon ?? FontAwesome.fa_question, + }, + }; - reapplySize(); - } + reapplySize(); } private void reapplySize() @@ -75,9 +72,9 @@ namespace osu.Game.Rulesets.UI modIcon.TextSize = iconSize - 35; } - private Color4 selectColour(Mod mod) + private Color4 pickColour(Mod mod) { - switch (mod.Type) + switch (mod?.Type) { case ModType.DifficultyIncrease: return OsuColour.FromHex(@"ffcc22"); diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index ddb24bfb31..26f0edcf10 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -5,8 +5,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using osu.Framework.Graphics; -using OpenTK.Graphics; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; From 5f2f1d2763aabd079ed6ba9392e3820f2b27c837 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 3 May 2017 14:01:43 +0300 Subject: [PATCH 32/57] CI fixes --- osu.Game/Overlays/Mods/ModButton.cs | 11 ++--------- osu.Game/Screens/Play/ModsContainer.cs | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 409207dd55..e3d26cba06 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -63,15 +63,8 @@ namespace osu.Game.Overlays.Mods private Color4 buttonColour; public Color4 ButtonColour { - get - { - return buttonColour; - } - set - { - if (value == buttonColour) return; - buttonColour = value; - } + get { return buttonColour; } + set { buttonColour = value; } } private Color4 selectedColour; diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 26f0edcf10..4e23853c3d 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Play showMods = value; if (!showMods) Hide(); } - get { return ShowMods; } + get { return showMods; } } public ModsContainer() From 5024a7419289dc7932a74671397e3ae2237dd52c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 3 May 2017 20:11:24 +0900 Subject: [PATCH 33/57] Update ManiaPlayfield.cs --- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 947b067b02..000a3e47ad 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Mania.UI /// Default column keys, expanding outwards from the middle as more column are added. /// E.g. 2 columns use FJ, 4 columns use DFJK, 6 use SDFJKL, etc... /// - private static readonly Key[] default_keys = new[] { Key.A, Key.S, Key.D, Key.F, Key.J, Key.K, Key.L, Key.Semicolon }; + private static readonly Key[] default_keys = { Key.A, Key.S, Key.D, Key.F, Key.J, Key.K, Key.L, Key.Semicolon }; private SpecialColumnStyle specialColumnStyle; /// From 489f58688799831916930fbd1c2463d872caa436 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 May 2017 20:34:53 +0900 Subject: [PATCH 34/57] Add FPS display toggling. Kinda temporary but better than nothing. --- osu.Game/Configuration/OsuConfigManager.cs | 5 ++++- osu.Game/OsuGameBase.cs | 12 ++++++++++++ .../Options/Sections/Graphics/RendererOptions.cs | 9 ++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 2c9574905f..3907496ca2 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -53,6 +53,8 @@ namespace osu.Game.Configuration // Graphics + Set(OsuConfig.ShowFpsDisplay, false); + Set(OsuConfig.MenuParallax, true); Set(OsuConfig.SnakingInSliders, true); @@ -99,6 +101,7 @@ namespace osu.Game.Configuration DisplayStarsMinimum, DisplayStarsMaximum, SnakingInSliders, - SnakingOutSliders + SnakingOutSliders, + ShowFpsDisplay } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c9d7d856db..a814b5f125 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -19,6 +19,7 @@ using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Processing; using osu.Game.Online.API; using SQLite.Net; +using osu.Framework.Graphics.Performance; namespace osu.Game { @@ -44,6 +45,8 @@ namespace osu.Game public readonly Bindable Beatmap = new Bindable(); + private Bindable fpsDisplayVisible; + protected AssemblyName AssemblyName => Assembly.GetEntryAssembly()?.GetName() ?? new AssemblyName { Version = new Version() }; public bool IsDeployedBuild => AssemblyName.Version.Major > 0; @@ -160,6 +163,15 @@ namespace osu.Game }, } }); + + // TODO: This is temporary until we reimplement the local FPS display. + // It's just to allow end-users to access the framework FPS display without knowing the shortcut key. + fpsDisplayVisible = LocalConfig.GetBindable(OsuConfig.ShowFpsDisplay); + fpsDisplayVisible.ValueChanged += val => + { + FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; + }; + fpsDisplayVisible.TriggerChange(); } public override void SetHost(GameHost host) diff --git a/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs index fafe91cfc5..58bf2b7996 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs @@ -4,6 +4,8 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Game.Configuration; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Graphics { @@ -12,7 +14,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics protected override string Header => "Renderer"; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config) + private void load(FrameworkConfigManager config, OsuConfigManager osuConfig) { // NOTE: Compatability mode omitted Children = new Drawable[] @@ -23,6 +25,11 @@ namespace osu.Game.Overlays.Options.Sections.Graphics LabelText = "Frame limiter", Bindable = config.GetBindable(FrameworkConfig.FrameSync) }, + new OsuCheckbox + { + LabelText = "Show FPS", + Bindable = osuConfig.GetBindable(OsuConfig.ShowFpsDisplay) + }, }; } } From 330dd458bd92228038a50a79c948662cffdea3d0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 May 2017 20:49:52 +0900 Subject: [PATCH 35/57] Trim whitespace. --- osu.Game/Overlays/Options/Sections/MaintenanceSection.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs index a50f1f3ff0..e8a4f91074 100644 --- a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs @@ -17,8 +17,7 @@ namespace osu.Game.Overlays.Options.Sections FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { - }; } } -} \ No newline at end of file +} From c39b314ac296b3cc874b478148daaffcbc10b614 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 May 2017 21:29:42 +0900 Subject: [PATCH 36/57] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 58c108309f..cebdfb1bbb 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 58c108309f72462d8dc45aa488ab78cd6db08cf1 +Subproject commit cebdfb1bbb260e5aaca0a01e06d7128b3d1faae4 From 6063231e40258ab399bbd7fc8765903b8ed9209d Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 3 May 2017 16:58:10 +0300 Subject: [PATCH 37/57] float value fix --- osu.Game/Screens/Play/ModsContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 4e23853c3d..204ed95873 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Play iconsContainer.Add(new ModIcon(mod) { AutoSizeAxes = Axes.Both, - Scale = new Vector2((float)0.7), + Scale = new Vector2(0.7f), }); } } From a2bdd020e5b86c06a436127c28ac9fbe3e475cdf Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 4 May 2017 14:46:10 +0900 Subject: [PATCH 38/57] ColumnStyle -> ColumnPosition. --- .../Tests/TestCaseManiaPlayfield.cs | 6 +++--- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 18 +++++++++--------- ...ColumnStyle.cs => SpecialColumnPosition.cs} | 2 +- .../osu.Game.Rulesets.Mania.csproj | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) rename osu.Game.Rulesets.Mania/UI/{SpecialColumnStyle.cs => SpecialColumnPosition.cs} (90%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 259dd6b4eb..7e5a564da6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -38,11 +38,11 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Trigger keys down", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyDown)); AddStep("Trigger keys up", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyUp)); - AddStep("Left special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnStyle = SpecialColumnStyle.Left); - AddStep("Right special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnStyle = SpecialColumnStyle.Right); + AddStep("Left special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Left); + AddStep("Right special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Right); } - AddStep("Normal special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnStyle = SpecialColumnStyle.Normal); + AddStep("Normal special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Normal); } private void triggerKeyDown(Column column) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 000a3e47ad..d084326f5b 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -27,18 +27,18 @@ namespace osu.Game.Rulesets.Mania.UI /// private static readonly Key[] default_keys = { Key.A, Key.S, Key.D, Key.F, Key.J, Key.K, Key.L, Key.Semicolon }; - private SpecialColumnStyle specialColumnStyle; + private SpecialColumnPosition specialColumnPosition; /// /// The style to use for the special column. /// - public SpecialColumnStyle SpecialColumnStyle + public SpecialColumnPosition SpecialColumnPosition { - get { return specialColumnStyle; } + get { return specialColumnPosition; } set { - if (specialColumnStyle == value) + if (specialColumnPosition == value) return; - specialColumnStyle = value; + specialColumnPosition = value; if (!IsLoaded) return; @@ -158,14 +158,14 @@ namespace osu.Game.Rulesets.Mania.UI /// Whether the column is a special column. private bool isSpecialColumn(int column) { - switch (SpecialColumnStyle) + switch (SpecialColumnPosition) { default: - case SpecialColumnStyle.Normal: + case SpecialColumnPosition.Normal: return columnCount % 2 == 1 && column == columnCount / 2; - case SpecialColumnStyle.Left: + case SpecialColumnPosition.Left: return column == 0; - case SpecialColumnStyle.Right: + case SpecialColumnPosition.Right: return column == columnCount - 1; } } diff --git a/osu.Game.Rulesets.Mania/UI/SpecialColumnStyle.cs b/osu.Game.Rulesets.Mania/UI/SpecialColumnPosition.cs similarity index 90% rename from osu.Game.Rulesets.Mania/UI/SpecialColumnStyle.cs rename to osu.Game.Rulesets.Mania/UI/SpecialColumnPosition.cs index 5acb147312..7fd30e7d0d 100644 --- a/osu.Game.Rulesets.Mania/UI/SpecialColumnStyle.cs +++ b/osu.Game.Rulesets.Mania/UI/SpecialColumnPosition.cs @@ -3,7 +3,7 @@ namespace osu.Game.Rulesets.Mania.UI { - public enum SpecialColumnStyle + public enum SpecialColumnPosition { /// /// The special column will lie in the center of the columns. diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 0a781aa30d..e2c6ad9a9f 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -61,7 +61,7 @@ - + From e307b6d563d24bf224909d4af05789ca4f0f2134 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 4 May 2017 15:12:32 +0900 Subject: [PATCH 39/57] Make SpecialColumnPosition only have an effect during load(). --- .../Tests/TestCaseManiaPlayfield.cs | 29 +++++++++++-------- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 25 +--------------- 2 files changed, 18 insertions(+), 36 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 7e5a564da6..2d4414d19f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -7,6 +7,7 @@ using osu.Framework.Testing; using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.UI; using System.Linq; +using System; namespace osu.Desktop.VisualTests.Tests { @@ -22,27 +23,31 @@ namespace osu.Desktop.VisualTests.Tests const int max_columns = 10; + Action createPlayfield = (cols, pos) => + { + Clear(); + Add(new ManiaPlayfield(cols) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + SpecialColumnPosition = pos + }); + }; + for (int i = 1; i <= max_columns; i++) { int tempI = i; - AddStep($"{i} column" + (i > 1 ? "s" : ""), () => - { - Clear(); - Add(new ManiaPlayfield(tempI) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre - }); - }); + AddStep($"{i} column" + (i > 1 ? "s" : ""), () => createPlayfield(tempI, SpecialColumnPosition.Normal)); AddStep("Trigger keys down", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyDown)); AddStep("Trigger keys up", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyUp)); - AddStep("Left special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Left); - AddStep("Right special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Right); + + AddStep("Left special style", () => createPlayfield(tempI, SpecialColumnPosition.Left)); + AddStep("Right special style", () => createPlayfield(tempI, SpecialColumnPosition.Right)); } - AddStep("Normal special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Normal); + AddStep("Normal special style", () => createPlayfield(max_columns, SpecialColumnPosition.Normal)); } private void triggerKeyDown(Column column) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index d084326f5b..7b6c134ede 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -27,25 +27,10 @@ namespace osu.Game.Rulesets.Mania.UI /// private static readonly Key[] default_keys = { Key.A, Key.S, Key.D, Key.F, Key.J, Key.K, Key.L, Key.Semicolon }; - private SpecialColumnPosition specialColumnPosition; /// /// The style to use for the special column. /// - public SpecialColumnPosition SpecialColumnPosition - { - get { return specialColumnPosition; } - set - { - if (specialColumnPosition == value) - return; - specialColumnPosition = value; - - if (!IsLoaded) - return; - - updateColumnStyle(); - } - } + public SpecialColumnPosition SpecialColumnPosition; public readonly FlowContainer Columns; @@ -103,14 +88,6 @@ namespace osu.Game.Rulesets.Mania.UI specialColumnColour = colours.BlueDark; - updateColumnStyle(); - } - - /// - /// Updates the column style (special style/colours) + keys. - /// - private void updateColumnStyle() - { // Set the special column + colour + key for (int i = 0; i < columnCount; i++) { From 72b2467e74ba27fedf4d6ea483de4cdb0d89fe60 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 4 May 2017 15:18:20 +0900 Subject: [PATCH 40/57] Throw exception if SpecialColumnPosition is set after IsLoaded. --- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 7b6c134ede..fa55768382 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -27,10 +27,20 @@ namespace osu.Game.Rulesets.Mania.UI /// private static readonly Key[] default_keys = { Key.A, Key.S, Key.D, Key.F, Key.J, Key.K, Key.L, Key.Semicolon }; + private SpecialColumnPosition specialColumnPosition; /// /// The style to use for the special column. /// - public SpecialColumnPosition SpecialColumnPosition; + public SpecialColumnPosition SpecialColumnPosition + { + get { return specialColumnPosition; } + set + { + if (IsLoaded) + throw new InvalidOperationException($"Setting {nameof(SpecialColumnPosition)} after the playfield is loaded requires re-creating the playfield."); + specialColumnPosition = value; + } + } public readonly FlowContainer Columns; From 57c423241669ff9f6c3856bc5c4c229f64949ef2 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 4 May 2017 11:58:37 +0300 Subject: [PATCH 41/57] Added testcase --- .../Tests/TestCaseIngameModsContainer.cs | 67 +++++++++++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Screens/Play/ModsContainer.cs | 5 ++ 3 files changed, 73 insertions(+) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs new file mode 100644 index 0000000000..3b2135fcbd --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs @@ -0,0 +1,67 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Sprites; +using osu.Game.Screens.Menu; +using OpenTK.Graphics; +using osu.Game.Screens.Play; +using osu.Framework.Allocation; +using osu.Game.Overlays.Mods; +using osu.Game.Database; +using osu.Game.Rulesets.Mods; +using OpenTK; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseIngameModsContainer : TestCase + { + public override string Description => @"Ingame mods visualization"; + + private ModSelectOverlay modSelect; + private ModsContainer modsContainer; + private RulesetDatabase rulesets; + + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + this.rulesets = rulesets; + } + + public override void Reset() + { + base.Reset(); + + Add(modSelect = new ModSelectOverlay + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + }); + + Add(modsContainer = new ModsContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Position = new Vector2(0, 25), + }); + + modSelect.SelectedMods.ValueChanged += SelectedMods_ValueChanged; + modSelect.SelectedMods.TriggerChange(); + + AddStep("ToggleModSelect", modSelect.ToggleVisibility); + foreach (var ruleset in rulesets.AllRulesets) + AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset); + } + + private void SelectedMods_ValueChanged(System.Collections.Generic.IEnumerable newValue) + { + modsContainer.Clear(); + foreach (Mod mod in modSelect.SelectedMods.Value) + modsContainer.Add(mod); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 135e4596c7..58d8d50ed1 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -190,6 +190,7 @@ + diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 204ed95873..5806a12ac9 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -56,5 +56,10 @@ namespace osu.Game.Screens.Play Scale = new Vector2(0.7f), }); } + + public void Clear() + { + iconsContainer.Clear(); + } } } From 153951d3ddd060907409593b35d5fa3d8e0b6d6e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 May 2017 23:07:24 +0900 Subject: [PATCH 42/57] Add OptionItem class Allow for centalised logic for all option UI controls. --- osu.Game/Overlays/Options/OptionCheckbox.cs | 27 ++++++ osu.Game/Overlays/Options/OptionDropdown.cs | 59 ++----------- osu.Game/Overlays/Options/OptionItem.cs | 84 +++++++++++++++++++ osu.Game/Overlays/Options/OptionLabel.cs | 6 +- osu.Game/Overlays/Options/OptionSlider.cs | 48 ++--------- osu.Game/Overlays/Options/OptionTextBox.cs | 16 +--- .../Options/Sections/Audio/MainMenuOptions.cs | 6 +- .../Options/Sections/Debug/GeneralOptions.cs | 2 +- .../Sections/Gameplay/GeneralOptions.cs | 4 +- .../Sections/General/LanguageOptions.cs | 2 +- .../Options/Sections/General/LoginOptions.cs | 4 +- .../Sections/Graphics/DetailOptions.cs | 6 +- .../Sections/Graphics/LayoutOptions.cs | 4 +- .../Sections/Graphics/MainMenuOptions.cs | 4 +- .../Sections/Graphics/RendererOptions.cs | 4 +- .../Options/Sections/Input/MouseOptions.cs | 4 +- osu.Game/osu.Game.csproj | 2 + 17 files changed, 156 insertions(+), 126 deletions(-) create mode 100644 osu.Game/Overlays/Options/OptionCheckbox.cs create mode 100644 osu.Game/Overlays/Options/OptionItem.cs diff --git a/osu.Game/Overlays/Options/OptionCheckbox.cs b/osu.Game/Overlays/Options/OptionCheckbox.cs new file mode 100644 index 0000000000..4aca15e3b9 --- /dev/null +++ b/osu.Game/Overlays/Options/OptionCheckbox.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +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.UserInterface; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Options +{ + public class OptionCheckbox : OptionItem + { + private OsuCheckbox checkbox; + + protected override Drawable CreateControl() => checkbox = new OsuCheckbox(); + + public override string LabelText + { + get { return checkbox.LabelText; } + set { checkbox.LabelText = value; } + } + } +} diff --git a/osu.Game/Overlays/Options/OptionDropdown.cs b/osu.Game/Overlays/Options/OptionDropdown.cs index 6837e71c2c..bb2875f9d8 100644 --- a/osu.Game/Overlays/Options/OptionDropdown.cs +++ b/osu.Game/Overlays/Options/OptionDropdown.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -13,34 +14,11 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options { - public class OptionDropdown : FillFlowContainer + public class OptionDropdown : OptionItem { - private readonly Dropdown dropdown; - private readonly SpriteText text; + private Dropdown dropdown; - public string LabelText - { - get { return text.Text; } - set - { - text.Text = value; - text.Alpha = !string.IsNullOrEmpty(value) ? 1 : 0; - } - } - - public Bindable Bindable - { - get { return bindable; } - set - { - bindable = value; - dropdown.Current.BindTo(bindable); - } - } - - private Bindable bindable; - - private IEnumerable> items; + private IEnumerable> items = new KeyValuePair[] { }; public IEnumerable> Items { get @@ -55,30 +33,11 @@ namespace osu.Game.Overlays.Options } } - public OptionDropdown() + protected override Drawable CreateControl() => dropdown = new OsuDropdown { - Items = new KeyValuePair[0]; - - Direction = FillDirection.Vertical; - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Children = new Drawable[] - { - text = new OsuSpriteText { - Alpha = 0, - }, - dropdown = new OsuDropdown - { - Margin = new MarginPadding { Top = 5 }, - RelativeSizeAxes = Axes.X, - Items = Items, - } - }; - - dropdown.Current.DisabledChanged += disabled => - { - Alpha = disabled ? 0.3f : 1; - }; - } + Margin = new MarginPadding { Top = 5 }, + RelativeSizeAxes = Axes.X, + Items = Items, + }; } } diff --git a/osu.Game/Overlays/Options/OptionItem.cs b/osu.Game/Overlays/Options/OptionItem.cs new file mode 100644 index 0000000000..c5b0e08ec0 --- /dev/null +++ b/osu.Game/Overlays/Options/OptionItem.cs @@ -0,0 +1,84 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +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.UserInterface; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Overlays.Options +{ + public abstract class OptionItem : FillFlowContainer, IFilterable + { + protected abstract Drawable CreateControl(); + + protected Drawable Control { get; private set; } + + private IHasCurrentValue ControlWithCurrent => Control as IHasCurrentValue; + + private SpriteText text; + + public virtual string LabelText + { + get { return text?.Text ?? string.Empty; } + set + { + if (text == null) + { + // construct lazily for cases where the label is not needed (may be provided by the Control). + Add(text = new OsuSpriteText() { Depth = 1 }); + } + + text.Text = value; + } + } + + // hold a reference to the provided bindable so we don't have to in every options section. + private Bindable bindable; + + public Bindable Bindable + { + get + { + return bindable; + } + + set + { + bindable = value; + (Control as IHasCurrentValue)?.Current.BindTo(bindable); + } + } + + public string[] FilterTerms => new[] { LabelText }; + + public bool MatchingCurrentFilter + { + set + { + // probably needs a better transition. + FadeTo(value ? 1 : 0); + } + } + + public OptionItem() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Padding = new MarginPadding { Right = 5 }; + + if ((Control = CreateControl()) != null) + { + if (ControlWithCurrent != null) + ControlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; }; + Add(Control); + } + } + } +} diff --git a/osu.Game/Overlays/Options/OptionLabel.cs b/osu.Game/Overlays/Options/OptionLabel.cs index 4b0f1e4ec0..03b9a19ef4 100644 --- a/osu.Game/Overlays/Options/OptionLabel.cs +++ b/osu.Game/Overlays/Options/OptionLabel.cs @@ -1,14 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.Options { - internal class OptionLabel : OsuSpriteText + internal class OptionLabel : OptionItem { + protected override Drawable CreateControl() => null; + [BackgroundDependencyLoader] private void load(OsuColour colour) { diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 2d98bc991a..367bacb7c2 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -17,52 +17,14 @@ namespace osu.Game.Overlays.Options { } - public class OptionSlider : FillFlowContainer + public class OptionSlider : OptionItem where T : struct where U : SliderBar, new() { - private readonly SliderBar slider; - private readonly SpriteText text; - - public string LabelText + protected override Drawable CreateControl() => new U() { - get { return text.Text; } - set - { - text.Text = value; - text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1; - } - } - - private Bindable bindable; - - public Bindable Bindable - { - set - { - bindable = value; - slider.Current.BindTo(bindable); - } - } - - public OptionSlider() - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Padding = new MarginPadding { Right = 5 }; - - Children = new Drawable[] - { - text = new OsuSpriteText - { - Alpha = 0, - }, - slider = new U() - { - Margin = new MarginPadding { Top = 5, Bottom = 5 }, - RelativeSizeAxes = Axes.X - } - }; - } + Margin = new MarginPadding { Top = 5, Bottom = 5 }, + RelativeSizeAxes = Axes.X + }; } } diff --git a/osu.Game/Overlays/Options/OptionTextBox.cs b/osu.Game/Overlays/Options/OptionTextBox.cs index 4927122181..3d52eb67d0 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -1,22 +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.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options { - public class OptionTextBox : OsuTextBox + public class OptionTextBox : OptionItem { - private Bindable bindable; - - public Bindable Bindable - { - set - { - bindable = value; - Current.BindTo(bindable); - } - } + protected override Drawable CreateControl() => new OsuTextBox(); } } diff --git a/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs index 9de74e1b02..d8731ff2d7 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs @@ -16,12 +16,12 @@ namespace osu.Game.Overlays.Options.Sections.Audio { Children = new[] { - new OsuCheckbox + new OptionCheckbox { LabelText = "Interface voices", Bindable = config.GetBindable(OsuConfig.MenuVoice) }, - new OsuCheckbox + new OptionCheckbox { LabelText = "osu! music theme", Bindable = config.GetBindable(OsuConfig.MenuMusic) @@ -29,4 +29,4 @@ namespace osu.Game.Overlays.Options.Sections.Audio }; } } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs b/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs index 34901e1dac..b87681a014 100644 --- a/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Options.Sections.Debug { Children = new Drawable[] { - new OsuCheckbox + new OptionCheckbox { LabelText = "Bypass caching", Bindable = config.GetBindable(FrameworkDebugConfig.BypassCaching) diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs index c278b59a51..92ea3442d2 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs @@ -22,12 +22,12 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay LabelText = "Background dim", Bindable = config.GetBindable(OsuConfig.DimLevel) }, - new OsuCheckbox + new OptionCheckbox { LabelText = "Show score overlay", Bindable = config.GetBindable(OsuConfig.ShowInterface) }, - new OsuCheckbox + new OptionCheckbox { LabelText = "Always show key overlay", Bindable = config.GetBindable(OsuConfig.KeyOverlay) diff --git a/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs b/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs index 7bc1a54455..921470aab1 100644 --- a/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Options.Sections.General { Children = new Drawable[] { - new OsuCheckbox + new OptionCheckbox { LabelText = "Prefer metadata in original language", Bindable = frameworkConfig.GetBindable(FrameworkConfig.ShowUnicode) diff --git a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs index a5e38dd284..a3612a6396 100644 --- a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs @@ -132,12 +132,12 @@ namespace osu.Game.Overlays.Options.Sections.General TabbableContentContainer = this, OnCommit = (sender, newText) => performLogin() }, - new OsuCheckbox + new OptionCheckbox { LabelText = "Remember username", Bindable = config.GetBindable(OsuConfig.SaveUsername), }, - new OsuCheckbox + new OptionCheckbox { LabelText = "Stay logged in", Bindable = config.GetBindable(OsuConfig.SavePassword), diff --git a/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs index d8906d74ba..80bbd1caad 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs @@ -17,12 +17,12 @@ namespace osu.Game.Overlays.Options.Sections.Graphics { Children = new Drawable[] { - new OsuCheckbox + new OptionCheckbox { LabelText = "Snaking in sliders", Bindable = config.GetBindable(OsuConfig.SnakingInSliders) }, - new OsuCheckbox + new OptionCheckbox { LabelText = "Snaking out sliders", Bindable = config.GetBindable(OsuConfig.SnakingOutSliders) @@ -30,4 +30,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics }; } } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs index aed39ca764..36590045c6 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics LabelText = "Screen mode", Bindable = config.GetBindable(FrameworkConfig.WindowMode), }, - new OsuCheckbox + new OptionCheckbox { LabelText = "Letterboxing", Bindable = letterboxing, @@ -64,4 +64,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics } } } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs index 83a2a382ad..005573414b 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics { Children = new[] { - new OsuCheckbox + new OptionCheckbox { LabelText = "Parallax", Bindable = config.GetBindable(OsuConfig.MenuParallax) @@ -24,4 +24,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics }; } } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs index 58bf2b7996..3e6001c985 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics LabelText = "Frame limiter", Bindable = config.GetBindable(FrameworkConfig.FrameSync) }, - new OsuCheckbox + new OptionCheckbox { LabelText = "Show FPS", Bindable = osuConfig.GetBindable(OsuConfig.ShowFpsDisplay) @@ -33,4 +33,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics }; } } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs index 12789aa0ec..b4ce11e2bc 100644 --- a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs @@ -24,12 +24,12 @@ namespace osu.Game.Overlays.Options.Sections.Input LabelText = "Confine mouse cursor", Bindable = config.GetBindable(FrameworkConfig.ConfineMouseMode), }, - new OsuCheckbox + new OptionCheckbox { LabelText = "Disable mouse wheel during gameplay", Bindable = osuConfig.GetBindable(OsuConfig.MouseDisableWheel) }, - new OsuCheckbox + new OptionCheckbox { LabelText = "Disable mouse buttons during gameplay", Bindable = osuConfig.GetBindable(OsuConfig.MouseDisableButtons) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 929811226f..3535bc0028 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -371,8 +371,10 @@ + + From 475eb6fe5f14c10d722209e42413a31bf7b41a7f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 4 May 2017 17:29:52 +0300 Subject: [PATCH 43/57] Cleanup --- .../Tests/TestCaseIngameModsContainer.cs | 31 +--------------- .../Tests/TestCaseModSelectOverlay.cs | 2 +- osu.Game/Rulesets/UI/ModIcon.cs | 8 ++-- osu.Game/Screens/Play/ModsContainer.cs | 37 ++++++++++++------- osu.Game/Screens/Play/Player.cs | 3 +- 5 files changed, 31 insertions(+), 50 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs index 3b2135fcbd..e9b8df2d1b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs @@ -16,31 +16,16 @@ using OpenTK; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseIngameModsContainer : TestCase + internal class TestCaseIngameModsContainer : TestCaseModSelectOverlay { public override string Description => @"Ingame mods visualization"; - private ModSelectOverlay modSelect; private ModsContainer modsContainer; - private RulesetDatabase rulesets; - - [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets) - { - this.rulesets = rulesets; - } public override void Reset() { base.Reset(); - Add(modSelect = new ModSelectOverlay - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - }); - Add(modsContainer = new ModsContainer { Anchor = Anchor.TopRight, @@ -49,19 +34,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(0, 25), }); - modSelect.SelectedMods.ValueChanged += SelectedMods_ValueChanged; - modSelect.SelectedMods.TriggerChange(); - - AddStep("ToggleModSelect", modSelect.ToggleVisibility); - foreach (var ruleset in rulesets.AllRulesets) - AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset); - } - - private void SelectedMods_ValueChanged(System.Collections.Generic.IEnumerable newValue) - { - modsContainer.Clear(); - foreach (Mod mod in modSelect.SelectedMods.Value) - modsContainer.Add(mod); + modsContainer.Mods.BindTo(modSelect.SelectedMods); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index d1c137191f..0f85a8ab76 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -13,7 +13,7 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests the mod select overlay"; - private ModSelectOverlay modSelect; + protected ModSelectOverlay modSelect; private RulesetDatabase rulesets; [BackgroundDependencyLoader] diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 710ea22a5b..19efdb0175 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.UI set { modIcon.Icon = value; } } - public ModIcon(Mod m) + public ModIcon(Mod mod) { Children = new Drawable[] { @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.UI Origin = Anchor.Centre, Anchor = Anchor.Centre, Icon = FontAwesome.fa_osu_mod_bg, - Colour = pickColour(m), + Colour = getBackgroundColourFromMod(mod), Shadow = true, TextSize = 20 }, @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.UI Anchor = Anchor.Centre, Colour = OsuColour.Gray(84), TextSize = 20, - Icon = m?.Icon ?? FontAwesome.fa_question, + Icon = (mod != null) ? mod.Icon : FontAwesome.fa_question, }, }; @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.UI modIcon.TextSize = iconSize - 35; } - private Color4 pickColour(Mod mod) + private Color4 getBackgroundColourFromMod(Mod mod) { switch (mod?.Type) { diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 5806a12ac9..2fed50c9ce 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -7,6 +7,8 @@ using osu.Game.Rulesets.UI; using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; +using System.Collections.Generic; +using osu.Framework.Configuration; namespace osu.Game.Screens.Play { @@ -14,15 +16,23 @@ namespace osu.Game.Screens.Play { private readonly FillFlowContainer iconsContainer; + public readonly Bindable> Mods = new Bindable>(); + private bool showMods; public bool ShowMods { + get + { + return showMods; + } set { showMods = value; - if (!showMods) Hide(); + if (!showMods) + Hide(); + else + Show(); } - get { return showMods; } } public ModsContainer() @@ -46,20 +56,19 @@ namespace osu.Game.Screens.Play TextSize = 12, } }; - } - public void Add(Mod mod) - { - iconsContainer.Add(new ModIcon(mod) + Mods.ValueChanged += mods => { - AutoSizeAxes = Axes.Both, - Scale = new Vector2(0.7f), - }); - } - - public void Clear() - { - iconsContainer.Clear(); + iconsContainer.Clear(); + foreach (Mod mod in mods) + { + iconsContainer.Add(new ModIcon(mod) + { + AutoSizeAxes = Axes.Both, + Scale = new Vector2(0.7f), + }); + } + }; } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 948594235f..783533e8cd 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -170,8 +170,7 @@ namespace osu.Game.Screens.Play hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos); hudOverlay.ModsContainer.ShowMods = HitRenderer.HasReplayLoaded; - foreach (var mod in Beatmap.Mods.Value) - hudOverlay.ModsContainer.Add(mod); + hudOverlay.ModsContainer.Mods.BindTo(Beatmap.Mods); //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) HitRenderer.OnAllJudged += onCompletion; From 98b3b82c07c787ecd6ed677f2bd6b3158337813f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 May 2017 23:32:27 +0900 Subject: [PATCH 44/57] Apply CI fixes. --- osu.Game/Overlays/Options/OptionCheckbox.cs | 6 ------ osu.Game/Overlays/Options/OptionDropdown.cs | 5 ----- osu.Game/Overlays/Options/OptionItem.cs | 12 +++++------- osu.Game/Overlays/Options/OptionLabel.cs | 2 -- osu.Game/Overlays/Options/OptionSlider.cs | 4 ---- osu.Game/Overlays/Options/OptionTextBox.cs | 1 - .../Options/Sections/Audio/MainMenuOptions.cs | 1 - .../Options/Sections/Debug/GeneralOptions.cs | 1 - .../Options/Sections/Gameplay/GeneralOptions.cs | 1 - .../Options/Sections/General/LanguageOptions.cs | 1 - .../Options/Sections/Graphics/DetailOptions.cs | 1 - .../Options/Sections/Graphics/LayoutOptions.cs | 1 - .../Options/Sections/Graphics/MainMenuOptions.cs | 1 - .../Options/Sections/Graphics/RendererOptions.cs | 1 - 14 files changed, 5 insertions(+), 33 deletions(-) diff --git a/osu.Game/Overlays/Options/OptionCheckbox.cs b/osu.Game/Overlays/Options/OptionCheckbox.cs index 4aca15e3b9..de7b138c3c 100644 --- a/osu.Game/Overlays/Options/OptionCheckbox.cs +++ b/osu.Game/Overlays/Options/OptionCheckbox.cs @@ -1,13 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -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.UserInterface; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options diff --git a/osu.Game/Overlays/Options/OptionDropdown.cs b/osu.Game/Overlays/Options/OptionDropdown.cs index bb2875f9d8..1427eafe39 100644 --- a/osu.Game/Overlays/Options/OptionDropdown.cs +++ b/osu.Game/Overlays/Options/OptionDropdown.cs @@ -1,15 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; -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.UserInterface; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options diff --git a/osu.Game/Overlays/Options/OptionItem.cs b/osu.Game/Overlays/Options/OptionItem.cs index c5b0e08ec0..c09eba7f11 100644 --- a/osu.Game/Overlays/Options/OptionItem.cs +++ b/osu.Game/Overlays/Options/OptionItem.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -9,7 +8,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.Options @@ -18,9 +16,9 @@ namespace osu.Game.Overlays.Options { protected abstract Drawable CreateControl(); - protected Drawable Control { get; private set; } + protected Drawable Control { get; } - private IHasCurrentValue ControlWithCurrent => Control as IHasCurrentValue; + private IHasCurrentValue controlWithCurrent => Control as IHasCurrentValue; private SpriteText text; @@ -67,7 +65,7 @@ namespace osu.Game.Overlays.Options } } - public OptionItem() + protected OptionItem() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; @@ -75,8 +73,8 @@ namespace osu.Game.Overlays.Options if ((Control = CreateControl()) != null) { - if (ControlWithCurrent != null) - ControlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; }; + if (controlWithCurrent != null) + controlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; }; Add(Control); } } diff --git a/osu.Game/Overlays/Options/OptionLabel.cs b/osu.Game/Overlays/Options/OptionLabel.cs index 03b9a19ef4..3f3c569f3a 100644 --- a/osu.Game/Overlays/Options/OptionLabel.cs +++ b/osu.Game/Overlays/Options/OptionLabel.cs @@ -1,11 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.Options { diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 367bacb7c2..2cceb085a7 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -1,13 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -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.UserInterface; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options diff --git a/osu.Game/Overlays/Options/OptionTextBox.cs b/osu.Game/Overlays/Options/OptionTextBox.cs index 3d52eb67d0..498f27796a 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options diff --git a/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs index d8731ff2d7..b2d1235b97 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/MainMenuOptions.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Audio { diff --git a/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs b/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs index b87681a014..9258b8fbeb 100644 --- a/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Debug { diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs index 92ea3442d2..2598d95949 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Gameplay { diff --git a/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs b/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs index 921470aab1..2778f2567d 100644 --- a/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.General { diff --git a/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs index 80bbd1caad..6503a7ea90 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/DetailOptions.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Graphics { diff --git a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs index 36590045c6..1b4b0b3c7d 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Graphics { diff --git a/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs index 005573414b..6ebb8f263d 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/MainMenuOptions.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Graphics { diff --git a/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs index 3e6001c985..f11c18d3b4 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Graphics { From 95f6c999bdbb56ae4daf9d489c088eb7ee30e3de Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 4 May 2017 17:59:01 +0300 Subject: [PATCH 45/57] Adjust scale and CI fixes --- .../Tests/TestCaseIngameModsContainer.cs | 15 +++------------ .../Tests/TestCaseModSelectOverlay.cs | 8 ++++---- osu.Game/Screens/Play/ModsContainer.cs | 6 +++--- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs index e9b8df2d1b..c90be74bd7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs @@ -1,18 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Testing; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Sprites; -using osu.Game.Screens.Menu; -using OpenTK.Graphics; -using osu.Game.Screens.Play; -using osu.Framework.Allocation; -using osu.Game.Overlays.Mods; -using osu.Game.Database; -using osu.Game.Rulesets.Mods; using OpenTK; +using osu.Framework.Graphics; +using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests { @@ -34,7 +25,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(0, 25), }); - modsContainer.Mods.BindTo(modSelect.SelectedMods); + modsContainer.Mods.BindTo(ModSelect.SelectedMods); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index 0f85a8ab76..5c1750679a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -13,7 +13,7 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests the mod select overlay"; - protected ModSelectOverlay modSelect; + protected ModSelectOverlay ModSelect; private RulesetDatabase rulesets; [BackgroundDependencyLoader] @@ -26,17 +26,17 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - Add(modSelect = new ModSelectOverlay + Add(ModSelect = new ModSelectOverlay { RelativeSizeAxes = Axes.X, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, }); - AddStep("Toggle", modSelect.ToggleVisibility); + AddStep("Toggle", ModSelect.ToggleVisibility); foreach (var ruleset in rulesets.AllRulesets) - AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset); + AddStep(ruleset.CreateInstance().Description, () => ModSelect.Ruleset.Value = ruleset); } } } diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 2fed50c9ce..f5d48fef69 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -14,8 +14,6 @@ namespace osu.Game.Screens.Play { public class ModsContainer : Container { - private readonly FillFlowContainer iconsContainer; - public readonly Bindable> Mods = new Bindable>(); private bool showMods; @@ -37,6 +35,8 @@ namespace osu.Game.Screens.Play public ModsContainer() { + FillFlowContainer iconsContainer; + Children = new Drawable[] { iconsContainer = new FillFlowContainer @@ -65,7 +65,7 @@ namespace osu.Game.Screens.Play iconsContainer.Add(new ModIcon(mod) { AutoSizeAxes = Axes.Both, - Scale = new Vector2(0.7f), + Scale = new Vector2(0.65f), }); } }; From 6298b3effd26679001f34c5fb4290cdefee76b5f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 May 2017 12:16:41 +0900 Subject: [PATCH 46/57] Refactor ModSection and ModIcon to avoid null mods. --- osu.Game/Overlays/Mods/ModButton.cs | 18 +++---- osu.Game/Overlays/Mods/ModButtonEmpty.cs | 23 +++++++++ osu.Game/Overlays/Mods/ModSection.cs | 55 +++++++++++++--------- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 13 ++--- osu.Game/Rulesets/UI/ModIcon.cs | 9 ++-- osu.Game/osu.Game.csproj | 1 + 6 files changed, 76 insertions(+), 43 deletions(-) create mode 100644 osu.Game/Overlays/Mods/ModButtonEmpty.cs diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index e3d26cba06..b07bb7d2fb 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -19,7 +19,11 @@ using System.Linq; namespace osu.Game.Overlays.Mods { - public class ModButton : FillFlowContainer + + /// + /// Represents a clickable button which can cycle through one of more mods. + /// + public class ModButton : ModButtonEmpty { private ModIcon foregroundIcon { get; set; } private readonly SpriteText text; @@ -116,7 +120,7 @@ namespace osu.Game.Overlays.Mods // the mods from Mod, only multiple if Mod is a MultiMod - public Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); + public override Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); [BackgroundDependencyLoader] private void load(AudioManager audio) @@ -198,13 +202,8 @@ namespace osu.Game.Overlays.Mods buttonColour = foregroundIcon.Colour; } - public ModButton(Mod m) + public ModButton(Mod mod) { - Direction = FillDirection.Vertical; - Spacing = new Vector2(0f, -5f); - Size = new Vector2(100f); - AlwaysPresent = true; - Children = new Drawable[] { new Container @@ -224,13 +223,14 @@ namespace osu.Game.Overlays.Mods }, text = new OsuSpriteText { + Y = 75, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, TextSize = 18, }, }; - Mod = m; + Mod = mod; } } } diff --git a/osu.Game/Overlays/Mods/ModButtonEmpty.cs b/osu.Game/Overlays/Mods/ModButtonEmpty.cs new file mode 100644 index 0000000000..638c2a0e47 --- /dev/null +++ b/osu.Game/Overlays/Mods/ModButtonEmpty.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Overlays.Mods +{ + /// + /// A mod button used exclusively for providing an empty space the size of a mod button. + /// + public class ModButtonEmpty : Container + { + public virtual Mod SelectedMod => null; + + public ModButtonEmpty() + { + Size = new Vector2(100f); + AlwaysPresent = true; + } + } +} diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index b70323fb63..40bd1e8b07 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -11,6 +11,8 @@ using osu.Framework.Input; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mods; using System; +using System.Linq; +using System.Collections.Generic; namespace osu.Game.Overlays.Mods { @@ -18,7 +20,7 @@ namespace osu.Game.Overlays.Mods { private readonly OsuSpriteText headerLabel; - public FillFlowContainer ButtonsContainer { get; } + public FillFlowContainer ButtonsContainer { get; } public Action Action; protected abstract Key[] ToggleKeys { get; } @@ -36,28 +38,31 @@ namespace osu.Game.Overlays.Mods } } - private ModButton[] buttons = { }; - public ModButton[] Buttons + public IEnumerable SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null); + + public IEnumerable Mods { - get - { - return buttons; - } set { - if (value == buttons) return; - buttons = value; - - foreach (ModButton button in value) + var modContainers = value.Select(m => { - button.SelectedColour = selectedColour; - button.Action = Action; - } + if (m == null) + return new ModButtonEmpty(); + else + return new ModButton(m) + { + SelectedColour = selectedColour, + Action = Action, + }; + }).ToArray(); - ButtonsContainer.Children = value; + ButtonsContainer.Children = modContainers; + buttons = modContainers.OfType().ToArray(); } } + private ModButton[] buttons = { }; + private Color4 selectedColour = Color4.White; public Color4 SelectedColour { @@ -71,17 +76,15 @@ namespace osu.Game.Overlays.Mods selectedColour = value; foreach (ModButton button in buttons) - { button.SelectedColour = value; - } } } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { var index = Array.IndexOf(ToggleKeys, args.Key); - if (index > -1 && index < Buttons.Length) - Buttons[index].SelectNext(); + if (index > -1 && index < buttons.Length) + buttons[index].SelectNext(); return base.OnKeyDown(state, args); } @@ -89,8 +92,18 @@ namespace osu.Game.Overlays.Mods public void DeselectAll() { foreach (ModButton button in buttons) - { button.Deselect(); + } + + public void DeselectTypes(Type[] modTypes) + { + foreach (var button in buttons) + { + Mod selected = button.SelectedMod; + if (selected == null) continue; + foreach (Type type in modTypes) + if (type.IsInstanceOfType(selected)) + button.Deselect(); } } @@ -107,7 +120,7 @@ namespace osu.Game.Overlays.Mods Position = new Vector2(0f, 0f), Font = @"Exo2.0-Bold" }, - ButtonsContainer = new FillFlowContainer + ButtonsContainer = new FillFlowContainer { AutoSizeAxes = Axes.Both, Origin = Anchor.BottomLeft, diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index dadfb808f7..2840ffd1e4 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Mods var instance = newRuleset.CreateInstance(); foreach (ModSection section in modSectionsContainer.Children) - section.Buttons = instance.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); + section.Mods = instance.GetModsFor(section.ModType); refreshSelectedMods(); } @@ -103,14 +103,7 @@ namespace osu.Game.Overlays.Mods { if (modTypes.Length == 0) return; foreach (ModSection section in modSectionsContainer.Children) - foreach (ModButton button in section.Buttons) - { - Mod selected = button.SelectedMod; - if (selected == null) continue; - foreach (Type type in modTypes) - if (type.IsInstanceOfType(selected)) - button.Deselect(); - } + section.DeselectTypes(modTypes); } private void modButtonPressed(Mod selectedMod) @@ -122,7 +115,7 @@ namespace osu.Game.Overlays.Mods private void refreshSelectedMods() { - SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray(); + SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); double multiplier = 1.0; bool ranked = true; diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 19efdb0175..497c71f0d5 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -42,6 +43,8 @@ namespace osu.Game.Rulesets.UI public ModIcon(Mod mod) { + if (mod == null) throw new ArgumentNullException(nameof(mod)); + Children = new Drawable[] { background = new TextAwesome @@ -59,7 +62,7 @@ namespace osu.Game.Rulesets.UI Anchor = Anchor.Centre, Colour = OsuColour.Gray(84), TextSize = 20, - Icon = (mod != null) ? mod.Icon : FontAwesome.fa_question, + Icon = mod.Icon }, }; @@ -74,7 +77,7 @@ namespace osu.Game.Rulesets.UI private Color4 getBackgroundColourFromMod(Mod mod) { - switch (mod?.Type) + switch (mod.Type) { case ModType.DifficultyIncrease: return OsuColour.FromHex(@"ffcc22"); @@ -87,4 +90,4 @@ namespace osu.Game.Rulesets.UI } } } -} \ No newline at end of file +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 98f9a8a52b..c06ba0b1ea 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -391,6 +391,7 @@ + From c9ba1ac4f6998921aa2e70223113cddcf1a18fff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 May 2017 13:00:05 +0900 Subject: [PATCH 47/57] Adjust namespaces. Also adds transition, uses IHasCurrentValue, combines Mod TestCases and more. --- .../Tests/TestCaseIngameModsContainer.cs | 31 ------ ...aseModSelectOverlay.cs => TestCaseMods.cs} | 27 ++++- .../Tests/TestCaseScoreCounter.cs | 2 +- .../osu.Desktop.VisualTests.csproj | 3 +- .../UI => Screens/Play/HUD}/ComboCounter.cs | 2 +- .../Play/HUD}/ComboResultCounter.cs | 4 +- .../UI => Screens/Play/HUD}/HealthDisplay.cs | 2 +- osu.Game/Screens/Play/HUD/ModDisplay.cs | 105 ++++++++++++++++++ .../Play/HUD}/StandardComboCounter.cs | 2 +- .../Play/HUD}/StandardHealthDisplay.cs | 8 +- .../Play/HUDOverlay.cs} | 21 ++-- osu.Game/Screens/Play/ModsContainer.cs | 74 ------------ osu.Game/Screens/Play/Player.cs | 8 +- .../UI => Screens/Play}/StandardHudOverlay.cs | 12 +- osu.Game/osu.Game.csproj | 16 +-- osu.sln.DotSettings | 1 + 16 files changed, 167 insertions(+), 151 deletions(-) delete mode 100644 osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs rename osu.Desktop.VisualTests/Tests/{TestCaseModSelectOverlay.cs => TestCaseMods.cs} (54%) rename osu.Game/{Rulesets/UI => Screens/Play/HUD}/ComboCounter.cs (96%) rename osu.Game/{Rulesets/UI => Screens/Play/HUD}/ComboResultCounter.cs (95%) rename osu.Game/{Rulesets/UI => Screens/Play/HUD}/HealthDisplay.cs (91%) create mode 100644 osu.Game/Screens/Play/HUD/ModDisplay.cs rename osu.Game/{Rulesets/UI => Screens/Play/HUD}/StandardComboCounter.cs (96%) rename osu.Game/{Rulesets/UI => Screens/Play/HUD}/StandardHealthDisplay.cs (96%) rename osu.Game/{Rulesets/UI/HudOverlay.cs => Screens/Play/HUDOverlay.cs} (90%) delete mode 100644 osu.Game/Screens/Play/ModsContainer.cs rename osu.Game/{Rulesets/UI => Screens/Play}/StandardHudOverlay.cs (89%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs deleted file mode 100644 index c90be74bd7..0000000000 --- a/osu.Desktop.VisualTests/Tests/TestCaseIngameModsContainer.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK; -using osu.Framework.Graphics; -using osu.Game.Screens.Play; - -namespace osu.Desktop.VisualTests.Tests -{ - internal class TestCaseIngameModsContainer : TestCaseModSelectOverlay - { - public override string Description => @"Ingame mods visualization"; - - private ModsContainer modsContainer; - - public override void Reset() - { - base.Reset(); - - Add(modsContainer = new ModsContainer - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - Position = new Vector2(0, 25), - }); - - modsContainer.Mods.BindTo(ModSelect.SelectedMods); - } - } -} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseMods.cs similarity index 54% rename from osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs rename to osu.Desktop.VisualTests/Tests/TestCaseMods.cs index 5c1750679a..3f3a9d82f5 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMods.cs @@ -6,16 +6,21 @@ using osu.Framework.Graphics; using osu.Game.Overlays.Mods; using osu.Framework.Testing; using osu.Game.Database; +using osu.Game.Screens.Play.HUD; +using OpenTK; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseModSelectOverlay : TestCase + internal class TestCaseMods : TestCase { - public override string Description => @"Tests the mod select overlay"; + public override string Description => @"Mod select overlay and in-game display"; + + private ModSelectOverlay modSelect; + private ModDisplay modDisplay; - protected ModSelectOverlay ModSelect; private RulesetDatabase rulesets; + [BackgroundDependencyLoader] private void load(RulesetDatabase rulesets) { @@ -26,17 +31,27 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - Add(ModSelect = new ModSelectOverlay + Add(modSelect = new ModSelectOverlay { RelativeSizeAxes = Axes.X, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, }); - AddStep("Toggle", ModSelect.ToggleVisibility); + Add(modDisplay = new ModDisplay + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Position = new Vector2(0, 25), + }); + + modDisplay.Current.BindTo(modSelect.SelectedMods); + + AddStep("Toggle", modSelect.ToggleVisibility); foreach (var ruleset in rulesets.AllRulesets) - AddStep(ruleset.CreateInstance().Description, () => ModSelect.Ruleset.Value = ruleset); + AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index d8dac63980..cfa66f12ed 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; -using osu.Game.Rulesets.UI; +using osu.Game.Screens.Play.HUD; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index a9e1e27402..107072b3ea 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -190,7 +190,6 @@ - @@ -213,7 +212,7 @@ - + diff --git a/osu.Game/Rulesets/UI/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs similarity index 96% rename from osu.Game/Rulesets/UI/ComboCounter.cs rename to osu.Game/Screens/Play/HUD/ComboCounter.cs index d21059cbdb..a130bc2eab 100644 --- a/osu.Game/Rulesets/UI/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using osu.Game.Graphics.Sprites; -namespace osu.Game.Rulesets.UI +namespace osu.Game.Screens.Play.HUD { public abstract class ComboCounter : Container { diff --git a/osu.Game/Rulesets/UI/ComboResultCounter.cs b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs similarity index 95% rename from osu.Game/Rulesets/UI/ComboResultCounter.cs rename to osu.Game/Screens/Play/HUD/ComboResultCounter.cs index 4b19b2c1ff..a1a166f944 100644 --- a/osu.Game/Rulesets/UI/ComboResultCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs @@ -1,13 +1,13 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using osu.Game.Graphics.UserInterface; -using System; -namespace osu.Game.Rulesets.UI +namespace osu.Game.Screens.Play.HUD { /// /// Used to display combo with a roll-up animation in results screen. diff --git a/osu.Game/Rulesets/UI/HealthDisplay.cs b/osu.Game/Screens/Play/HUD/HealthDisplay.cs similarity index 91% rename from osu.Game/Rulesets/UI/HealthDisplay.cs rename to osu.Game/Screens/Play/HUD/HealthDisplay.cs index 5c6b9d2fe3..a146172085 100644 --- a/osu.Game/Rulesets/UI/HealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/HealthDisplay.cs @@ -4,7 +4,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics.Containers; -namespace osu.Game.Rulesets.UI +namespace osu.Game.Screens.Play.HUD { public abstract class HealthDisplay : Container { diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs new file mode 100644 index 0000000000..ece160e284 --- /dev/null +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -0,0 +1,105 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.UI; +using OpenTK; + +namespace osu.Game.Screens.Play.HUD +{ + public class ModDisplay : Container, IHasCurrentValue> + { + private readonly Bindable> mods = new Bindable>(); + + private bool showMods; + public bool ShowMods + { + get + { + return showMods; + } + set + { + showMods = value; + if (!showMods) + Hide(); + else + Show(); + } + } + + public Bindable> Current => mods; + + private readonly FillFlowContainer iconsContainer; + + public ModDisplay() + { + Children = new Drawable[] + { + iconsContainer = new IconFlow + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Margin = new MarginPadding { Left = 10, Right = 10 }, + }, + new OsuSpriteText + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + Text = @"/ UNRANKED /", + Font = @"Venera", + TextSize = 12, + } + }; + + mods.ValueChanged += mods => + { + iconsContainer.Clear(); + foreach (Mod mod in mods) + { + iconsContainer.Add(new ModIcon(mod) + { + AutoSizeAxes = Axes.Both, + Scale = new Vector2(0.6f), + + }); + } + + if (IsLoaded) + appearTransform(); + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + appearTransform(); + } + + private void appearTransform() + { + iconsContainer.Flush(); + iconsContainer.FadeInFromZero(1000, EasingTypes.OutQuint); + iconsContainer.TransformSpacingTo(new Vector2(5, 0)); + using (iconsContainer.BeginDelayedSequence(1200)) + iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, EasingTypes.OutQuint); + } + + private class IconFlow : FillFlowContainer + { + // just reverses the depth of flow contents. + protected override IComparer DepthComparer => new ReverseCreationOrderDepthComparer(); + protected override IEnumerable FlowingChildren => base.FlowingChildren.Reverse(); + } + } +} diff --git a/osu.Game/Rulesets/UI/StandardComboCounter.cs b/osu.Game/Screens/Play/HUD/StandardComboCounter.cs similarity index 96% rename from osu.Game/Rulesets/UI/StandardComboCounter.cs rename to osu.Game/Screens/Play/HUD/StandardComboCounter.cs index ad05c83839..525e52d207 100644 --- a/osu.Game/Rulesets/UI/StandardComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/StandardComboCounter.cs @@ -3,7 +3,7 @@ using OpenTK; -namespace osu.Game.Rulesets.UI +namespace osu.Game.Screens.Play.HUD { /// /// Uses the 'x' symbol and has a pop-out effect while rolling over. diff --git a/osu.Game/Rulesets/UI/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs similarity index 96% rename from osu.Game/Rulesets/UI/StandardHealthDisplay.cs rename to osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index 3d9a5489dc..7ba5dfe1b7 100644 --- a/osu.Game/Rulesets/UI/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -1,8 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; +using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -10,9 +9,10 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; -using System; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Game.Rulesets.UI +namespace osu.Game.Screens.Play.HUD { public class StandardHealthDisplay : HealthDisplay, IHasAccentColour { diff --git a/osu.Game/Rulesets/UI/HudOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs similarity index 90% rename from osu.Game/Rulesets/UI/HudOverlay.cs rename to osu.Game/Screens/Play/HUDOverlay.cs index 9bd900da4b..a9580df811 100644 --- a/osu.Game/Rulesets/UI/HudOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -5,18 +5,19 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Play; -using osu.Game.Rulesets.Scoring; -using osu.Framework.Input; -using OpenTK.Input; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; +using osu.Game.Screens.Play.HUD; +using OpenTK.Input; -namespace osu.Game.Rulesets.UI +namespace osu.Game.Screens.Play { - public abstract class HudOverlay : Container + public abstract class HUDOverlay : Container { private const int duration = 100; @@ -27,7 +28,7 @@ namespace osu.Game.Rulesets.UI public readonly RollingCounter AccuracyCounter; public readonly HealthDisplay HealthDisplay; public readonly SongProgress Progress; - public readonly ModsContainer ModsContainer; + public readonly ModDisplay ModDisplay; private Bindable showKeyCounter; private Bindable showHud; @@ -40,9 +41,9 @@ namespace osu.Game.Rulesets.UI protected abstract ScoreCounter CreateScoreCounter(); protected abstract HealthDisplay CreateHealthDisplay(); protected abstract SongProgress CreateProgress(); - protected abstract ModsContainer CreateModsContainer(); + protected abstract ModDisplay CreateModsContainer(); - protected HudOverlay() + protected HUDOverlay() { RelativeSizeAxes = Axes.Both; @@ -58,7 +59,7 @@ namespace osu.Game.Rulesets.UI AccuracyCounter = CreateAccuracyCounter(), HealthDisplay = CreateHealthDisplay(), Progress = CreateProgress(), - ModsContainer = CreateModsContainer(), + ModDisplay = CreateModsContainer(), } }); } diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs deleted file mode 100644 index f5d48fef69..0000000000 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.UI; -using osu.Framework.Graphics; -using osu.Game.Graphics.Sprites; -using OpenTK; -using System.Collections.Generic; -using osu.Framework.Configuration; - -namespace osu.Game.Screens.Play -{ - public class ModsContainer : Container - { - public readonly Bindable> Mods = new Bindable>(); - - private bool showMods; - public bool ShowMods - { - get - { - return showMods; - } - set - { - showMods = value; - if (!showMods) - Hide(); - else - Show(); - } - } - - public ModsContainer() - { - FillFlowContainer iconsContainer; - - Children = new Drawable[] - { - iconsContainer = new FillFlowContainer - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5,0), - }, - new OsuSpriteText - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.TopCentre, - Text = @"/ UNRANKED /", - Font = @"Venera", - TextSize = 12, - } - }; - - Mods.ValueChanged += mods => - { - iconsContainer.Clear(); - foreach (Mod mod in mods) - { - iconsContainer.Add(new ModIcon(mod) - { - AutoSizeAxes = Axes.Both, - Scale = new Vector2(0.65f), - }); - } - }; - } - } -} diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 783533e8cd..1ebd269cf5 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -72,7 +72,7 @@ namespace osu.Game.Screens.Play private Container hitRendererContainer; - private HudOverlay hudOverlay; + private HUDOverlay hudOverlay; private PauseOverlay pauseOverlay; private FailOverlay failOverlay; @@ -154,7 +154,7 @@ namespace osu.Game.Screens.Play scoreProcessor = HitRenderer.CreateScoreProcessor(); - hudOverlay = new StandardHudOverlay() + hudOverlay = new StandardHUDOverlay() { Anchor = Anchor.Centre, Origin = Anchor.Centre @@ -169,8 +169,8 @@ namespace osu.Game.Screens.Play hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos); - hudOverlay.ModsContainer.ShowMods = HitRenderer.HasReplayLoaded; - hudOverlay.ModsContainer.Mods.BindTo(Beatmap.Mods); + hudOverlay.ModDisplay.ShowMods = HitRenderer.HasReplayLoaded; + hudOverlay.ModDisplay.Current.BindTo(Beatmap.Mods); //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) HitRenderer.OnAllJudged += onCompletion; diff --git a/osu.Game/Rulesets/UI/StandardHudOverlay.cs b/osu.Game/Screens/Play/StandardHudOverlay.cs similarity index 89% rename from osu.Game/Rulesets/UI/StandardHudOverlay.cs rename to osu.Game/Screens/Play/StandardHudOverlay.cs index 709f8ef395..41f9ee1394 100644 --- a/osu.Game/Rulesets/UI/StandardHudOverlay.cs +++ b/osu.Game/Screens/Play/StandardHudOverlay.cs @@ -1,18 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Scoring; -using osu.Game.Screens.Play; +using osu.Game.Screens.Play.HUD; +using OpenTK; -namespace osu.Game.Rulesets.UI +namespace osu.Game.Screens.Play { - public class StandardHudOverlay : HudOverlay + public class StandardHUDOverlay : HUDOverlay { protected override RollingCounter CreateAccuracyCounter() => new PercentageCounter { @@ -64,12 +64,12 @@ namespace osu.Game.Rulesets.UI RelativeSizeAxes = Axes.X, }; - protected override ModsContainer CreateModsContainer() => new ModsContainer + protected override ModDisplay CreateModsContainer() => new ModDisplay { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, - Position = new Vector2(0, 25), + Margin = new MarginPadding { Top = 20, Right = 10 }, }; [BackgroundDependencyLoader] diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c06ba0b1ea..80c88d7a00 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -178,10 +178,9 @@ - - - - + + + @@ -228,8 +227,9 @@ - + + @@ -255,7 +255,7 @@ - + @@ -280,8 +280,8 @@ - - + + diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index bc2c347d0c..03d9e34805 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -182,6 +182,7 @@ GL GLSL HID + HUD ID IP IPC From b547dd6893571aabb50cda450328535eb3e0ee82 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 May 2017 13:06:54 +0900 Subject: [PATCH 48/57] CI Fixes. --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 2 +- .../Play/{StandardHudOverlay.cs => StandardHUDOverlay.cs} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename osu.Game/Screens/Play/{StandardHudOverlay.cs => StandardHUDOverlay.cs} (100%) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index ece160e284..6135106cf7 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -71,7 +71,7 @@ namespace osu.Game.Screens.Play.HUD { AutoSizeAxes = Axes.Both, Scale = new Vector2(0.6f), - + }); } diff --git a/osu.Game/Screens/Play/StandardHudOverlay.cs b/osu.Game/Screens/Play/StandardHUDOverlay.cs similarity index 100% rename from osu.Game/Screens/Play/StandardHudOverlay.cs rename to osu.Game/Screens/Play/StandardHUDOverlay.cs From 9c4f813da1d06a47107e9b497394e65abb0ea20f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 May 2017 13:14:44 +0900 Subject: [PATCH 49/57] Remove unnecessary hide/show logic. Also change the way the overlay appears when actually playing. --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 17 ----------------- osu.Game/Screens/Play/Player.cs | 5 ++++- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 6135106cf7..a5d6bea1a5 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -19,23 +19,6 @@ namespace osu.Game.Screens.Play.HUD { private readonly Bindable> mods = new Bindable>(); - private bool showMods; - public bool ShowMods - { - get - { - return showMods; - } - set - { - showMods = value; - if (!showMods) - Hide(); - else - Show(); - } - } - public Bindable> Current => mods; private readonly FillFlowContainer iconsContainer; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 1ebd269cf5..22aa4d62c1 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -169,7 +169,6 @@ namespace osu.Game.Screens.Play hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos); - hudOverlay.ModDisplay.ShowMods = HitRenderer.HasReplayLoaded; hudOverlay.ModDisplay.Current.BindTo(Beatmap.Mods); //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) @@ -357,6 +356,10 @@ namespace osu.Game.Screens.Play hitRendererContainer.Alpha = 0; hitRendererContainer.FadeIn(750, EasingTypes.OutQuint); + + if (!HitRenderer.HasReplayLoaded) + using (hudOverlay.ModDisplay.BeginDelayedSequence(2000)) + hudOverlay.ModDisplay.FadeOut(200); } protected override void OnSuspending(Screen next) From 44f06e542321df9b274b95915468cd5473961ac2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 May 2017 13:17:36 +0900 Subject: [PATCH 50/57] Add hover expand support. --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index a5d6bea1a5..1b67d8dc66 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -12,6 +12,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using OpenTK; +using osu.Framework.Input; namespace osu.Game.Screens.Play.HUD { @@ -73,9 +74,25 @@ namespace osu.Game.Screens.Play.HUD { iconsContainer.Flush(); iconsContainer.FadeInFromZero(1000, EasingTypes.OutQuint); - iconsContainer.TransformSpacingTo(new Vector2(5, 0)); + expand(); using (iconsContainer.BeginDelayedSequence(1200)) - iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, EasingTypes.OutQuint); + contract(); + } + + private void expand() => iconsContainer.TransformSpacingTo(new Vector2(5, 0), 500, EasingTypes.OutQuint); + + private void contract() => iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, EasingTypes.OutQuint); + + protected override bool OnHover(InputState state) + { + expand(); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + contract(); + base.OnHoverLost(state); } private class IconFlow : FillFlowContainer From 4b385ded26218e0ee3459cd50d33d9ef2a067e11 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 May 2017 13:22:10 +0900 Subject: [PATCH 51/57] Tidy up ModIcon. --- osu.Game/Rulesets/UI/ModIcon.cs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 497c71f0d5..8bd852f2c0 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -15,19 +15,7 @@ namespace osu.Game.Rulesets.UI private readonly TextAwesome modIcon; private readonly TextAwesome background; - private float iconSize = 80; - public float IconSize - { - get - { - return iconSize; - } - set - { - iconSize = value; - reapplySize(); - } - } + private const float icon_size = 80; public new Color4 Colour { @@ -71,8 +59,8 @@ namespace osu.Game.Rulesets.UI private void reapplySize() { - background.TextSize = iconSize; - modIcon.TextSize = iconSize - 35; + background.TextSize = icon_size; + modIcon.TextSize = icon_size - 35; } private Color4 getBackgroundColourFromMod(Mod mod) From d129bd0c1fe1c931effb4fc5d2a0f5812cd18bf4 Mon Sep 17 00:00:00 2001 From: skettios Date: Fri, 5 May 2017 17:01:44 -0700 Subject: [PATCH 52/57] Fix ModSelectOverlay accepting escape when it shouldn't Because PlaySongSelect is suspending when selecting a song, we don't actually hide ModSelectOverlay. --- osu.Game/Screens/Select/PlaySongSelect.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index c15900eb6d..a8229bd012 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -69,6 +69,14 @@ namespace osu.Game.Screens.Select base.OnResuming(last); } + protected override void OnSuspending(Screen next) + { + if (modSelect.State == Visibility.Visible) + modSelect.Hide(); + + base.OnSuspending(next); + } + protected override bool OnExiting(Screen next) { if (modSelect.State == Visibility.Visible) From 36dff948020184ff1eeff20a773b7e98fda9342f Mon Sep 17 00:00:00 2001 From: skettios Date: Fri, 5 May 2017 18:16:48 -0700 Subject: [PATCH 53/57] removed check if ModSelectOverlay is open --- osu.Game/Screens/Select/PlaySongSelect.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index a8229bd012..315992c113 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -71,8 +71,7 @@ namespace osu.Game.Screens.Select protected override void OnSuspending(Screen next) { - if (modSelect.State == Visibility.Visible) - modSelect.Hide(); + modSelect.Hide(); base.OnSuspending(next); } From fbf05f12fc24522c2db333d0ac6e67b2238029c3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 8 May 2017 10:11:45 +0900 Subject: [PATCH 54/57] Use controlWithCurrent as per comment. --- osu.Game/Overlays/Options/OptionItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Options/OptionItem.cs b/osu.Game/Overlays/Options/OptionItem.cs index c09eba7f11..2124796089 100644 --- a/osu.Game/Overlays/Options/OptionItem.cs +++ b/osu.Game/Overlays/Options/OptionItem.cs @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Options set { bindable = value; - (Control as IHasCurrentValue)?.Current.BindTo(bindable); + controlWithCurrent?.Current.BindTo(bindable); } } From 2f4fad9d416ad0620b35f37ca59bf41559c22e38 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 8 May 2017 11:33:22 +0900 Subject: [PATCH 55/57] Refactor colour selection. --- osu.Game/Overlays/Mods/ModButton.cs | 10 +---- osu.Game/Rulesets/UI/ModIcon.cs | 68 +++++++++++++++++++---------- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index b07bb7d2fb..ce70144bc3 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -55,7 +55,7 @@ namespace osu.Game.Overlays.Mods iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic); iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic); - foregroundIcon.Colour = Selected ? SelectedColour : ButtonColour; + foregroundIcon.Highlighted = Selected; if (mod != null) displayMod(SelectedMod ?? Mods[0]); @@ -64,12 +64,6 @@ namespace osu.Game.Overlays.Mods public bool Selected => selectedIndex != -1; - private Color4 buttonColour; - public Color4 ButtonColour - { - get { return buttonColour; } - set { buttonColour = value; } - } private Color4 selectedColour; public Color4 SelectedColour @@ -198,8 +192,6 @@ namespace osu.Game.Overlays.Mods AutoSizeAxes = Axes.Both, }); } - - buttonColour = foregroundIcon.Colour; } public ModButton(Mod mod) diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 8bd852f2c0..957ffc18e4 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -3,6 +3,7 @@ using System; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; @@ -17,65 +18,86 @@ namespace osu.Game.Rulesets.UI private const float icon_size = 80; - public new Color4 Colour - { - get { return background.Colour; } - set { background.Colour = value; } - } - public FontAwesome Icon { get { return modIcon.Icon; } set { modIcon.Icon = value; } } + private ModType type; + public ModIcon(Mod mod) { if (mod == null) throw new ArgumentNullException(nameof(mod)); + type = mod.Type; + Children = new Drawable[] { background = new TextAwesome { Origin = Anchor.Centre, Anchor = Anchor.Centre, + TextSize = icon_size, Icon = FontAwesome.fa_osu_mod_bg, - Colour = getBackgroundColourFromMod(mod), Shadow = true, - TextSize = 20 }, modIcon = new TextAwesome { Origin = Anchor.Centre, Anchor = Anchor.Centre, Colour = OsuColour.Gray(84), - TextSize = 20, + TextSize = icon_size - 35, Icon = mod.Icon }, }; - - reapplySize(); } - private void reapplySize() - { - background.TextSize = icon_size; - modIcon.TextSize = icon_size - 35; - } + private Color4 backgroundColour; + private Color4 highlightedColour; - private Color4 getBackgroundColourFromMod(Mod mod) + [BackgroundDependencyLoader] + private void load(OsuColour colours) { - switch (mod.Type) + switch (type) { + default: case ModType.DifficultyIncrease: - return OsuColour.FromHex(@"ffcc22"); + backgroundColour = colours.Yellow; + highlightedColour = colours.YellowLight; + break; case ModType.DifficultyReduction: - return OsuColour.FromHex(@"88b300"); + backgroundColour = colours.Green; + highlightedColour = colours.GreenLight; + break; case ModType.Special: - return OsuColour.FromHex(@"66ccff"); - - default: return Color4.White; + backgroundColour = colours.Blue; + highlightedColour = colours.BlueLight; + break; } + + applyStyle(); + } + + private bool highlighted; + + public bool Highlighted + { + get + { + return highlighted; + } + + set + { + highlighted = value; + applyStyle(); + } + } + + private void applyStyle() + { + background.Colour = highlighted ? highlightedColour : backgroundColour; } } } From 10910cfcef699659e158017f952410e22b1dc44b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 8 May 2017 11:47:06 +0900 Subject: [PATCH 56/57] Make field readonly. --- osu.Game/Rulesets/UI/ModIcon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 957ffc18e4..b23028098f 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.UI set { modIcon.Icon = value; } } - private ModType type; + private readonly ModType type; public ModIcon(Mod mod) { From 48368779ab65e0793c854926727708b585477cd1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 8 May 2017 11:48:40 +0900 Subject: [PATCH 57/57] Avoid polluting Player with HUD-specific code. --- osu.Game/Screens/Play/HUDOverlay.cs | 5 +++++ osu.Game/Screens/Play/Player.cs | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index a9580df811..12e2cb197e 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -109,6 +109,11 @@ namespace osu.Game.Screens.Play public virtual void BindHitRenderer(HitRenderer hitRenderer) { hitRenderer.InputManager.Add(KeyCounter.GetReceptor()); + + // in the case a replay isn't loaded, we want some elements to only appear briefly. + if (!hitRenderer.HasReplayLoaded) + using (ModDisplay.BeginDelayedSequence(2000)) + ModDisplay.FadeOut(200); } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 22aa4d62c1..534a224855 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -356,10 +356,6 @@ namespace osu.Game.Screens.Play hitRendererContainer.Alpha = 0; hitRendererContainer.FadeIn(750, EasingTypes.OutQuint); - - if (!HitRenderer.HasReplayLoaded) - using (hudOverlay.ModDisplay.BeginDelayedSequence(2000)) - hudOverlay.ModDisplay.FadeOut(200); } protected override void OnSuspending(Screen next)