1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 20:32:55 +08:00

Merge branch 'master' into startup-load-improvements

This commit is contained in:
Dan Balasescu 2017-10-24 11:54:31 +09:00 committed by GitHub
commit ecd641c44a
20 changed files with 179 additions and 44 deletions

View File

@ -102,10 +102,6 @@ namespace osu.Game.Tests.Beatmaps.IO
waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time"); waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time");
// this is a temporary workaround for database transaction clashes.
// see https://github.com/aspnet/EntityFrameworkCore/issues/9994 for more information.
Thread.Sleep(1000);
return osu; return osu;
} }

View File

@ -28,6 +28,7 @@ namespace osu.Game.Overlays.KeyBinding
this.variant = variant; this.variant = variant;
FlowContent.Spacing = new Vector2(0, 1); FlowContent.Spacing = new Vector2(0, 1);
FlowContent.Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS };
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -20,11 +20,11 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
new SettingsSlider<double, OffsetSlider> new SettingsSlider<double, OffsetSlider>
{ {
LabelText = "Audio Offset", LabelText = "Audio Offset",
Bindable = config.GetBindable<double>(OsuSetting.AudioOffset) Bindable = config.GetBindable<double>(OsuSetting.AudioOffset),
KeyboardStep = 100f
}, },
new OsuButton new SettingsButton
{ {
RelativeSizeAxes = Axes.X,
Text = "Offset wizard" Text = "Offset wizard"
} }
}; };

View File

@ -16,9 +16,9 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new SettingsSlider<double> { LabelText = "Master", Bindable = audio.Volume }, new SettingsSlider<double> { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.1f },
new SettingsSlider<double> { LabelText = "Effect", Bindable = audio.VolumeSample }, new SettingsSlider<double> { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.1f },
new SettingsSlider<double> { LabelText = "Music", Bindable = audio.VolumeTrack }, new SettingsSlider<double> { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.1f },
}; };
} }
} }

View File

@ -6,7 +6,6 @@ using System.Runtime;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings.Sections.Debug namespace osu.Game.Overlays.Settings.Sections.Debug
{ {
@ -24,9 +23,8 @@ namespace osu.Game.Overlays.Settings.Sections.Debug
LabelText = "Active mode", LabelText = "Active mode",
Bindable = config.GetBindable<GCLatencyMode>(DebugSetting.ActiveGCMode) Bindable = config.GetBindable<GCLatencyMode>(DebugSetting.ActiveGCMode)
}, },
new OsuButton new SettingsButton
{ {
RelativeSizeAxes = Axes.X,
Text = "Force garbage collection", Text = "Force garbage collection",
Action = GC.Collect Action = GC.Collect
}, },

View File

@ -19,7 +19,8 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
new SettingsSlider<double> new SettingsSlider<double>
{ {
LabelText = "Background dim", LabelText = "Background dim",
Bindable = config.GetBindable<double>(OsuSetting.DimLevel) Bindable = config.GetBindable<double>(OsuSetting.DimLevel),
KeyboardStep = 0.1f
}, },
new SettingsCheckbox new SettingsCheckbox
{ {

View File

@ -20,12 +20,14 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
new SettingsSlider<double, StarSlider> new SettingsSlider<double, StarSlider>
{ {
LabelText = "Display beatmaps from", LabelText = "Display beatmaps from",
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum) Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum),
KeyboardStep = 1f
}, },
new SettingsSlider<double, StarSlider> new SettingsSlider<double, StarSlider>
{ {
LabelText = "up to", LabelText = "up to",
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum) Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum),
KeyboardStep = 1f
}, },
new SettingsEnumDropdown<SelectionRandomType> new SettingsEnumDropdown<SelectionRandomType>
{ {

View File

@ -230,15 +230,13 @@ namespace osu.Game.Overlays.Settings.Sections.General
LabelText = "Stay logged in", LabelText = "Stay logged in",
Bindable = config.GetBindable<bool>(OsuSetting.SavePassword), Bindable = config.GetBindable<bool>(OsuSetting.SavePassword),
}, },
new OsuButton new SettingsButton
{ {
RelativeSizeAxes = Axes.X,
Text = "Sign in", Text = "Sign in",
Action = performLogin Action = performLogin
}, },
new OsuButton new SettingsButton
{ {
RelativeSizeAxes = Axes.X,
Text = "Register new account", Text = "Register new account",
//Action = registerLink //Action = registerLink
} }

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings.Sections.General namespace osu.Game.Overlays.Settings.Sections.General
{ {
@ -23,9 +22,8 @@ namespace osu.Game.Overlays.Settings.Sections.General
LabelText = "Release stream", LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream), Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
}, },
new OsuButton new SettingsButton
{ {
RelativeSizeAxes = Axes.X,
Text = "Open osu! folder", Text = "Open osu! folder",
Action = storage.OpenInNativeExplorer, Action = storage.OpenInNativeExplorer,
} }

View File

