1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 22:27:25 +08:00

Merge remote-tracking branch 'ppy/master' into hud-mod-display

This commit is contained in:
Dean Herbert 2017-05-08 10:56:34 +09:00
commit df4a737c9b
20 changed files with 217 additions and 195 deletions

40
.vscode/launch.json vendored
View File

@ -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"
}
]
}

77
.vscode/tasks.json vendored
View File

@ -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"
]
}
]
}

View File

@ -0,0 +1,21 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class OptionCheckbox : OptionItem<bool>
{
private OsuCheckbox checkbox;
protected override Drawable CreateControl() => checkbox = new OsuCheckbox();
public override string LabelText
{
get { return checkbox.LabelText; }
set { checkbox.LabelText = value; }
}
}
}

View File

@ -2,45 +2,18 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
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
{
public class OptionDropdown<T> : FillFlowContainer
public class OptionDropdown<T> : OptionItem<T>
{
private readonly Dropdown<T> dropdown;
private readonly SpriteText text;
private Dropdown<T> dropdown;
public string LabelText
{
get { return text.Text; }
set
{
text.Text = value;
text.Alpha = !string.IsNullOrEmpty(value) ? 1 : 0;
}
}
public Bindable<T> Bindable
{
get { return bindable; }
set
{
bindable = value;
dropdown.Current.BindTo(bindable);
}
}
private Bindable<T> bindable;
private IEnumerable<KeyValuePair<string, T>> items;
private IEnumerable<KeyValuePair<string, T>> items = new KeyValuePair<string, T>[] { };
public IEnumerable<KeyValuePair<string, T>> Items
{
get
@ -55,30 +28,11 @@ namespace osu.Game.Overlays.Options
}
}
public OptionDropdown()
protected override Drawable CreateControl() => dropdown = new OsuDropdown<T>
{
Items = new KeyValuePair<string, T>[0];
Direction = FillDirection.Vertical;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Children = new Drawable[]
{
text = new OsuSpriteText {
Alpha = 0,
},
dropdown = new OsuDropdown<T>
{
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,
};
}
}

View File

@ -0,0 +1,82 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
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.Sprites;
namespace osu.Game.Overlays.Options
{
public abstract class OptionItem<T> : FillFlowContainer, IFilterable
{
protected abstract Drawable CreateControl();
protected Drawable Control { get; }
private IHasCurrentValue<T> controlWithCurrent => Control as IHasCurrentValue<T>;
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<T> bindable;
public Bindable<T> Bindable
{
get
{
return bindable;
}
set
{
bindable = value;
controlWithCurrent?.Current.BindTo(bindable);
}
}
public string[] FilterTerms => new[] { LabelText };
public bool MatchingCurrentFilter
{
set
{
// probably needs a better transition.
FadeTo(value ? 1 : 0);
}
}
protected 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);
}
}
}
}

View File

@ -2,13 +2,15 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Options
{
internal class OptionLabel : OsuSpriteText
internal class OptionLabel : OptionItem<string>
{
protected override Drawable CreateControl() => null;
[BackgroundDependencyLoader]
private void load(OsuColour colour)
{

View File

@ -1,13 +1,9 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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
@ -17,52 +13,14 @@ namespace osu.Game.Overlays.Options
{
}
public class OptionSlider<T, U> : FillFlowContainer
public class OptionSlider<T, U> : OptionItem<T>
where T : struct
where U : SliderBar<T>, new()
{
private readonly SliderBar<T> 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<T> bindable;
public Bindable<T> 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
};
}
}

View File

@ -1,22 +1,13 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class OptionTextBox : OsuTextBox
public class OptionTextBox : OptionItem<string>
{
private Bindable<string> bindable;
public Bindable<string> Bindable
{
set
{
bindable = value;
Current.BindTo(bindable);
}
}
protected override Drawable CreateControl() => new OsuTextBox();
}
}

View File

@ -3,7 +3,6 @@
using osu.Framework.Allocation;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options.Sections.Audio
{
@ -16,12 +15,12 @@ namespace osu.Game.Overlays.Options.Sections.Audio
{
Children = new[]
{
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Interface voices",
Bindable = config.GetBindable<bool>(OsuConfig.MenuVoice)
},
new OsuCheckbox
new OptionCheckbox
{
LabelText = "osu! music theme",
Bindable = config.GetBindable<bool>(OsuConfig.MenuMusic)
@ -29,4 +28,4 @@ namespace osu.Game.Overlays.Options.Sections.Audio
};
}
}
}
}

