Merge branch 'master' into shuffle-skin

This commit is contained in:
Dean Herbert
2019-07-29 01:55:57 +09:00
committed by GitHub
1817 changed files with 58682 additions and 24104 deletions

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Graphics;

View File

@ -1,7 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Configuration;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Configuration;
@ -9,7 +10,7 @@ namespace osu.Game.Overlays.Settings
{
/// <summary>
/// A <see cref="SettingsSubsection"/> which provides subclasses with the <see cref="IRulesetConfigManager"/>
/// from the <see cref="Ruleset"/>'s <see cref="Ruleset.CreateConfig()"/>.
/// from the <see cref="Ruleset"/>'s <see cref="Ruleset.CreateConfig(SettingsStore)"/>.
/// </summary>
public abstract class RulesetSettingsSubsection : SettingsSubsection
{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Audio;
@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
private class AudioDeviceSettingsDropdown : SettingsDropdown<string>
{
protected override OsuDropdown<string> CreateDropdown() => new AudioDeviceDropdownControl { Items = Items };
protected override OsuDropdown<string> CreateDropdown() => new AudioDeviceDropdownControl();
private class AudioDeviceDropdownControl : DropdownControl
{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Configuration;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Audio;

View File

@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Settings.Sections.Audio;
namespace osu.Game.Overlays.Settings.Sections
@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections
public class AudioSection : SettingsSection
{
public override string Header => "Audio";
public override FontAwesome Icon => FontAwesome.fa_volume_up;
public override IconUsage Icon => FontAwesome.Solid.VolumeUp;
public AudioSection()
{

View File

@ -1,8 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Runtime;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -13,37 +12,17 @@ namespace osu.Game.Overlays.Settings.Sections.Debug
{
protected override string Header => "Garbage Collector";
private readonly Bindable<LatencyMode> latencyMode = new Bindable<LatencyMode>();
private Bindable<GCLatencyMode> configLatencyMode;
[BackgroundDependencyLoader]
private void load(FrameworkDebugConfigManager config)
{
Children = new Drawable[]
{
new SettingsEnumDropdown<LatencyMode>
{
LabelText = "Active mode",
Bindable = latencyMode
},
new SettingsButton
{
Text = "Force garbage collection",
Action = GC.Collect
},
};
configLatencyMode = config.GetBindable<GCLatencyMode>(DebugSetting.ActiveGCMode);
configLatencyMode.BindValueChanged(v => latencyMode.Value = (LatencyMode)v, true);
latencyMode.BindValueChanged(v => configLatencyMode.Value = (GCLatencyMode)v);
}
private enum LatencyMode
{
Batch = GCLatencyMode.Batch,
Interactive = GCLatencyMode.Interactive,
LowLatency = GCLatencyMode.LowLatency,
SustainedLowLatency = GCLatencyMode.SustainedLowLatency
}
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
@ -31,6 +31,11 @@ namespace osu.Game.Overlays.Settings.Sections.Debug
LabelText = "Bypass caching (slow)",
Bindable = config.GetBindable<bool>(DebugSetting.BypassCaching)
},
new SettingsCheckbox
{
LabelText = "Bypass front-to-back render pass",
Bindable = config.GetBindable<bool>(DebugSetting.BypassFrontToBackPass)
}
};
}
}

View File

@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Settings.Sections.Debug;
namespace osu.Game.Overlays.Settings.Sections
@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections
public class DebugSection : SettingsSection
{
public override string Header => "Debug";
public override FontAwesome Icon => FontAwesome.fa_bug;
public override IconUsage Icon => FontAwesome.Solid.Bug;
public DebugSection()
{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -35,6 +35,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
Bindable = config.GetBindable<bool>(OsuSetting.ShowInterface)
},
new SettingsCheckbox
{
LabelText = "Show health display even when you can't fail",
Bindable = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
},
new SettingsCheckbox
{
LabelText = "Always show key overlay",
Bindable = config.GetBindable<bool>(OsuSetting.KeyOverlay)

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Configuration;
@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
{
new SettingsCheckbox
{
LabelText = "Increase visibility of first object with \"Hidden\" mod",
LabelText = "Increase visibility of first object when visual impairment mods are enabled",
Bindable = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility)
},
};

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;

View File

@ -1,19 +1,19 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Overlays.Settings.Sections.Gameplay;
using osu.Game.Rulesets;
using System.Linq;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Settings.Sections
{
public class GameplaySection : SettingsSection
{
public override string Header => "Gameplay";
public override FontAwesome Icon => FontAwesome.fa_circle_o;
public override IconUsage Icon => FontAwesome.Regular.Circle;
public GameplaySection()
{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
@ -16,7 +16,10 @@ using System.ComponentModel;
using osu.Game.Graphics;
using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Containers;
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
using Container = osu.Framework.Graphics.Containers.Container;
@ -40,7 +43,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
public bool Bounding
{
get { return bounding; }
get => bounding;
set
{
bounding = value;
@ -57,14 +60,14 @@ namespace osu.Game.Overlays.Settings.Sections.General
}
[BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, APIAccess api)
private void load(OsuColour colours, IAPIProvider api)
{
this.colours = colours;
api?.Register(this);
}
public void APIStateChanged(APIAccess api, APIState state)
public void APIStateChanged(IAPIProvider api, APIState state)
{
form = null;
@ -77,32 +80,41 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
Text = "ACCOUNT",
Margin = new MarginPadding { Bottom = 5 },
Font = @"Exo2.0-Black",
Font = OsuFont.GetFont(weight: FontWeight.Black),
},
form = new LoginForm()
form = new LoginForm
{
RequestHide = RequestHide
}
};
break;
case APIState.Failing:
Children = new Drawable[]
{
new OsuSpriteText
{
Text = "Connection failing :(",
},
};
break;
case APIState.Connecting:
LinkFlowContainer linkFlow;
Children = new Drawable[]
{
new OsuSpriteText
new LoadingAnimation
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Connecting...",
State = { Value = Visibility.Visible },
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
linkFlow = new LinkFlowContainer
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextAnchor = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
Text = state == APIState.Failing ? "Connection is failing, will attempt to reconnect... " : "Attempting to connect... ",
Margin = new MarginPadding { Top = 10, Bottom = 10 },
},
};
linkFlow.AddLink("cancel", api.Logout, string.Empty);
break;
case APIState.Online:
Children = new Drawable[]
{
@ -126,8 +138,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Signed in",
TextSize = 18,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
Margin = new MarginPadding { Top = 5, Bottom = 5 },
},
},
@ -143,30 +154,32 @@ namespace osu.Game.Overlays.Settings.Sections.General
};
panel.Status.BindTo(api.LocalUser.Value.Status);
panel.Activity.BindTo(api.LocalUser.Value.Activity);
dropdown.Current.ValueChanged += newValue =>
dropdown.Current.BindValueChanged(action =>
{
switch (newValue)
switch (action.NewValue)
{
case UserAction.Online:
api.LocalUser.Value.Status.Value = new UserStatusOnline();
dropdown.StatusColour = colours.Green;
break;
case UserAction.DoNotDisturb:
api.LocalUser.Value.Status.Value = new UserStatusDoNotDisturb();
dropdown.StatusColour = colours.Red;
break;
case UserAction.AppearOffline:
api.LocalUser.Value.Status.Value = new UserStatusOffline();
dropdown.StatusColour = colours.Gray7;
break;
case UserAction.SignOut:
api.Logout();
break;
}
};
dropdown.Current.TriggerChange();
}, true);
break;
}
@ -187,7 +200,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
private TextBox username;
private TextBox password;
private APIAccess api;
private IAPIProvider api;
public Action RequestHide;
private void performLogin()
{
@ -196,7 +211,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
}
[BackgroundDependencyLoader(permitNulls: true)]
private void load(APIAccess api, OsuConfigManager config)
private void load(IAPIProvider api, OsuConfigManager config, AccountCreationOverlay accountCreation)
{
this.api = api;
Direction = FillDirection.Vertical;
@ -207,14 +222,14 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
username = new OsuTextBox
{
PlaceholderText = "Email address",
PlaceholderText = "email address",
RelativeSizeAxes = Axes.X,
Text = api?.ProvidedUsername ?? string.Empty,
TabbableContentContainer = this
},
password = new OsuPasswordTextBox
{
PlaceholderText = "Password",
PlaceholderText = "password",
RelativeSizeAxes = Axes.X,
TabbableContentContainer = this,
OnCommit = (sender, newText) => performLogin()
@ -237,7 +252,11 @@ namespace osu.Game.Overlays.Settings.Sections.General
new SettingsButton
{
Text = "Register",
//Action = registerLink
Action = () =>
{
RequestHide();
accountCreation.Show();
}
}
};
}
@ -264,6 +283,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
var h = Header as UserDropdownHeader;
if (h == null) return;
h.StatusColour = value;
}
}
@ -299,7 +319,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
BackgroundColour = colours.Gray3;
}
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableUserDropdownMenuItem(item);
protected override DrawableDropdownMenuItem CreateDrawableDropdownMenuItem(MenuItem item) => new DrawableUserDropdownMenuItem(item);
private class DrawableUserDropdownMenuItem : DrawableOsuDropdownMenuItem
{
@ -322,12 +342,10 @@ namespace osu.Game.Overlays.Settings.Sections.General
public const float LABEL_LEFT_MARGIN = 20;
private readonly SpriteIcon statusIcon;
public Color4 StatusColour
{
set
{
statusIcon.FadeColour(value, 500, Easing.OutQuint);
}
set => statusIcon.FadeColour(value, 500, Easing.OutQuint);
}
public UserDropdownHeader()
@ -350,7 +368,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Icon = FontAwesome.fa_circle_o,
Icon = FontAwesome.Regular.Circle,
Size = new Vector2(14),
});
@ -368,10 +386,13 @@ namespace osu.Game.Overlays.Settings.Sections.General
private enum UserAction
{
Online,
[Description(@"Do not disturb")]
DoNotDisturb,
[Description(@"Appear offline")]
AppearOffline,
[Description(@"Sign out")]
SignOut,
}

