diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs
index 76d06f3665..d464c97621 100644
--- a/osu.Game/Configuration/OsuConfigManager.cs
+++ b/osu.Game/Configuration/OsuConfigManager.cs
@@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System;
-using System.Diagnostics;
using osu.Framework;
using osu.Framework.Bindables;
using osu.Framework.Configuration;
@@ -35,6 +34,11 @@ namespace osu.Game.Configuration
Migrate();
}
+ ///
+ /// For a given , return a human-readable string representing the bindings bound to the action.
+ ///
+ public LocalisableString LookupKeyBindings(GlobalAction action) => LookupKeyBindingsFunc(action);
+
protected override void InitialiseDefaults()
{
// UI/selection defaults
@@ -263,10 +267,6 @@ namespace osu.Game.Configuration
public override TrackedSettings CreateTrackedSettings()
{
- // these need to be assigned in normal game startup scenarios.
- Debug.Assert(LookupKeyBindings != null);
- Debug.Assert(LookupSkinName != null);
-
return new TrackedSettings
{
new TrackedSetting(OsuSetting.ShowFpsDisplay, state => new SettingDescription(
@@ -308,7 +308,7 @@ namespace osu.Game.Configuration
string skinName = string.Empty;
if (Guid.TryParse(skin, out var id))
- skinName = LookupSkinName(id);
+ skinName = LookupSkinNameFunc(id);
return new SettingDescription(
rawValue: skinName,
@@ -329,9 +329,8 @@ namespace osu.Game.Configuration
};
}
- public Func LookupSkinName { private get; set; } = _ => @"unknown";
-
- public Func LookupKeyBindings { get; set; } = _ => @"unknown";
+ public Func LookupSkinNameFunc { private get; set; } = _ => @"unknown";
+ public Func LookupKeyBindingsFunc { private get; set; } = _ => @"unknown";
IBindable IGameplaySettings.ComboColourNormalisationAmount => GetOriginalBindable(OsuSetting.ComboColourNormalisationAmount);
IBindable IGameplaySettings.PositionalHitsoundsLevel => GetOriginalBindable(OsuSetting.PositionalHitsoundsLevel);
diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs
index 3381553970..558242b37b 100644
--- a/osu.Game/OsuGame.cs
+++ b/osu.Game/OsuGame.cs
@@ -979,9 +979,9 @@ namespace osu.Game
// make config aware of how to lookup skins for on-screen display purposes.
// if this becomes a more common thing, tracked settings should be reconsidered to allow local DI.
- LocalConfig.LookupSkinName = id => SkinManager.Query(s => s.ID == id)?.ToString() ?? "Unknown";
+ LocalConfig.LookupSkinNameFunc = id => SkinManager.Query(s => s.ID == id)?.ToString() ?? "Unknown";
- LocalConfig.LookupKeyBindings = l =>
+ LocalConfig.LookupKeyBindingsFunc = l =>
{
var combinations = KeyBindingStore.GetReadableKeyCombinationsFor(l);
diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs
index 83c94ab534..7b9a4d34ca 100644
--- a/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs
+++ b/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs
@@ -44,13 +44,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
- TextBox.PlaceholderText = ChatStrings.InGameInputPlaceholder(config.LookupKeyBindings(GlobalAction.ToggleChatFocus));
+ resetPlaceholderText();
TextBox.Focus = () => TextBox.PlaceholderText = Resources.Localisation.Web.ChatStrings.InputPlaceholder;
TextBox.FocusLost = () =>
{
- TextBox.PlaceholderText = ChatStrings.InGameInputPlaceholder(config.LookupKeyBindings(GlobalAction.ToggleChatFocus));
+ resetPlaceholderText();
expandedFromTextBoxFocus.Value = false;
};
+
+ void resetPlaceholderText() => TextBox.PlaceholderText = ChatStrings.InGameInputPlaceholder(config.LookupKeyBindings(GlobalAction.ToggleChatFocus));
}
protected override bool OnHover(HoverEvent e) => true; // use UI mouse cursor.