mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 14:43:02 +08:00
Merge pull request #12675 from Joehuu/settings-item-notes
This commit is contained in:
commit
a2ad079b8a
@ -141,7 +141,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
|
|
||||||
scalingSettings.ForEach(s => bindPreviewEvent(s.Current));
|
scalingSettings.ForEach(s => bindPreviewEvent(s.Current));
|
||||||
|
|
||||||
windowModeDropdown.Current.ValueChanged += _ => updateResolutionDropdown();
|
windowModeDropdown.Current.BindValueChanged(mode =>
|
||||||
|
{
|
||||||
|
updateResolutionDropdown();
|
||||||
|
|
||||||
|
const string not_fullscreen_note = "Running without fullscreen mode will increase your input latency!";
|
||||||
|
|
||||||
|
windowModeDropdown.WarningText = mode.NewValue != WindowMode.Fullscreen ? not_fullscreen_note : string.Empty;
|
||||||
|
}, true);
|
||||||
|
|
||||||
windowModes.BindCollectionChanged((sender, args) =>
|
windowModes.BindCollectionChanged((sender, args) =>
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
{
|
{
|
||||||
protected override string Header => "Renderer";
|
protected override string Header => "Renderer";
|
||||||
|
|
||||||
|
private SettingsEnumDropdown<FrameSync> frameLimiterDropdown;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig)
|
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig)
|
||||||
{
|
{
|
||||||
@ -20,7 +22,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
// TODO: this needs to be a custom dropdown at some point
|
// TODO: this needs to be a custom dropdown at some point
|
||||||
new SettingsEnumDropdown<FrameSync>
|
frameLimiterDropdown = new SettingsEnumDropdown<FrameSync>
|
||||||
{
|
{
|
||||||
LabelText = "Frame limiter",
|
LabelText = "Frame limiter",
|
||||||
Current = config.GetBindable<FrameSync>(FrameworkSetting.FrameSync)
|
Current = config.GetBindable<FrameSync>(FrameworkSetting.FrameSync)
|
||||||
@ -37,5 +39,17 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
frameLimiterDropdown.Current.BindValueChanged(limit =>
|
||||||
|
{
|
||||||
|
const string unlimited_frames_note = "Using unlimited frame limiter can lead to stutters, bad performance and overheating. It will not improve perceived latency. \"2x refresh rate\" is recommended.";
|
||||||
|
|
||||||
|
frameLimiterDropdown.WarningText = limit.NewValue == FrameSync.Unlimited ? unlimited_frames_note : string.Empty;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,11 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
||||||
{
|
{
|
||||||
@ -11,9 +14,15 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
{
|
{
|
||||||
protected override string Header => "Main Menu";
|
protected override string Header => "Main Menu";
|
||||||
|
|
||||||
|
private IBindable<User> user;
|
||||||
|
|
||||||
|
private SettingsEnumDropdown<BackgroundSource> backgroundSourceDropdown;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config, IAPIProvider api)
|
||||||
{
|
{
|
||||||
|
user = api.LocalUser.GetBoundCopy();
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
@ -31,7 +40,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
LabelText = "Intro sequence",
|
LabelText = "Intro sequence",
|
||||||
Current = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence),
|
Current = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence),
|
||||||
},
|
},
|
||||||
new SettingsEnumDropdown<BackgroundSource>
|
backgroundSourceDropdown = new SettingsEnumDropdown<BackgroundSource>
|
||||||
{
|
{
|
||||||
LabelText = "Background source",
|
LabelText = "Background source",
|
||||||
Current = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource),
|
Current = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource),
|
||||||
@ -43,5 +52,17 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
backgroundSourceDropdown.Current.BindValueChanged(source =>
|
||||||
|
{
|
||||||
|
const string not_supporter_note = "Changes to this setting will only apply with an active osu!supporter tag.";
|
||||||
|
|
||||||
|
backgroundSourceDropdown.WarningText = user.Value?.IsSupporter != true ? not_supporter_note : string.Empty;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
{
|
{
|
||||||
@ -36,10 +36,15 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
private SpriteText labelText;
|
private SpriteText labelText;
|
||||||
|
|
||||||
|
private OsuTextFlowContainer warningText;
|
||||||
|
|
||||||
public bool ShowsDefaultIndicator = true;
|
public bool ShowsDefaultIndicator = true;
|
||||||
|
|
||||||
public string TooltipText { get; set; }
|
public string TooltipText { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
public virtual LocalisableString LabelText
|
public virtual LocalisableString LabelText
|
||||||
{
|
{
|
||||||
get => labelText?.Text ?? string.Empty;
|
get => labelText?.Text ?? string.Empty;
|
||||||
@ -57,6 +62,31 @@ namespace osu.Game.Overlays.Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text to be displayed at the bottom of this <see cref="SettingsItem{T}"/>.
|
||||||
|
/// Generally used to recommend the user change their setting as the current one is considered sub-optimal.
|
||||||
|
/// </summary>
|
||||||
|
public string WarningText
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (warningText == null)
|
||||||
|
{
|
||||||
|
// construct lazily for cases where the label is not needed (may be provided by the Control).
|
||||||
|
FlowContent.Add(warningText = new OsuTextFlowContainer
|
||||||
|
{
|
||||||
|
Colour = colours.Yellow,
|
||||||
|
Margin = new MarginPadding { Bottom = 5 },
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
warningText.Alpha = string.IsNullOrWhiteSpace(value) ? 0 : 1;
|
||||||
|
warningText.Text = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual Bindable<T> Current
|
public virtual Bindable<T> Current
|
||||||
{
|
{
|
||||||
get => controlWithCurrent.Current;
|
get => controlWithCurrent.Current;
|
||||||
@ -92,7 +122,10 @@ namespace osu.Game.Overlays.Settings
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS },
|
Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS },
|
||||||
Child = Control = CreateControl()
|
Children = new[]
|
||||||
|
{
|
||||||
|
Control = CreateControl(),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -141,6 +174,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
Width = SettingsPanel.CONTENT_MARGINS;
|
Width = SettingsPanel.CONTENT_MARGINS;
|
||||||
|
Padding = new MarginPadding { Vertical = 1.5f };
|
||||||
Alpha = 0f;
|
Alpha = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +197,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Radius = 2,
|
Radius = 2,
|
||||||
},
|
},
|
||||||
Size = new Vector2(0.33f, 0.8f),
|
Width = 0.33f,
|
||||||
Child = new Box { RelativeSizeAxes = Axes.Both },
|
Child = new Box { RelativeSizeAxes = Axes.Both },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -196,12 +230,6 @@ namespace osu.Game.Overlays.Settings
|
|||||||
UpdateState();
|
UpdateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetButtonColour(Color4 buttonColour)
|
|
||||||
{
|
|
||||||
this.buttonColour = buttonColour;
|
|
||||||
UpdateState();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateState() => Scheduler.AddOnce(updateState);
|
public void UpdateState() => Scheduler.AddOnce(updateState);
|
||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
|
Loading…
Reference in New Issue
Block a user