View File

@ -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
{
@ -17,7 +16,7 @@ namespace osu.Game.Overlays.Options.Sections.Debug
{
Children = new Drawable[]
{
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Bypass caching",
Bindable = config.GetBindable<bool>(FrameworkDebugConfig.BypassCaching)

View File

@ -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
{
@ -22,12 +21,12 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
LabelText = "Background dim",
Bindable = config.GetBindable<double>(OsuConfig.DimLevel)
},
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Show score overlay",
Bindable = config.GetBindable<bool>(OsuConfig.ShowInterface)
},
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Always show key overlay",
Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)

View File

@ -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
{
@ -17,7 +16,7 @@ namespace osu.Game.Overlays.Options.Sections.General
{
Children = new Drawable[]
{
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Prefer metadata in original language",
Bindable = frameworkConfig.GetBindable<bool>(FrameworkConfig.ShowUnicode)

View File

@ -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<bool>(OsuConfig.SaveUsername),
},
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Stay logged in",
Bindable = config.GetBindable<bool>(OsuConfig.SavePassword),

View File

@ -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
{
@ -17,12 +16,12 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
{
Children = new Drawable[]
{
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Snaking in sliders",
Bindable = config.GetBindable<bool>(OsuConfig.SnakingInSliders)
},
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Snaking out sliders",
Bindable = config.GetBindable<bool>(OsuConfig.SnakingOutSliders)
@ -30,4 +29,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
};
}
}
}
}

View File

@ -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
{
@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
LabelText = "Screen mode",
Bindable = config.GetBindable<WindowMode>(FrameworkConfig.WindowMode),
},
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Letterboxing",
Bindable = letterboxing,
@ -64,4 +63,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
}
}
}
}
}

View File

@ -3,7 +3,6 @@
using osu.Framework.Allocation;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options.Sections.Graphics
{
@ -16,7 +15,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
{
Children = new[]
{
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Parallax",
Bindable = config.GetBindable<bool>(OsuConfig.MenuParallax)
@ -24,4 +23,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
};
}
}
}
}

View File

@ -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
{
@ -25,7 +24,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
LabelText = "Frame limiter",
Bindable = config.GetBindable<FrameSync>(FrameworkConfig.FrameSync)
},
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Show FPS",
Bindable = osuConfig.GetBindable<bool>(OsuConfig.ShowFpsDisplay)
@ -33,4 +32,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
};
}
}
}
}

View File

@ -24,12 +24,12 @@ namespace osu.Game.Overlays.Options.Sections.Input
LabelText = "Confine mouse cursor",
Bindable = config.GetBindable<ConfineMouseMode>(FrameworkConfig.ConfineMouseMode),
},
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Disable mouse wheel during gameplay",
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableWheel)
},
new OsuCheckbox
new OptionCheckbox
{
LabelText = "Disable mouse buttons during gameplay",
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableButtons)

View File

@ -69,6 +69,13 @@ namespace osu.Game.Screens.Select
base.OnResuming(last);
}
protected override void OnSuspending(Screen next)
{
modSelect.Hide();
base.OnSuspending(next);
}
protected override bool OnExiting(Screen next)
{
if (modSelect.State == Visibility.Visible)

View File

@ -372,8 +372,10 @@
<Compile Include="Overlays\Options\Sections\SkinSection.cs" />
<Compile Include="Graphics\UserInterface\OsuCheckbox.cs" />
<Compile Include="Overlays\Options\SidebarButton.cs" />
<Compile Include="Overlays\Options\OptionCheckbox.cs" />
<Compile Include="Overlays\Options\OptionTextBox.cs" />
<Compile Include="Overlays\Options\OptionSlider.cs" />
<Compile Include="Overlays\Options\OptionItem.cs" />
<Compile Include="Overlays\Options\OptionEnumDropdown.cs" />
<Compile Include="Configuration\RankingType.cs" />
<Compile Include="Configuration\ScoreMeterType.cs" />