View File

@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Game.Configuration;
@ -15,19 +15,20 @@ namespace osu.Game.Overlays.Settings.Sections.General
[BackgroundDependencyLoader]
private void load(Storage storage, OsuConfigManager config)
{
Children = new Drawable[]
Add(new SettingsEnumDropdown<ReleaseStream>
{
new SettingsEnumDropdown<ReleaseStream>
{
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
},
new SettingsButton
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
});
if (RuntimeInfo.IsDesktop)
{
Add(new SettingsButton
{
Text = "Open osu! folder",
Action = storage.OpenInNativeExplorer,
}
};
});
}
}
}
}

View File

@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Settings.Sections.General;
namespace osu.Game.Overlays.Settings.Sections
@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections
public class GeneralSection : SettingsSection
{
public override string Header => "General";
public override FontAwesome Icon => FontAwesome.fa_gear;
public override IconUsage Icon => FontAwesome.Solid.Cog;
public GeneralSection()
{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;

View File

@ -1,14 +1,21 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Configuration;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osuTK.Graphics;
namespace osu.Game.Overlays.Settings.Sections.Graphics
{
@ -16,45 +23,66 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
{
protected override string Header => "Layout";
private FillFlowContainer letterboxSettings;
private FillFlowContainer<SettingsSlider<float>> scalingSettings;
private Bindable<bool> letterboxing;
private Bindable<ScalingMode> scalingMode;
private Bindable<Size> sizeFullscreen;
private readonly IBindableList<WindowMode> windowModes = new BindableList<WindowMode>();
private OsuGameBase game;
private SettingsDropdown<Size> resolutionDropdown;
private SettingsEnumDropdown<WindowMode> windowModeDropdown;
private SettingsDropdown<WindowMode> windowModeDropdown;
private Bindable<float> scalingPositionX;
private Bindable<float> scalingPositionY;
private Bindable<float> scalingSizeX;
private Bindable<float> scalingSizeY;
private const int transition_duration = 400;
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager config, OsuGameBase game)
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, OsuGameBase game, GameHost host)
{
this.game = game;
letterboxing = config.GetBindable<bool>(FrameworkSetting.Letterboxing);
scalingMode = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling);
sizeFullscreen = config.GetBindable<Size>(FrameworkSetting.SizeFullscreen);
scalingSizeX = osuConfig.GetBindable<float>(OsuSetting.ScalingSizeX);
scalingSizeY = osuConfig.GetBindable<float>(OsuSetting.ScalingSizeY);
scalingPositionX = osuConfig.GetBindable<float>(OsuSetting.ScalingPositionX);
scalingPositionY = osuConfig.GetBindable<float>(OsuSetting.ScalingPositionY);
if (host.Window != null)
windowModes.BindTo(host.Window.SupportedWindowModes);
Container resolutionSettingsContainer;
Children = new Drawable[]
{
windowModeDropdown = new SettingsEnumDropdown<WindowMode>
windowModeDropdown = new SettingsDropdown<WindowMode>
{
LabelText = "Screen mode",
Bindable = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode),
ItemSource = windowModes,
},
resolutionSettingsContainer = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
new SettingsCheckbox
new SettingsSlider<float, UIScaleSlider>
{
LabelText = "Letterboxing",
Bindable = letterboxing,
LabelText = "UI Scaling",
TransferValueOnCommit = true,
Bindable = osuConfig.GetBindable<float>(OsuSetting.UIScale),
KeyboardStep = 0.01f
},
letterboxSettings = new FillFlowContainer
new SettingsEnumDropdown<ScalingMode>
{
LabelText = "Screen Scaling",
Bindable = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling),
},
scalingSettings = new FillFlowContainer<SettingsSlider<float>>
{
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
@ -62,25 +90,38 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
AutoSizeDuration = transition_duration,
AutoSizeEasing = Easing.OutQuint,
Masking = true,
Children = new Drawable[]
Children = new[]
{
new SettingsSlider<double>
new SettingsSlider<float>
{
LabelText = "Horizontal position",
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionX),
Bindable = scalingPositionX,
KeyboardStep = 0.01f
},
new SettingsSlider<double>
new SettingsSlider<float>
{
LabelText = "Vertical position",
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionY),
Bindable = scalingPositionY,
KeyboardStep = 0.01f
},
new SettingsSlider<float>
{
LabelText = "Horizontal scale",
Bindable = scalingSizeX,
KeyboardStep = 0.01f
},
new SettingsSlider<float>
{
LabelText = "Vertical scale",
Bindable = scalingSizeY,
KeyboardStep = 0.01f
},
}
},
};
scalingSettings.ForEach(s => bindPreviewEvent(s.Bindable));
var resolutions = getResolutions();
if (resolutions.Count > 1)
@ -93,9 +134,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
Bindable = sizeFullscreen
};
windowModeDropdown.Bindable.BindValueChanged(windowMode =>
windowModeDropdown.Bindable.BindValueChanged(mode =>
{
if (windowMode == WindowMode.Fullscreen)
if (mode.NewValue == WindowMode.Fullscreen)
{
resolutionDropdown.Show();
sizeFullscreen.TriggerChange();
@ -105,14 +146,58 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
}, true);
}
letterboxing.BindValueChanged(isVisible =>
scalingMode.BindValueChanged(mode =>
{
letterboxSettings.ClearTransforms();
letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None;
scalingSettings.ClearTransforms();
scalingSettings.AutoSizeAxes = mode.NewValue != ScalingMode.Off ? Axes.Y : Axes.None;
if (!isVisible)
letterboxSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
if (mode.NewValue == ScalingMode.Off)
scalingSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
scalingSettings.ForEach(s => s.TransferValueOnCommit = mode.NewValue == ScalingMode.Everything);
}, true);
windowModes.ItemsAdded += _ => windowModesChanged();
windowModes.ItemsRemoved += _ => windowModesChanged();
windowModesChanged();
}
private void windowModesChanged()
{
if (windowModes.Count > 1)
windowModeDropdown.Show();
else
windowModeDropdown.Hide();
}
/// <summary>
/// Create a delayed bindable which only updates when a condition is met.
/// </summary>
/// <param name="bindable">The config bindable.</param>
/// <returns>A bindable which will propagate updates with a delay.</returns>
private void bindPreviewEvent(Bindable<float> bindable)
{
bindable.ValueChanged += _ =>
{
switch (scalingMode.Value)
{
case ScalingMode.Gameplay:
showPreview();
break;
}
};
}
private Drawable preview;
private void showPreview()
{
if (preview?.IsAlive != true)
game.Add(preview = new ScalingPreview());
preview.FadeOutFromOne(1500);
preview.Expire();
}
private IReadOnlyList<Size> getResolutions()
@ -132,9 +217,27 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
return resolutions;
}
private class ScalingPreview : ScalingContainer
{
public ScalingPreview()
{
Child = new Box
{
Colour = Color4.White,
RelativeSizeAxes = Axes.Both,
Alpha = 0.5f,
};
}
}
private class UIScaleSlider : OsuSliderBar<float>
{
public override string TooltipText => base.TooltipText + "x";
}
private class ResolutionSettingsDropdown : SettingsDropdown<Size>
{
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl { Items = Items };
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl();
private class ResolutionDropdownControl : DropdownControl
{
@ -142,6 +245,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
{
if (item == new Size(9999, 9999))
return "Default";
return $"{item.Width}x{item.Height}";
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Configuration;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;

View File

@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Settings.Sections.Graphics;
namespace osu.Game.Overlays.Settings.Sections
@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections
public class GraphicsSection : SettingsSection
{
public override string Header => "Graphics";
public override FontAwesome Icon => FontAwesome.fa_laptop;
public override IconUsage Icon => FontAwesome.Solid.Laptop;
public GraphicsSection()
{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
@ -9,13 +9,14 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{
protected override string Header => "Keyboard";
public KeyboardSettings(KeyBindingOverlay keyConfig)
public KeyboardSettings(KeyBindingPanel keyConfig)
{
Children = new Drawable[]
{
new SettingsButton
{
Text = "Key configuration",
TooltipText = "Change global shortcut keys and gameplay bindings",
Action = keyConfig.ToggleVisibility
},
};

View File

@ -1,11 +1,11 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
@ -62,13 +62,13 @@ namespace osu.Game.Overlays.Settings.Sections.Input
const string raw_mouse_handler = @"OsuTKRawMouseHandler";
const string standard_mouse_handler = @"OsuTKMouseHandler";
ignoredInputHandler.Value = enabled ? standard_mouse_handler : raw_mouse_handler;
ignoredInputHandler.Value = enabled.NewValue ? standard_mouse_handler : raw_mouse_handler;
};
ignoredInputHandler = config.GetBindable<string>(FrameworkSetting.IgnoredInputHandlers);
ignoredInputHandler.ValueChanged += handler =>
{
bool raw = !handler.Contains("Raw");
bool raw = !handler.NewValue.Contains("Raw");
rawInputToggle.Value = raw;
sensitivity.Bindable.Disabled = !raw;
};
@ -78,67 +78,16 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private class SensitivitySetting : SettingsSlider<double, SensitivitySlider>
{
public override Bindable<double> Bindable
{
get { return ((SensitivitySlider)Control).Sensitivity; }
set
{
BindableDouble doubleValue = (BindableDouble)value;
// create a second layer of bindable so we can only handle state changes when not being dragged.
((SensitivitySlider)Control).Sensitivity = doubleValue;
// this bindable will still act as the "interactive" bindable displayed during a drag.
base.Bindable = new BindableDouble(doubleValue.Value)
{
Default = doubleValue.Default,
MinValue = doubleValue.MinValue,
MaxValue = doubleValue.MaxValue
};
// one-way binding to update the sliderbar with changes from external actions.
doubleValue.DisabledChanged += disabled => base.Bindable.Disabled = disabled;
doubleValue.ValueChanged += newValue => base.Bindable.Value = newValue;
}
}
public SensitivitySetting()
{
KeyboardStep = 0.01f;
TransferValueOnCommit = true;
}
}
private class SensitivitySlider : OsuSliderBar<double>
{
public Bindable<double> Sensitivity;
public SensitivitySlider()
{
Current.ValueChanged += newValue =>
{
if (!isDragging && Sensitivity != null)
Sensitivity.Value = newValue;
};
}
private bool isDragging;
protected override bool OnDragStart(DragStartEvent e)
{
isDragging = true;
return base.OnDragStart(e);
}
protected override bool OnDragEnd(DragEndEvent e)
{
isDragging = false;
Current.TriggerChange();
return base.OnDragEnd(e);
}
public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : Current.Value.ToString(@"0.##x");
public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : $"{base.TooltipText}x";
}
}
}

View File

@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Settings.Sections.Input;
namespace osu.Game.Overlays.Settings.Sections
@ -10,9 +10,9 @@ namespace osu.Game.Overlays.Settings.Sections
public class InputSection : SettingsSection
{
public override string Header => "Input";
public override FontAwesome Icon => FontAwesome.fa_keyboard_o;
public override IconUsage Icon => FontAwesome.Regular.Keyboard;
public InputSection(KeyBindingOverlay keyConfig)
public InputSection(KeyBindingPanel keyConfig)
{
Children = new Drawable[]
{

View File

@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
BodyText = "Everything?";
Icon = FontAwesome.fa_trash_o;
Icon = FontAwesome.Regular.TrashAlt;
HeaderText = @"Confirm deletion of";
Buttons = new PopupDialogButton[]
{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using System.Threading.Tasks;
@ -7,6 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Scoring;
using osu.Game.Skinning;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
@ -16,18 +17,20 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
protected override string Header => "General";
private TriangleButton importBeatmapsButton;
private TriangleButton importScoresButton;
private TriangleButton importSkinsButton;
private TriangleButton deleteSkinsButton;
private TriangleButton deleteBeatmapsButton;
private TriangleButton deleteScoresButton;
private TriangleButton deleteSkinsButton;
private TriangleButton restoreButton;
private TriangleButton undeleteButton;
[BackgroundDependencyLoader]
private void load(BeatmapManager beatmaps, SkinManager skins, DialogOverlay dialogOverlay)
private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, DialogOverlay dialogOverlay)
{
Children = new Drawable[]
if (beatmaps.SupportsImportFromStable)
{
importBeatmapsButton = new SettingsButton
Add(importBeatmapsButton = new SettingsButton
{
Text = "Import beatmaps from stable",
Action = () =>
@ -35,20 +38,51 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
importBeatmapsButton.Enabled.Value = false;
beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true));
}
},
deleteBeatmapsButton = new DangerousSettingsButton
});
}
Add(deleteBeatmapsButton = new DangerousSettingsButton
{
Text = "Delete ALL beatmaps",
Action = () =>
{
Text = "Delete ALL beatmaps",
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
{
deleteBeatmapsButton.Enabled.Value = false;
Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
}));
}
});
if (scores.SupportsImportFromStable)
{
Add(importScoresButton = new SettingsButton
{
Text = "Import scores from stable",
Action = () =>
{
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
{
deleteBeatmapsButton.Enabled.Value = false;
Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
}));
importScoresButton.Enabled.Value = false;
scores.ImportFromStableAsync().ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true));
}
},
importSkinsButton = new SettingsButton
});
}
Add(deleteScoresButton = new DangerousSettingsButton
{
Text = "Delete ALL scores",
Action = () =>
{
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
{
deleteScoresButton.Enabled.Value = false;
Task.Run(() => scores.Delete(scores.GetAllUsableScores())).ContinueWith(t => Schedule(() => deleteScoresButton.Enabled.Value = true));
}));
}
});
if (skins.SupportsImportFromStable)
{
Add(importSkinsButton = new SettingsButton
{
Text = "Import skins from stable",
Action = () =>
@ -56,7 +90,11 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
importSkinsButton.Enabled.Value = false;
skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true));
}
},
});
}
AddRange(new Drawable[]
{
deleteSkinsButton = new DangerousSettingsButton
{
Text = "Delete ALL skins",
@ -91,7 +129,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Task.Run(() => beatmaps.Undelete(beatmaps.QueryBeatmapSets(b => b.DeletePending).ToList())).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true));
}
},
};
});
}
}
}

