Merge branch 'master' into fix-disabled-set-crash

This commit is contained in:
Dan Balasescu
2019-03-05 17:25:13 +09:00
committed by GitHub
372 changed files with 3325 additions and 1072 deletions

View File

@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
public bool Bounding
{
get { return bounding; }
get => bounding;
set
{
bounding = value;
@ -277,6 +277,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
var h = Header as UserDropdownHeader;
if (h == null) return;
h.StatusColour = value;
}
}
@ -338,7 +339,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
public Color4 StatusColour
{
set { statusIcon.FadeColour(value, 500, Easing.OutQuint); }
set => statusIcon.FadeColour(value, 500, Easing.OutQuint);
}
public UserDropdownHeader()

View File

@ -1,8 +1,8 @@
// 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

@ -11,6 +11,7 @@ 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;
@ -26,10 +27,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
private Bindable<ScalingMode> scalingMode;
private Bindable<Size> sizeFullscreen;
private readonly BindableList<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;
@ -39,7 +41,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
private const int transition_duration = 400;
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, OsuGameBase game)
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, OsuGameBase game, GameHost host)
{
this.game = game;
@ -50,14 +52,18 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
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
{
@ -84,7 +90,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
AutoSizeDuration = transition_duration,
AutoSizeEasing = Easing.OutQuint,
Masking = true,
Children = new []
Children = new[]
{
new SettingsSlider<float>
{
@ -150,6 +156,19 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
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>
@ -171,6 +190,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
}
private Drawable preview;
private void showPreview()
{
if (preview?.IsAlive != true)
@ -225,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

@ -25,9 +25,9 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
[BackgroundDependencyLoader]
private void load(BeatmapManager beatmaps, 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 +35,25 @@ 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",
Action = () =>
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
{
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
{
deleteBeatmapsButton.Enabled.Value = false;
Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
}));
}
},
importSkinsButton = new SettingsButton
deleteBeatmapsButton.Enabled.Value = false;
Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
}));
}
});
if (skins.SupportsImportFromStable)
{
Add(importSkinsButton = new SettingsButton
{
Text = "Import skins from stable",
Action = () =>
@ -56,7 +61,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 +100,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

@ -14,8 +14,8 @@ namespace osu.Game.Overlays.Settings
public override string LabelText
{
get { return checkbox.LabelText; }
set { checkbox.LabelText = value; }
get => checkbox.LabelText;
set => checkbox.LabelText = value;
}
}
}

View File

@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
@ -26,11 +27,25 @@ namespace osu.Game.Overlays.Settings
}
}
private IBindableList<T> itemSource;
public IBindableList<T> ItemSource
{
get => itemSource;
set
{
itemSource = value;
if (Control != null)
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 { Items = Items, ItemSource = ItemSource };
protected class DropdownControl : OsuDropdown<T>
{

View File

@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Settings
public virtual string LabelText
{
get { return text?.Text ?? string.Empty; }
get => text?.Text ?? string.Empty;
set
{
if (text == null)
@ -58,7 +58,7 @@ namespace osu.Game.Overlays.Settings
public virtual Bindable<T> Bindable
{
get { return bindable; }
get => bindable;
set
{
@ -76,11 +76,7 @@ namespace osu.Game.Overlays.Settings
public bool MatchingFilter
{
set
{
// probably needs a better transition.
this.FadeTo(value ? 1 : 0);
}
set => this.FadeTo(value ? 1 : 0);
}
protected SettingsItem()
@ -115,7 +111,7 @@ namespace osu.Game.Overlays.Settings
public Bindable<T> Bindable
{
get { return bindable; }
get => bindable;
set
{
bindable = value;

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Settings
public bool MatchingFilter
{
set { this.FadeTo(value ? 1 : 0); }
set => this.FadeTo(value ? 1 : 0);
}
protected SettingsSection()

View File

@ -22,12 +22,10 @@ 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);
}
protected SettingsSubsection()

View File

@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Settings
public ExpandedState State
{
get { return state; }
get => state;
set
{
expandEvent?.Cancel();

View File

@ -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,9 +39,10 @@ namespace osu.Game.Overlays.Settings
}
private bool selected;
public bool Selected
{
get { return selected; }
get => selected;
set
{
selected = value;