mirror of
https://github.com/ppy/osu.git
synced 2025-03-17 17:17:19 +08:00
Merge pull request #1879 from UselessToucan/VisualSettingsOverlay
Implement a gameplay visual settings overlay
This commit is contained in:
commit
2971991dfe
@ -4,7 +4,7 @@
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Screens.Play.ReplaySettings;
|
||||
using osu.Game.Screens.Play.PlayerSettings;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
ExampleContainer container;
|
||||
|
||||
Add(new ReplaySettingsOverlay
|
||||
Add(new PlayerSettingsOverlay
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual
|
||||
Text = @"Button",
|
||||
}));
|
||||
|
||||
AddStep(@"Add checkbox", () => container.Add(new ReplayCheckbox
|
||||
AddStep(@"Add checkbox", () => container.Add(new PlayerCheckbox
|
||||
{
|
||||
LabelText = "Checkbox",
|
||||
}));
|
||||
@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual
|
||||
}));
|
||||
}
|
||||
|
||||
private class ExampleContainer : ReplayGroup
|
||||
private class ExampleContainer : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => @"example";
|
||||
}
|
||||
|
@ -2,11 +2,11 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Screens.Play.ReplaySettings;
|
||||
using osu.Game.Screens.Play.PlayerSettings;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
public class ToolboxGroup : ReplayGroup
|
||||
public class ToolboxGroup : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => "toolbox";
|
||||
|
||||
|
@ -3,29 +3,30 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Screens.Play.ReplaySettings;
|
||||
using OpenTK;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Screens.Play.PlayerSettings;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class ReplaySettingsOverlay : VisibilityContainer
|
||||
public class PlayerSettingsOverlay : VisibilityContainer
|
||||
{
|
||||
private const int fade_duration = 200;
|
||||
|
||||
public bool ReplayLoaded;
|
||||
|
||||
public readonly PlaybackSettings PlaybackSettings;
|
||||
public readonly VisualSettings VisualSettings;
|
||||
//public readonly CollectionSettings CollectionSettings;
|
||||
//public readonly DiscussionSettings DiscussionSettings;
|
||||
|
||||
public ReplaySettingsOverlay()
|
||||
public PlayerSettingsOverlay()
|
||||
{
|
||||
AlwaysPresent = true;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
Child = new FillFlowContainer<ReplayGroup>
|
||||
Child = new FillFlowContainer<PlayerSettingsGroup>
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
@ -33,11 +34,12 @@ namespace osu.Game.Screens.Play.HUD
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 20),
|
||||
Margin = new MarginPadding { Top = 100, Right = 10 },
|
||||
Children = new[]
|
||||
Children = new PlayerSettingsGroup[]
|
||||
{
|
||||
//CollectionSettings = new CollectionSettings(),
|
||||
//DiscussionSettings = new DiscussionSettings(),
|
||||
PlaybackSettings = new PlaybackSettings(),
|
||||
VisualSettings = new VisualSettings()
|
||||
}
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Screens.Play
|
||||
public readonly HealthDisplay HealthDisplay;
|
||||
public readonly SongProgress Progress;
|
||||
public readonly ModDisplay ModDisplay;
|
||||
public readonly ReplaySettingsOverlay ReplaySettingsOverlay;
|
||||
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
||||
|
||||
private Bindable<bool> showHud;
|
||||
private readonly BindableBool replayLoaded = new BindableBool();
|
||||
@ -58,7 +58,7 @@ namespace osu.Game.Screens.Play
|
||||
HealthDisplay = CreateHealthDisplay(),
|
||||
Progress = CreateProgress(),
|
||||
ModDisplay = CreateModsContainer(),
|
||||
ReplaySettingsOverlay = CreateReplaySettingsOverlay(),
|
||||
PlayerSettingsOverlay = CreatePlayerSettingsOverlay()
|
||||
}
|
||||
});
|
||||
|
||||
@ -72,7 +72,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
ModDisplay.Current.BindTo(working.Mods);
|
||||
|
||||
ReplaySettingsOverlay.PlaybackSettings.AdjustableClock = adjustableSourceClock;
|
||||
PlayerSettingsOverlay.PlaybackSettings.AdjustableClock = adjustableSourceClock;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
@ -115,16 +115,16 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private void replayLoadedValueChanged(bool loaded)
|
||||
{
|
||||
ReplaySettingsOverlay.ReplayLoaded = loaded;
|
||||
PlayerSettingsOverlay.ReplayLoaded = loaded;
|
||||
|
||||
if (loaded)
|
||||
{
|
||||
ReplaySettingsOverlay.Show();
|
||||
PlayerSettingsOverlay.Show();
|
||||
ModDisplay.FadeIn(200);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReplaySettingsOverlay.Hide();
|
||||
PlayerSettingsOverlay.Hide();
|
||||
ModDisplay.Delay(2000).FadeOut(200);
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ namespace osu.Game.Screens.Play
|
||||
Margin = new MarginPadding { Top = 20, Right = 10 },
|
||||
};
|
||||
|
||||
protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay();
|
||||
protected virtual PlayerSettingsOverlay CreatePlayerSettingsOverlay() => new PlayerSettingsOverlay();
|
||||
|
||||
protected virtual void BindProcessor(ScoreProcessor processor)
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ using osu.Game.Screens.Backgrounds;
|
||||
using OpenTK;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Play.PlayerSettings;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -21,6 +22,7 @@ namespace osu.Game.Screens.Play
|
||||
private Player player;
|
||||
|
||||
private BeatmapMetadataDisplay info;
|
||||
private VisualSettings visualSettings;
|
||||
|
||||
private bool showOverlays = true;
|
||||
public override bool ShowOverlaysOnEnter => showOverlays;
|
||||
@ -49,6 +51,12 @@ namespace osu.Game.Screens.Play
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
});
|
||||
Add(visualSettings = new VisualSettings
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Margin = new MarginPadding(25)
|
||||
});
|
||||
|
||||
LoadComponentAsync(player);
|
||||
}
|
||||
@ -110,7 +118,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private void pushWhenLoaded()
|
||||
{
|
||||
if (player.LoadState != LoadState.Ready)
|
||||
if (player.LoadState != LoadState.Ready || visualSettings.IsHovered)
|
||||
{
|
||||
Schedule(pushWhenLoaded);
|
||||
return;
|
||||
|
@ -1,15 +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
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Music;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Screens.Play.ReplaySettings
|
||||
namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class CollectionSettings : ReplayGroup
|
||||
public class CollectionSettings : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => @"collections";
|
||||
|
@ -6,9 +6,9 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Screens.Play.ReplaySettings
|
||||
namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class DiscussionSettings : ReplayGroup
|
||||
public class DiscussionSettings : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => @"discussions";
|
||||
|
||||
@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play.ReplaySettings
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ReplayCheckbox
|
||||
new PlayerCheckbox
|
||||
{
|
||||
LabelText = "Show floating comments",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.FloatingComments)
|
@ -1,15 +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
|
||||
|
||||
using osu.Framework.Timing;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Screens.Play.ReplaySettings
|
||||
namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class PlaybackSettings : ReplayGroup
|
||||
public class PlaybackSettings : PlayerSettingsGroup
|
||||
{
|
||||
private const int padding = 10;
|
||||
|
||||
@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play.ReplaySettings
|
||||
|
||||
public IAdjustableClock AdjustableClock { set; get; }
|
||||
|
||||
private readonly ReplaySliderBar<double> sliderbar;
|
||||
private readonly PlayerSliderBar<double> sliderbar;
|
||||
|
||||
public PlaybackSettings()
|
||||
{
|
||||
@ -47,7 +47,7 @@ namespace osu.Game.Screens.Play.ReplaySettings
|
||||
}
|
||||
},
|
||||
},
|
||||
sliderbar = new ReplaySliderBar<double>
|
||||
sliderbar = new PlayerSliderBar<double>
|
||||
{
|
||||
Bindable = new BindableDouble(1)
|
||||
{
|
@ -5,9 +5,9 @@ using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Screens.Play.ReplaySettings
|
||||
namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class ReplayCheckbox : OsuCheckbox
|
||||
public class PlayerCheckbox : OsuCheckbox
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
@ -1,8 +1,6 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -10,10 +8,12 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play.ReplaySettings
|
||||
namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public abstract class ReplayGroup : Container
|
||||
public abstract class PlayerSettingsGroup : Container
|
||||
{
|
||||
/// <summary>
|
||||
/// The title to be displayed in the header of this group.
|
||||
@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play.ReplaySettings
|
||||
|
||||
private Color4 buttonActiveColour;
|
||||
|
||||
protected ReplayGroup()
|
||||
protected PlayerSettingsGroup()
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Width = container_width;
|
@ -1,16 +1,16 @@
|
||||
// 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.Graphics.UserInterface;
|
||||
using System;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Settings;
|
||||
|
||||
namespace osu.Game.Screens.Play.ReplaySettings
|
||||
namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class ReplaySliderBar<T> : SettingsSlider<T>
|
||||
public class PlayerSliderBar<T> : SettingsSlider<T>
|
||||
where T : struct, IEquatable<T>, IComparable, IConvertible
|
||||
{
|
||||
protected override Drawable CreateControl() => new Sliderbar
|
52
osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs
Normal file
52
osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs
Normal file
@ -0,0 +1,52 @@
|
||||
// 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.Configuration;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class VisualSettings : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => "Visual settings";
|
||||
|
||||
private readonly PlayerSliderBar<double> dimSliderBar;
|
||||
private readonly PlayerSliderBar<double> blurSliderBar;
|
||||
private readonly PlayerCheckbox showStoryboardToggle;
|
||||
private readonly PlayerCheckbox mouseWheelDisabledToggle;
|
||||
|
||||
public VisualSettings()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "Background dim:"
|
||||
},
|
||||
dimSliderBar = new PlayerSliderBar<double>(),
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "Background blur:"
|
||||
},
|
||||
blurSliderBar = new PlayerSliderBar<double>(),
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "Toggles:"
|
||||
},
|
||||
showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" },
|
||||
mouseWheelDisabledToggle = new PlayerCheckbox { LabelText = "Disable mouse wheel" }
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
mouseWheelDisabledToggle.Bindable = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
||||
}
|
||||
}
|
||||
}
|
@ -339,6 +339,7 @@
|
||||
<Compile Include="Overlays\Social\SocialListPanel.cs" />
|
||||
<Compile Include="Overlays\Social\SocialPanel.cs" />
|
||||
<Compile Include="Rulesets\Mods\IApplicableToDrawableHitObject.cs" />
|
||||
<Compile Include="Screens\Play\PlayerSettings\VisualSettings.cs" />
|
||||
<Compile Include="Rulesets\UI\HitObjectContainer.cs" />
|
||||
<Compile Include="Rulesets\UI\Scrolling\Visualisers\SequentialSpeedChangeVisualiser.cs" />
|
||||
<Compile Include="Rulesets\UI\Scrolling\Visualisers\ISpeedChangeVisualiser.cs" />
|
||||
@ -769,13 +770,13 @@
|
||||
<Compile Include="Screens\Play\Player.cs" />
|
||||
<Compile Include="Screens\Play\PlayerLoader.cs" />
|
||||
<Compile Include="Screens\Play\ReplayPlayer.cs" />
|
||||
<Compile Include="Screens\Play\HUD\ReplaySettingsOverlay.cs" />
|
||||
<Compile Include="Screens\Play\ReplaySettings\CollectionSettings.cs" />
|
||||
<Compile Include="Screens\Play\ReplaySettings\DiscussionSettings.cs" />
|
||||
<Compile Include="Screens\Play\ReplaySettings\PlaybackSettings.cs" />
|
||||
<Compile Include="Screens\Play\ReplaySettings\ReplayCheckbox.cs" />
|
||||
<Compile Include="Screens\Play\ReplaySettings\ReplayGroup.cs" />
|
||||
<Compile Include="Screens\Play\ReplaySettings\ReplaySliderBar.cs" />
|
||||
<Compile Include="Screens\Play\HUD\PlayerSettingsOverlay.cs" />
|
||||
<Compile Include="Screens\Play\PlayerSettings\CollectionSettings.cs" />
|
||||
<Compile Include="Screens\Play\PlayerSettings\DiscussionSettings.cs" />
|
||||
<Compile Include="Screens\Play\PlayerSettings\PlaybackSettings.cs" />
|
||||
<Compile Include="Screens\Play\PlayerSettings\PlayerCheckbox.cs" />
|
||||
<Compile Include="Screens\Play\PlayerSettings\PlayerSettingsGroup.cs" />
|
||||
<Compile Include="Screens\Play\PlayerSettings\PlayerSliderBar.cs" />
|
||||
<Compile Include="Screens\Play\SkipButton.cs" />
|
||||
<Compile Include="Screens\Play\SongProgress.cs" />
|
||||
<Compile Include="Screens\Play\SongProgressBar.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user