View File

@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Settings.Sections.Maintenance;
using osuTK;
@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Settings.Sections
public class MaintenanceSection : SettingsSection
{
public override string Header => "Maintenance";
public override FontAwesome Icon => FontAwesome.fa_wrench;
public override IconUsage Icon => FontAwesome.Solid.Wrench;
public MaintenanceSection()
{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;

View File

@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Settings.Sections.Online;
namespace osu.Game.Overlays.Settings.Sections
@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections
public class OnlineSection : SettingsSection
{
public override string Header => "Online";
public override FontAwesome Icon => FontAwesome.fa_globe;
public override IconUsage Icon => FontAwesome.Solid.GlobeAsia;
public OnlineSection()
{

View File

@ -1,14 +1,14 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Skinning;
using osuTK;
@ -21,9 +21,9 @@ namespace osu.Game.Overlays.Settings.Sections
public override string Header => "Skin";
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
public override IconUsage Icon => FontAwesome.Solid.PaintBrush;
private readonly Bindable<SkinInfo> dropdownBindable = new Bindable<SkinInfo>();
private readonly Bindable<SkinInfo> dropdownBindable = new Bindable<SkinInfo> { Default = SkinInfo.Default };
private readonly Bindable<int> configBindable = new Bindable<int>();
private static readonly SkinInfo random_skin_info = new RandomSkinInfo();
@ -57,6 +57,16 @@ namespace osu.Game.Overlays.Settings.Sections
LabelText = "Adjust gameplay cursor size based on current beatmap",
Bindable = config.GetBindable<bool>(OsuSetting.AutoCursorSize)
},
new SettingsCheckbox
{
LabelText = "Beatmap skins",
Bindable = config.GetBindable<bool>(OsuSetting.BeatmapSkins)
},
new SettingsCheckbox
{
LabelText = "Beatmap hitsounds",
Bindable = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds)
},
};
skins.ItemAdded += itemAdded;
@ -73,13 +83,13 @@ namespace osu.Game.Overlays.Settings.Sections
if (skinDropdown.Items.All(s => s.ID != configBindable.Value))
configBindable.Value = 0;
configBindable.BindValueChanged(v => dropdownBindable.Value = skinDropdown.Items.Single(s => s.ID == v), true);
dropdownBindable.BindValueChanged(v =>
configBindable.BindValueChanged(id => dropdownBindable.Value = skinDropdown.Items.Single(s => s.ID == id.NewValue), true);
dropdownBindable.BindValueChanged(skin =>
{
if (v == random_skin_info)
randomizeSkin();
else
configBindable.Value = v?.ID ?? 0;
configBindable.Value = skin.NewValue.ID ?? 0;
});
}
@ -98,7 +108,7 @@ namespace osu.Game.Overlays.Settings.Sections
resetSkinButtons();
});
private void itemAdded(SkinInfo s, bool existing, bool silent)
private void itemAdded(SkinInfo s)
{
if (existing)
return;
@ -133,7 +143,7 @@ namespace osu.Game.Overlays.Settings.Sections
private class SkinSettingsDropdown : SettingsDropdown<SkinInfo>
{
protected override OsuDropdown<SkinInfo> CreateDropdown() => new SkinDropdownControl { Items = Items };
protected override OsuDropdown<SkinInfo> CreateDropdown() => new SkinDropdownControl();
private class SkinDropdownControl : DropdownControl
{

View File

@ -1,17 +1,33 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsButton : TriangleButton
public class SettingsButton : TriangleButton, IHasTooltip
{
public SettingsButton()
{
RelativeSizeAxes = Axes.X;
Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS };
Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS };
}
public string TooltipText { get; set; }
public override IEnumerable<string> FilterTerms
{
get
{
if (TooltipText != null)
return base.FilterTerms.Append(TooltipText);
return base.FilterTerms;
}
}
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
@ -10,12 +10,14 @@ namespace osu.Game.Overlays.Settings
{
private OsuCheckbox checkbox;
private string labelText;
protected override Drawable CreateControl() => checkbox = new OsuCheckbox();
public override string LabelText
{
get { return checkbox.LabelText; }
set { checkbox.LabelText = value; }
get => labelText;
set => checkbox.LabelText = labelText = value;
}
}
}

View File

@ -1,8 +1,9 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
@ -12,23 +13,23 @@ namespace osu.Game.Overlays.Settings
{
protected new OsuDropdown<T> Control => (OsuDropdown<T>)base.Control;
private IEnumerable<T> items = Enumerable.Empty<T>();
public IEnumerable<T> Items
{
get => items;
set
{
items = value;
if (Control != null)
Control.Items = value;
}
get => Control.Items;
set => Control.Items = value;
}
public IBindableList<T> ItemSource
{
get => Control.ItemSource;
set => Control.ItemSource = value;
}
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => i.ToString()));
protected sealed override Drawable CreateControl() => CreateDropdown();
protected virtual OsuDropdown<T> CreateDropdown() => new DropdownControl { Items = Items };
protected virtual OsuDropdown<T> CreateDropdown() => new DropdownControl();
protected class DropdownControl : OsuDropdown<T>
{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings
{
protected override OsuDropdown<T> CreateDropdown() => new DropdownControl();
protected class DropdownControl : OsuEnumDropdown<T>
protected new class DropdownControl : OsuEnumDropdown<T>
{
public DropdownControl()
{

View File

@ -1,17 +1,18 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Development;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osuTK;
using osuTK.Graphics;
using DebugUtils = osu.Game.Utils.DebugUtils;
namespace osu.Game.Overlays.Settings
{
@ -56,18 +57,51 @@ namespace osu.Game.Overlays.Settings
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = game.Name,
TextSize = 18,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
},
new OsuSpriteText
new BuildDisplay(game.Version, DebugUtils.IsDebugBuild)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 14,
Text = game.Version,
Colour = DebugUtils.IsDebug ? colours.Red : Color4.White,
},
}
};
}
private class BuildDisplay : OsuAnimatedButton
{
private readonly string version;
private readonly bool isDebug;
[Resolved]
private OsuColour colours { get; set; }
public BuildDisplay(string version, bool isDebug)
{
this.version = version;
this.isDebug = isDebug;
Content.RelativeSizeAxes = Axes.Y;
Content.AutoSizeAxes = AutoSizeAxes = Axes.X;
Height = 20;
}
[BackgroundDependencyLoader(true)]
private void load(ChangelogOverlay changelog)
{
if (!isDebug)
Action = () => changelog?.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version);
Add(new OsuSpriteText
{
Font = OsuFont.GetFont(size: 16),
Text = version,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Padding = new MarginPadding(5),
Colour = isDebug ? colours.Red : Color4.White,
});
}
}
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -38,10 +38,10 @@ namespace osu.Game.Overlays.Settings
new OsuSpriteText
{
Text = heading,
TextSize = 40,
Font = OsuFont.GetFont(size: 40),
Margin = new MarginPadding
{
Left = SettingsOverlay.CONTENT_MARGINS,
Left = SettingsPanel.CONTENT_MARGINS,
Top = Toolbar.Toolbar.TOOLTIP_HEIGHT
},
},
@ -49,10 +49,10 @@ namespace osu.Game.Overlays.Settings
{
Colour = colours.Pink,
Text = subheading,
TextSize = 18,
Font = OsuFont.GetFont(size: 18),
Margin = new MarginPadding
{
Left = SettingsOverlay.CONTENT_MARGINS,
Left = SettingsPanel.CONTENT_MARGINS,
Bottom = 30
},
},