@ -49,12 +49,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
new SettingsSlider<double> new SettingsSlider<double>
{ {
LabelText = "Horizontal position", LabelText = "Horizontal position",
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionX) Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionX),
KeyboardStep = 0.1f
}, },
new SettingsSlider<double> new SettingsSlider<double>
{ {
LabelText = "Vertical position", LabelText = "Vertical position",
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionY) Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionY),
KeyboardStep = 0.1f
}, },
} }
}, },

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings.Sections.Input namespace osu.Game.Overlays.Settings.Sections.Input
{ {
@ -14,9 +13,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuButton new SettingsButton
{ {
RelativeSizeAxes = Axes.X,
Text = "Key Configuration", Text = "Key Configuration",
Action = keyConfig.ToggleVisibility Action = keyConfig.ToggleVisibility
}, },

View File

@ -23,9 +23,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
importButton = new OsuButton importButton = new SettingsButton
{ {
RelativeSizeAxes = Axes.X,
Text = "Import beatmaps from stable", Text = "Import beatmaps from stable",
Action = () => Action = () =>
{ {
@ -33,9 +32,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Task.Run(() => beatmaps.ImportFromStable()).ContinueWith(t => Schedule(() => importButton.Enabled.Value = true)); Task.Run(() => beatmaps.ImportFromStable()).ContinueWith(t => Schedule(() => importButton.Enabled.Value = true));
} }
}, },
deleteButton = new OsuButton deleteButton = new SettingsButton
{ {
RelativeSizeAxes = Axes.X,
Text = "Delete ALL beatmaps", Text = "Delete ALL beatmaps",
Action = () => Action = () =>
{ {
@ -43,9 +41,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Task.Run(() => beatmaps.DeleteAll()).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true)); Task.Run(() => beatmaps.DeleteAll()).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true));
} }
}, },
restoreButton = new OsuButton restoreButton = new SettingsButton
{ {
RelativeSizeAxes = Axes.X,
Text = "Restore all hidden difficulties", Text = "Restore all hidden difficulties",
Action = () => Action = () =>
{ {

View File

@ -24,12 +24,14 @@ namespace osu.Game.Overlays.Settings.Sections
new SettingsSlider<double, SizeSlider> new SettingsSlider<double, SizeSlider>
{ {
LabelText = "Menu cursor size", LabelText = "Menu cursor size",
Bindable = config.GetBindable<double>(OsuSetting.MenuCursorSize) Bindable = config.GetBindable<double>(OsuSetting.MenuCursorSize),
KeyboardStep = 0.1f
}, },
new SettingsSlider<double, SizeSlider> new SettingsSlider<double, SizeSlider>
{ {
LabelText = "Gameplay cursor size", LabelText = "Gameplay cursor size",
Bindable = config.GetBindable<double>(OsuSetting.GameplayCursorSize) Bindable = config.GetBindable<double>(OsuSetting.GameplayCursorSize),
KeyboardStep = 0.1f
}, },
new SettingsCheckbox new SettingsCheckbox
{ {

View File

@ -0,0 +1,17 @@
// 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.Settings
{
public class SettingsButton : OsuButton
{
public SettingsButton()
{
RelativeSizeAxes = Axes.X;
Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS };
}
}
}

View File

@ -2,17 +2,24 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Allocation;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Settings namespace osu.Game.Overlays.Settings
{ {
public abstract class SettingsItem<T> : FillFlowContainer, IFilterable public abstract class SettingsItem<T> : Container, IFilterable
{ {
protected abstract Drawable CreateControl(); protected abstract Drawable CreateControl();
@ -20,8 +27,28 @@ namespace osu.Game.Overlays.Settings
private IHasCurrentValue<T> controlWithCurrent => Control as IHasCurrentValue<T>; private IHasCurrentValue<T> controlWithCurrent => Control as IHasCurrentValue<T>;
protected override Container<Drawable> Content => FlowContent;
protected readonly FillFlowContainer FlowContent;
private SpriteText text; private SpriteText text;
private readonly RestoreDefaultValueButton<T> restoreDefaultValueButton = new RestoreDefaultValueButton<T>();
public bool ShowsDefaultIndicator = true;
private Color4? restoreDefaultValueColour;
public Color4 RestoreDefaultValueColour
{
get { return restoreDefaultValueColour ?? Color4.White; }
set
{
restoreDefaultValueColour = value;
restoreDefaultValueButton?.SetButtonColour(RestoreDefaultValueColour);
}
}
public virtual string LabelText public virtual string LabelText
{ {
get { return text?.Text ?? string.Empty; } get { return text?.Text ?? string.Empty; }
@ -51,6 +78,11 @@ namespace osu.Game.Overlays.Settings
{ {
bindable = value; bindable = value;
controlWithCurrent?.Current.BindTo(bindable); controlWithCurrent?.Current.BindTo(bindable);
if (ShowsDefaultIndicator)
{
restoreDefaultValueButton.Bindable.BindTo(bindable);
restoreDefaultValueButton.Bindable.TriggerChange();
}
} }
} }
@ -69,13 +101,94 @@ namespace osu.Game.Overlays.Settings
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = 5 }; Padding = new MarginPadding { Right = SettingsOverlay.CONTENT_MARGINS };
FlowContent = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = 5 },
};
if ((Control = CreateControl()) != null) if ((Control = CreateControl()) != null)
{ {
if (controlWithCurrent != null) if (controlWithCurrent != null)
controlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; }; controlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; };
Add(Control); FlowContent.Add(Control);
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AddInternal(FlowContent);
if (restoreDefaultValueButton != null)
{
if (!restoreDefaultValueColour.HasValue)
restoreDefaultValueColour = colours.Yellow;
restoreDefaultValueButton.SetButtonColour(RestoreDefaultValueColour);
AddInternal(restoreDefaultValueButton);
}
}
private class RestoreDefaultValueButton<T> : Box, IHasTooltip
{
internal readonly Bindable<T> Bindable = new Bindable<T>();
private Color4 buttonColour;
private bool hovering;
public RestoreDefaultValueButton()
{
Bindable.ValueChanged += value => UpdateState();
Bindable.DisabledChanged += disabled => UpdateState();
RelativeSizeAxes = Axes.Y;
Width = SettingsOverlay.CONTENT_MARGINS;
Alpha = 0f;
}
public string TooltipText => "Revert to default";
public override bool HandleInput => true;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => true;
protected override bool OnClick(InputState state)
{
if (!Bindable.Disabled)
Bindable.SetDefault();
return true;
}
protected override bool OnHover(InputState state)
{
hovering = true;
UpdateState();
return true;
}
protected override void OnHoverLost(InputState state)
{
hovering = false;
UpdateState();
}
internal void SetButtonColour(Color4 buttonColour)
{
this.buttonColour = buttonColour;
UpdateState();
}
internal void UpdateState()
{
var colour = Bindable.Disabled ? Color4.Gray : buttonColour;
this.FadeTo(Bindable.IsDefault ? 0f : hovering && !Bindable.Disabled ? 1f : 0.5f, 200, Easing.OutQuint);
this.FadeColour(ColourInfo.GradientHorizontal(colour.Opacity(0.8f), colour.Opacity(0)), 200, Easing.OutQuint);
} }
} }
} }

View File

@ -69,8 +69,6 @@ namespace osu.Game.Overlays.Settings
Padding = new MarginPadding Padding = new MarginPadding
{ {
Top = 20 + border_size, Top = 20 + border_size,
Left = SettingsOverlay.CONTENT_MARGINS,
Right = SettingsOverlay.CONTENT_MARGINS,
Bottom = 10, Bottom = 10,
}, },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -81,7 +79,8 @@ namespace osu.Game.Overlays.Settings
{ {
TextSize = header_size, TextSize = header_size,
Text = Header, Text = Header,
Colour = colours.Yellow Colour = colours.Yellow,
Margin = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }
}, },
FlowContent FlowContent
} }

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -22,5 +23,15 @@ namespace osu.Game.Overlays.Settings
Margin = new MarginPadding { Top = 5, Bottom = 5 }, Margin = new MarginPadding { Top = 5, Bottom = 5 },
RelativeSizeAxes = Axes.X RelativeSizeAxes = Axes.X
}; };
public float KeyboardStep;
[BackgroundDependencyLoader]
private void load()
{
var slider = Control as U;
if (slider != null)
slider.KeyboardStep = KeyboardStep;
}
} }
} }

