mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 05:52:54 +08:00
Merge branch 'master' into startup-load-improvements
This commit is contained in:
commit
ecd641c44a
@ -102,10 +102,6 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
this.variant = variant;
|
||||
|
||||
FlowContent.Spacing = new Vector2(0, 1);
|
||||
FlowContent.Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS };
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -20,11 +20,11 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
new SettingsSlider<double, OffsetSlider>
|
||||
{
|
||||
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"
|
||||
}
|
||||
};
|
||||
|
@ -16,9 +16,9 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsSlider<double> { LabelText = "Master", Bindable = audio.Volume },
|
||||
new SettingsSlider<double> { LabelText = "Effect", Bindable = audio.VolumeSample },
|
||||
new SettingsSlider<double> { LabelText = "Music", Bindable = audio.VolumeTrack },
|
||||
new SettingsSlider<double> { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.1f },
|
||||
new SettingsSlider<double> { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.1f },
|
||||
new SettingsSlider<double> { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.1f },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ using System.Runtime;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.Debug
|
||||
{
|
||||
@ -24,9 +23,8 @@ namespace osu.Game.Overlays.Settings.Sections.Debug
|
||||
LabelText = "Active mode",
|
||||
Bindable = config.GetBindable<GCLatencyMode>(DebugSetting.ActiveGCMode)
|
||||
},
|
||||
new OsuButton
|
||||
new SettingsButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Force garbage collection",
|
||||
Action = GC.Collect
|
||||
},
|
||||
|
@ -19,7 +19,8 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
LabelText = "Background dim",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DimLevel)
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DimLevel),
|
||||
KeyboardStep = 0.1f
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
|
@ -20,12 +20,14 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
new SettingsSlider<double, StarSlider>
|
||||
{
|
||||
LabelText = "Display beatmaps from",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum)
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum),
|
||||
KeyboardStep = 1f
|
||||
},
|
||||
new SettingsSlider<double, StarSlider>
|
||||
{
|
||||
LabelText = "up to",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum)
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum),
|
||||
KeyboardStep = 1f
|
||||
},
|
||||
new SettingsEnumDropdown<SelectionRandomType>
|
||||
{
|
||||
|
@ -230,15 +230,13 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
LabelText = "Stay logged in",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.SavePassword),
|
||||
},
|
||||
new OsuButton
|
||||
new SettingsButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Sign in",
|
||||
Action = performLogin
|
||||
},
|
||||
new OsuButton
|
||||
new SettingsButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Register new account",
|
||||
//Action = registerLink
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.General
|
||||
{
|
||||
@ -23,9 +22,8 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
LabelText = "Release stream",
|
||||
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
|
||||
},
|
||||
new OsuButton
|
||||
new SettingsButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Open osu! folder",
|
||||
Action = storage.OpenInNativeExplorer,
|
||||
}
|
||||
|
@ -49,12 +49,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
LabelText = "Horizontal position",
|
||||
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionX)
|
||||
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionX),
|
||||
KeyboardStep = 0.1f
|
||||
},
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
LabelText = "Vertical position",
|
||||
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionY)
|
||||
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionY),
|
||||
KeyboardStep = 0.1f
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -2,7 +2,6 @@
|
||||
// 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.Sections.Input
|
||||
{
|
||||
@ -14,9 +13,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuButton
|
||||
new SettingsButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Key Configuration",
|
||||
Action = keyConfig.ToggleVisibility
|
||||
},
|
||||
|
@ -23,9 +23,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
importButton = new OsuButton
|
||||
importButton = new SettingsButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Import beatmaps from stable",
|
||||
Action = () =>
|
||||
{
|
||||
@ -33,9 +32,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
Task.Run(() => beatmaps.ImportFromStable()).ContinueWith(t => Schedule(() => importButton.Enabled.Value = true));
|
||||
}
|
||||
},
|
||||
deleteButton = new OsuButton
|
||||
deleteButton = new SettingsButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Delete ALL beatmaps",
|
||||
Action = () =>
|
||||
{
|
||||
@ -43,9 +41,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
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",
|
||||
Action = () =>
|
||||
{
|
||||
|
@ -24,12 +24,14 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
new SettingsSlider<double, SizeSlider>
|
||||
{
|
||||
LabelText = "Menu cursor size",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.MenuCursorSize)
|
||||
Bindable = config.GetBindable<double>(OsuSetting.MenuCursorSize),
|
||||
KeyboardStep = 0.1f
|
||||
},
|
||||
new SettingsSlider<double, SizeSlider>
|
||||
{
|
||||
LabelText = "Gameplay cursor size",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.GameplayCursorSize)
|
||||
Bindable = config.GetBindable<double>(OsuSetting.GameplayCursorSize),
|
||||
KeyboardStep = 0.1f
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
|
17
osu.Game/Overlays/Settings/SettingsButton.cs
Normal file
17
osu.Game/Overlays/Settings/SettingsButton.cs
Normal 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 };
|
||||
}
|
||||
}
|
||||
}
|
@ -2,17 +2,24 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
public abstract class SettingsItem<T> : FillFlowContainer, IFilterable
|
||||
public abstract class SettingsItem<T> : Container, IFilterable
|
||||
{
|
||||
protected abstract Drawable CreateControl();
|
||||
|
||||
@ -20,8 +27,28 @@ namespace osu.Game.Overlays.Settings
|
||||
|
||||
private IHasCurrentValue<T> controlWithCurrent => Control as IHasCurrentValue<T>;
|
||||
|
||||
protected override Container<Drawable> Content => FlowContent;
|
||||
|
||||
protected readonly FillFlowContainer FlowContent;
|
||||
|
||||
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
|
||||
{
|
||||
get { return text?.Text ?? string.Empty; }
|
||||
@ -51,6 +78,11 @@ namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
bindable = value;
|
||||
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;
|
||||
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 (controlWithCurrent != null)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,8 +69,6 @@ namespace osu.Game.Overlays.Settings
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Top = 20 + border_size,
|
||||
Left = SettingsOverlay.CONTENT_MARGINS,
|
||||
Right = SettingsOverlay.CONTENT_MARGINS,
|
||||
Bottom = 10,
|
||||
},
|
||||
RelativeSizeAxes = Axes.X,
|
||||
@ -81,7 +79,8 @@ namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
TextSize = header_size,
|
||||
Text = Header,
|
||||
Colour = colours.Yellow
|
||||
Colour = colours.Yellow,
|
||||
Margin = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }
|
||||
},
|
||||
FlowContent
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -22,5 +23,15 @@ namespace osu.Game.Overlays.Settings
|
||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||
RelativeSizeAxes = Axes.X
|
||||
};
|
||||
|
||||
public float KeyboardStep;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
var slider = Control as U;
|
||||
if (slider != null)
|
||||
slider.KeyboardStep = KeyboardStep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Settings
|
||||
new OsuSpriteText
|
||||
{
|
||||
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",
|
||||
},
|
||||
FlowContent
|
||||
|
@ -19,7 +19,8 @@ namespace osu.Game.Screens.Play.ReplaySettings
|
||||
new ReplaySliderBar<double>
|
||||
{
|
||||
LabelText = "Playback speed",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.PlaybackSpeed)
|
||||
Bindable = config.GetBindable<double>(OsuSetting.PlaybackSpeed),
|
||||
KeyboardStep = 0.5f
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -289,6 +289,7 @@
|
||||
<Compile Include="Migrations\OsuDbContextModelSnapshot.cs" />
|
||||
<Compile Include="Online\API\Requests\GetBeatmapSetRequest.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="Beatmaps\Drawables\DifficultyColouredContainer.cs" />
|
||||
<Compile Include="Beatmaps\Drawables\DifficultyIcon.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user