mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into consistent-terminology-format
This commit is contained in:
@ -1,26 +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.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
{
|
||||
public class ScrollingSettings : SettingsSubsection
|
||||
{
|
||||
protected override string Header => "Scrolling";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new SettingsEnumDropdown<SpeedChangeVisualisationMethod>
|
||||
{
|
||||
LabelText = "Visualise speed changes as",
|
||||
Bindable = config.GetBindable<SpeedChangeVisualisationMethod>(OsuSetting.SpeedChangeVisualisation),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -21,7 +21,6 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
{
|
||||
new GeneralSettings(),
|
||||
new SongSelectSettings(),
|
||||
new ScrollingSettings(),
|
||||
new ModsSettings(),
|
||||
};
|
||||
}
|
||||
@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets)
|
||||
{
|
||||
foreach(Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance()))
|
||||
foreach (Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance()))
|
||||
{
|
||||
SettingsSubsection section = ruleset.CreateSettings();
|
||||
if (section != null)
|
||||
|
@ -16,7 +16,7 @@ using System.ComponentModel;
|
||||
using osu.Game.Graphics;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Framework.Input.Events;
|
||||
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
|
||||
using Container = osu.Framework.Graphics.Containers.Container;
|
||||
|
||||
@ -175,12 +175,12 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
|
||||
public override bool AcceptsFocus => true;
|
||||
|
||||
protected override bool OnClick(InputState state) => true;
|
||||
protected override bool OnClick(ClickEvent e) => true;
|
||||
|
||||
protected override void OnFocus(InputState state)
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
if (form != null) GetContainingInputManager().ChangeFocus(form);
|
||||
base.OnFocus(state);
|
||||
base.OnFocus(e);
|
||||
}
|
||||
|
||||
private class LoginForm : FillFlowContainer
|
||||
@ -244,9 +244,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
|
||||
public override bool AcceptsFocus => true;
|
||||
|
||||
protected override bool OnClick(InputState state) => true;
|
||||
protected override bool OnClick(ClickEvent e) => true;
|
||||
|
||||
protected override void OnFocus(InputState state)
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
Schedule(() => { GetContainingInputManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); });
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
letterboxing = config.GetBindable<bool>(FrameworkSetting.Letterboxing);
|
||||
sizeFullscreen = config.GetBindable<Size>(FrameworkSetting.SizeFullscreen);
|
||||
|
||||
Container resolutionSettingsContainer;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
windowModeDropdown = new SettingsEnumDropdown<WindowMode>
|
||||
@ -42,12 +44,10 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
LabelText = "Screen mode",
|
||||
Bindable = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode),
|
||||
},
|
||||
resolutionDropdown = new SettingsDropdown<Size>
|
||||
resolutionSettingsContainer = new Container
|
||||
{
|
||||
LabelText = "Resolution",
|
||||
ShowsDefaultIndicator = false,
|
||||
Items = getResolutions(),
|
||||
Bindable = sizeFullscreen
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
@ -81,16 +81,29 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
},
|
||||
};
|
||||
|
||||
windowModeDropdown.Bindable.BindValueChanged(windowMode =>
|
||||
var resolutions = getResolutions();
|
||||
|
||||
if (resolutions.Count > 1)
|
||||
{
|
||||
if (windowMode == WindowMode.Fullscreen)
|
||||
resolutionSettingsContainer.Child = resolutionDropdown = new SettingsDropdown<Size>
|
||||
{
|
||||
resolutionDropdown.Show();
|
||||
sizeFullscreen.TriggerChange();
|
||||
}
|
||||
else
|
||||
resolutionDropdown.Hide();
|
||||
}, true);
|
||||
LabelText = "Resolution",
|
||||
ShowsDefaultIndicator = false,
|
||||
Items = resolutions,
|
||||
Bindable = sizeFullscreen
|
||||
};
|
||||
|
||||
windowModeDropdown.Bindable.BindValueChanged(windowMode =>
|
||||
{
|
||||
if (windowMode == WindowMode.Fullscreen)
|
||||
{
|
||||
resolutionDropdown.Show();
|
||||
sizeFullscreen.TriggerChange();
|
||||
}
|
||||
else
|
||||
resolutionDropdown.Hide();
|
||||
}, true);
|
||||
}
|
||||
|
||||
letterboxing.BindValueChanged(isVisible =>
|
||||
{
|
||||
@ -102,7 +115,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
}, true);
|
||||
}
|
||||
|
||||
private IEnumerable<KeyValuePair<string, Size>> getResolutions()
|
||||
private IReadOnlyList<KeyValuePair<string, Size>> getResolutions()
|
||||
{
|
||||
var resolutions = new KeyValuePair<string, Size>("Default", new Size(9999, 9999)).Yield();
|
||||
|
||||
@ -112,8 +125,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
.OrderByDescending(r => r.Width)
|
||||
.ThenByDescending(r => r.Height)
|
||||
.Select(res => new KeyValuePair<string, Size>($"{res.Width}x{res.Height}", new Size(res.Width, res.Height)))
|
||||
.Distinct()).ToList();
|
||||
return resolutions;
|
||||
.Distinct());
|
||||
return resolutions.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
@ -124,18 +124,18 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
|
||||
private bool isDragging;
|
||||
|
||||
protected override bool OnDragStart(InputState state)
|
||||
protected override bool OnDragStart(DragStartEvent e)
|
||||
{
|
||||
isDragging = true;
|
||||
return base.OnDragStart(state);
|
||||
return base.OnDragStart(e);
|
||||
}
|
||||
|
||||
protected override bool OnDragEnd(InputState state)
|
||||
protected override bool OnDragEnd(DragEndEvent e)
|
||||
{
|
||||
isDragging = false;
|
||||
Current.TriggerChange();
|
||||
|
||||
return base.OnDragEnd(state);
|
||||
return base.OnDragEnd(e);
|
||||
}
|
||||
|
||||
public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : Current.Value.ToString(@"0.##x");
|
||||
|
@ -13,57 +13,59 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
{
|
||||
public class GeneralSettings : SettingsSubsection
|
||||
{
|
||||
private TriangleButton importButton;
|
||||
private TriangleButton deleteButton;
|
||||
protected override string Header => "General";
|
||||
|
||||
private TriangleButton importBeatmapsButton;
|
||||
private TriangleButton importSkinsButton;
|
||||
private TriangleButton deleteSkinsButton;
|
||||
private TriangleButton deleteBeatmapsButton;
|
||||
private TriangleButton restoreButton;
|
||||
private TriangleButton undeleteButton;
|
||||
|
||||
protected override string Header => "General";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapManager beatmaps, SkinManager skins, DialogOverlay dialogOverlay)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
importButton = new SettingsButton
|
||||
importBeatmapsButton = new SettingsButton
|
||||
{
|
||||
Text = "Import beatmaps from stable",
|
||||
Action = () =>
|
||||
{
|
||||
importButton.Enabled.Value = false;
|
||||
beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importButton.Enabled.Value = true));
|
||||
importBeatmapsButton.Enabled.Value = false;
|
||||
beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true));
|
||||
}
|
||||
},
|
||||
deleteButton = new DangerousSettingsButton
|
||||
deleteBeatmapsButton = new DangerousSettingsButton
|
||||
{
|
||||
Text = "Delete ALL beatmaps",
|
||||
Action = () =>
|
||||
{
|
||||
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
|
||||
{
|
||||
deleteButton.Enabled.Value = false;
|
||||
Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true));
|
||||
deleteBeatmapsButton.Enabled.Value = false;
|
||||
Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
|
||||
}));
|
||||
}
|
||||
},
|
||||
importButton = new SettingsButton
|
||||
importSkinsButton = new SettingsButton
|
||||
{
|
||||
Text = "Import skins from stable",
|
||||
Action = () =>
|
||||
{
|
||||
importButton.Enabled.Value = false;
|
||||
skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importButton.Enabled.Value = true));
|
||||
importSkinsButton.Enabled.Value = false;
|
||||
skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true));
|
||||
}
|
||||
},
|
||||
deleteButton = new DangerousSettingsButton
|
||||
deleteSkinsButton = new DangerousSettingsButton
|
||||
{
|
||||
Text = "Delete ALL skins",
|
||||
Action = () =>
|
||||
{
|
||||
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
|
||||
{
|
||||
deleteButton.Enabled.Value = false;
|
||||
Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true));
|
||||
deleteSkinsButton.Enabled.Value = false;
|
||||
Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true));
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
@ -12,8 +12,7 @@ using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.EventArgs;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
@ -168,25 +167,25 @@ namespace osu.Game.Overlays.Settings
|
||||
|
||||
public string TooltipText => "Revert to default";
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
||||
|
||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => true;
|
||||
protected override bool OnMouseUp(MouseUpEvent e) => true;
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (bindable != null && !bindable.Disabled)
|
||||
bindable.SetDefault();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
hovering = true;
|
||||
UpdateState();
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
hovering = false;
|
||||
UpdateState();
|
||||
|
@ -9,7 +9,7 @@ using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Overlays.Toolbar;
|
||||
|
||||
@ -55,25 +55,25 @@ namespace osu.Game.Overlays.Settings
|
||||
private ScheduledDelegate expandEvent;
|
||||
private ExpandedState state;
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
queueExpandIfHovering();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
expandEvent?.Cancel();
|
||||
lastHoveredButton = null;
|
||||
State = ExpandedState.Contracted;
|
||||
|
||||
base.OnHoverLost(state);
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
protected override bool OnMouseMove(InputState state)
|
||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||
{
|
||||
queueExpandIfHovering();
|
||||
return base.OnMouseMove(state);
|
||||
return base.OnMouseMove(e);
|
||||
}
|
||||
|
||||
private class SidebarScrollContainer : ScrollContainer
|
||||
|
@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -109,22 +109,22 @@ namespace osu.Game.Overlays.Settings
|
||||
selectionIndicator.Colour = colours.Yellow;
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
Action?.Invoke(section);
|
||||
return base.OnClick(state);
|
||||
return base.OnClick(e);
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
Background.FadeTo(0.4f, 200);
|
||||
return base.OnHover(state);
|
||||
return base.OnHover(e);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
Background.FadeTo(0, 200);
|
||||
base.OnHoverLost(state);
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user