View File

@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Settings
new OsuSpriteText new OsuSpriteText
{ {
Text = Header.ToUpper(), Text = Header.ToUpper(),
Margin = new MarginPadding { Bottom = 10 }, Margin = new MarginPadding { Bottom = 10, Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS },
Font = @"Exo2.0-Black", Font = @"Exo2.0-Black",
}, },
FlowContent FlowContent

View File

@ -19,7 +19,8 @@ namespace osu.Game.Screens.Play.ReplaySettings
new ReplaySliderBar<double> new ReplaySliderBar<double>
{ {
LabelText = "Playback speed", LabelText = "Playback speed",
Bindable = config.GetBindable<double>(OsuSetting.PlaybackSpeed) Bindable = config.GetBindable<double>(OsuSetting.PlaybackSpeed),
KeyboardStep = 0.5f
} }
}; };
} }

View File

@ -289,6 +289,7 @@
<Compile Include="Migrations\OsuDbContextModelSnapshot.cs" /> <Compile Include="Migrations\OsuDbContextModelSnapshot.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" /> <Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" /> <Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" />
<Compile Include="Overlays\Settings\SettingsButton.cs" />
<Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" /> <Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" />
<Compile Include="Beatmaps\Drawables\DifficultyColouredContainer.cs" /> <Compile Include="Beatmaps\Drawables\DifficultyColouredContainer.cs" />
<Compile Include="Beatmaps\Drawables\DifficultyIcon.cs" /> <Compile Include="Beatmaps\Drawables\DifficultyIcon.cs" />