View File

@ -1,14 +1,15 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osuTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
@ -39,14 +40,13 @@ namespace osu.Game.Overlays.Settings
public virtual string LabelText
{
get { return text?.Text ?? string.Empty; }
get => 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());
FlowContent.SetLayoutPosition(text, -1);
FlowContent.Insert(-1, text = new OsuSpriteText());
}
text.Text = value;
@ -58,12 +58,16 @@ namespace osu.Game.Overlays.Settings
public virtual Bindable<T> Bindable
{
get { return bindable; }
get => bindable;
set
{
if (bindable != null)
controlWithCurrent?.Current.UnbindFrom(bindable);
bindable = value;
controlWithCurrent?.Current.BindTo(bindable);
if (ShowsDefaultIndicator)
{
restoreDefaultButton.Bindable = bindable.GetBoundCopy();
@ -72,22 +76,20 @@ namespace osu.Game.Overlays.Settings
}
}
public IEnumerable<string> FilterTerms => new[] { LabelText };
public virtual IEnumerable<string> FilterTerms => new[] { LabelText };
public bool MatchingFilter
{
set
{
// probably needs a better transition.
this.FadeTo(value ? 1 : 0);
}
set => this.FadeTo(value ? 1 : 0);
}
public bool FilteringActive { get; set; }
protected SettingsItem()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = SettingsOverlay.CONTENT_MARGINS };
Padding = new MarginPadding { Right = SettingsPanel.CONTENT_MARGINS };
InternalChildren = new Drawable[]
{
@ -96,7 +98,7 @@ namespace osu.Game.Overlays.Settings
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS },
Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS },
Child = Control = CreateControl()
},
};
@ -115,12 +117,12 @@ namespace osu.Game.Overlays.Settings
public Bindable<T> Bindable
{
get { return bindable; }
get => bindable;
set
{
bindable = value;
bindable.ValueChanged += newValue => UpdateState();
bindable.DisabledChanged += disabled => UpdateState();
bindable.ValueChanged += _ => UpdateState();
bindable.DisabledChanged += _ => UpdateState();
}
}
@ -131,7 +133,7 @@ namespace osu.Game.Overlays.Settings
public RestoreDefaultValueButton()
{
RelativeSizeAxes = Axes.Y;
Width = SettingsOverlay.CONTENT_MARGINS;
Width = SettingsPanel.CONTENT_MARGINS;
Alpha = 0f;
}

View File

@ -1,20 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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;
namespace osu.Game.Overlays.Settings
{
public class SettingsLabel : SettingsItem<string>
{
protected override Drawable CreateControl() => null;
[BackgroundDependencyLoader]
private void load(OsuColour colour)
{
Colour = colour.Gray6;
}
}
}

View File

@ -0,0 +1,17 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsNumberBox : SettingsItem<string>
{
protected override Drawable CreateControl() => new OsuNumberBox
{
Margin = new MarginPadding { Top = 5 },
RelativeSizeAxes = Axes.X,
};
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osuTK;
using osuTK.Graphics;
@ -11,6 +11,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Settings
{
@ -19,7 +20,7 @@ namespace osu.Game.Overlays.Settings
protected FillFlowContainer FlowContent;
protected override Container<Drawable> Content => FlowContent;
public abstract FontAwesome Icon { get; }
public abstract IconUsage Icon { get; }
public abstract string Header { get; }
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
@ -31,9 +32,11 @@ namespace osu.Game.Overlays.Settings
public bool MatchingFilter
{
set { this.FadeTo(value ? 1 : 0); }
set => this.FadeTo(value ? 1 : 0);
}
public bool FilteringActive { get; set; }
protected SettingsSection()
{
Margin = new MarginPadding { Top = 20 };
@ -77,10 +80,10 @@ namespace osu.Game.Overlays.Settings
{
new OsuSpriteText
{
TextSize = header_size,
Font = OsuFont.GetFont(size: header_size),
Text = Header,
Colour = colours.Yellow,
Margin = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }
Margin = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS }
},
FlowContent
}

View File

@ -1,8 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
@ -23,14 +22,16 @@ namespace osu.Game.Overlays.Settings
RelativeSizeAxes = Axes.X
};
public float KeyboardStep;
[BackgroundDependencyLoader]
private void load()
public bool TransferValueOnCommit
{
var slider = Control as U;
if (slider != null)
slider.KeyboardStep = KeyboardStep;
get => ((U)Control).TransferValueOnCommit;
set => ((U)Control).TransferValueOnCommit = value;
}
public float KeyboardStep
{
get => ((U)Control).KeyboardStep;
set => ((U)Control).KeyboardStep = value;
}
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osuTK;
using osu.Framework.Graphics;
@ -8,6 +8,7 @@ using osu.Game.Graphics.Sprites;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Settings
{
@ -21,14 +22,14 @@ namespace osu.Game.Overlays.Settings
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
public IEnumerable<string> FilterTerms => new[] { Header };
public bool MatchingFilter
{
set
{
this.FadeTo(value ? 1 : 0);
}
set => this.FadeTo(value ? 1 : 0);
}
public bool FilteringActive { get; set; }
protected SettingsSubsection()
{
RelativeSizeAxes = Axes.X;
@ -52,8 +53,8 @@ namespace osu.Game.Overlays.Settings
new OsuSpriteText
{
Text = Header.ToUpperInvariant(),
Margin = new MarginPadding { Bottom = 10, Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS },
Font = @"Exo2.0-Black",
Margin = new MarginPadding { Bottom = 10, Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS },
Font = OsuFont.GetFont(weight: FontWeight.Black),
},
FlowContent
});

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Framework.Threading;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays.Toolbar;
namespace osu.Game.Overlays.Settings
@ -76,7 +77,7 @@ namespace osu.Game.Overlays.Settings
return base.OnMouseMove(e);
}
private class SidebarScrollContainer : ScrollContainer
private class SidebarScrollContainer : OsuScrollContainer
{
public SidebarScrollContainer()
{
@ -88,7 +89,7 @@ namespace osu.Game.Overlays.Settings
public ExpandedState State
{
get { return state; }
get => state;
set
{
expandEvent?.Cancel();
@ -102,6 +103,7 @@ namespace osu.Game.Overlays.Settings
default:
this.ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, Easing.OutQuint);
break;
case ExpandedState.Expanded:
this.ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, Easing.OutQuint);
break;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osuTK;
@ -26,12 +26,10 @@ namespace osu.Game.Overlays.Settings
public new Action<SettingsSection> Action;
private SettingsSection section;
public SettingsSection Section
{
get
{
return section;
}
get => section;
set
{
section = value;
@ -41,12 +39,14 @@ namespace osu.Game.Overlays.Settings
}
private bool selected;
public bool Selected
{
get { return selected; }
get => selected;
set
{
selected = value;
if (selected)
{
selectionIndicator.FadeIn(50);