mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 05:52:55 +08:00
Merge branch 'master' into fix-unsafe-realm-access
This commit is contained in:
commit
4f47b196c1
@ -84,12 +84,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestFocusOnTabKeyWhenExpanded()
|
public void TestFocusOnEnterKeyWhenExpanded()
|
||||||
{
|
{
|
||||||
setLocalUserPlaying(true);
|
setLocalUserPlaying(true);
|
||||||
|
|
||||||
assertChatFocused(false);
|
assertChatFocused(false);
|
||||||
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||||
assertChatFocused(true);
|
assertChatFocused(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,19 +99,19 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
setLocalUserPlaying(true);
|
setLocalUserPlaying(true);
|
||||||
|
|
||||||
assertChatFocused(false);
|
assertChatFocused(false);
|
||||||
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||||
assertChatFocused(true);
|
assertChatFocused(true);
|
||||||
AddStep("press escape", () => InputManager.Key(Key.Escape));
|
AddStep("press escape", () => InputManager.Key(Key.Escape));
|
||||||
assertChatFocused(false);
|
assertChatFocused(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestFocusOnTabKeyWhenNotExpanded()
|
public void TestFocusOnEnterKeyWhenNotExpanded()
|
||||||
{
|
{
|
||||||
AddStep("set not expanded", () => chatDisplay.Expanded.Value = false);
|
AddStep("set not expanded", () => chatDisplay.Expanded.Value = false);
|
||||||
AddUntilStep("is not visible", () => !chatDisplay.IsPresent);
|
AddUntilStep("is not visible", () => !chatDisplay.IsPresent);
|
||||||
|
|
||||||
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||||
assertChatFocused(true);
|
assertChatFocused(true);
|
||||||
AddUntilStep("is visible", () => chatDisplay.IsPresent);
|
AddUntilStep("is visible", () => chatDisplay.IsPresent);
|
||||||
|
|
||||||
@ -120,21 +120,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddUntilStep("is not visible", () => !chatDisplay.IsPresent);
|
AddUntilStep("is not visible", () => !chatDisplay.IsPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestFocusToggleViaAction()
|
|
||||||
{
|
|
||||||
AddStep("set not expanded", () => chatDisplay.Expanded.Value = false);
|
|
||||||
AddUntilStep("is not visible", () => !chatDisplay.IsPresent);
|
|
||||||
|
|
||||||
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
|
||||||
assertChatFocused(true);
|
|
||||||
AddUntilStep("is visible", () => chatDisplay.IsPresent);
|
|
||||||
|
|
||||||
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
|
||||||
assertChatFocused(false);
|
|
||||||
AddUntilStep("is not visible", () => !chatDisplay.IsPresent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void assertChatFocused(bool isFocused) =>
|
private void assertChatFocused(bool isFocused) =>
|
||||||
AddAssert($"chat {(isFocused ? "focused" : "not focused")}", () => textBox.HasFocus == isFocused);
|
AddAssert($"chat {(isFocused ? "focused" : "not focused")}", () => textBox.HasFocus == isFocused);
|
||||||
|
|
||||||
|
@ -237,6 +237,12 @@ namespace osu.Game.Configuration
|
|||||||
value: disabledState ? CommonStrings.Disabled.ToLower() : CommonStrings.Enabled.ToLower(),
|
value: disabledState ? CommonStrings.Disabled.ToLower() : CommonStrings.Enabled.ToLower(),
|
||||||
shortcut: LookupKeyBindings(GlobalAction.ToggleGameplayMouseButtons))
|
shortcut: LookupKeyBindings(GlobalAction.ToggleGameplayMouseButtons))
|
||||||
),
|
),
|
||||||
|
new TrackedSetting<bool>(OsuSetting.GameplayLeaderboard, state => new SettingDescription(
|
||||||
|
rawValue: state,
|
||||||
|
name: GlobalActionKeyBindingStrings.ToggleInGameLeaderboard,
|
||||||
|
value: state ? CommonStrings.Enabled.ToLower() : CommonStrings.Disabled.ToLower(),
|
||||||
|
shortcut: LookupKeyBindings(GlobalAction.ToggleInGameLeaderboard))
|
||||||
|
),
|
||||||
new TrackedSetting<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode, visibilityMode => new SettingDescription(
|
new TrackedSetting<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode, visibilityMode => new SettingDescription(
|
||||||
rawValue: visibilityMode,
|
rawValue: visibilityMode,
|
||||||
name: GameplaySettingsStrings.HUDVisibilityMode,
|
name: GameplaySettingsStrings.HUDVisibilityMode,
|
||||||
|
@ -82,8 +82,9 @@ namespace osu.Game.Database
|
|||||||
/// 30 2023-06-16 Run migration of old lazer scores again. This time with more correct rounding considerations.
|
/// 30 2023-06-16 Run migration of old lazer scores again. This time with more correct rounding considerations.
|
||||||
/// 31 2023-06-26 Add Version and LegacyTotalScore to ScoreInfo, set Version to 30000002 and copy TotalScore into LegacyTotalScore for legacy scores.
|
/// 31 2023-06-26 Add Version and LegacyTotalScore to ScoreInfo, set Version to 30000002 and copy TotalScore into LegacyTotalScore for legacy scores.
|
||||||
/// 32 2023-07-09 Populate legacy scores with the ScoreV2 mod (and restore TotalScore to the legacy total for such scores) using replay files.
|
/// 32 2023-07-09 Populate legacy scores with the ScoreV2 mod (and restore TotalScore to the legacy total for such scores) using replay files.
|
||||||
|
/// 33 2023-08-16 Reset default chat toggle key binding to avoid conflict with newly added leaderboard toggle key binding.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int schema_version = 32;
|
private const int schema_version = 33;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
||||||
@ -771,6 +772,7 @@ namespace osu.Game.Database
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
|
{
|
||||||
// Ctrl -/+ now adjusts UI scale so let's clear any bindings which overlap these combinations.
|
// Ctrl -/+ now adjusts UI scale so let's clear any bindings which overlap these combinations.
|
||||||
// New defaults will be populated by the key store afterwards.
|
// New defaults will be populated by the key store afterwards.
|
||||||
var keyBindings = migration.NewRealm.All<RealmKeyBinding>();
|
var keyBindings = migration.NewRealm.All<RealmKeyBinding>();
|
||||||
@ -784,6 +786,7 @@ namespace osu.Game.Database
|
|||||||
migration.NewRealm.Remove(decreaseSpeedBinding);
|
migration.NewRealm.Remove(decreaseSpeedBinding);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
// Pretty pointless to do this as beatmaps aren't really loaded via realm yet, but oh well.
|
// Pretty pointless to do this as beatmaps aren't really loaded via realm yet, but oh well.
|
||||||
@ -838,6 +841,7 @@ namespace osu.Game.Database
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
|
{
|
||||||
string keyBindingClassName = getMappedOrOriginalName(typeof(RealmKeyBinding));
|
string keyBindingClassName = getMappedOrOriginalName(typeof(RealmKeyBinding));
|
||||||
|
|
||||||
if (!migration.OldRealm.Schema.TryFindObjectSchema(keyBindingClassName, out _))
|
if (!migration.OldRealm.Schema.TryFindObjectSchema(keyBindingClassName, out _))
|
||||||
@ -864,6 +868,7 @@ namespace osu.Game.Database
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 14:
|
case 14:
|
||||||
foreach (var beatmap in migration.NewRealm.All<BeatmapInfo>())
|
foreach (var beatmap in migration.NewRealm.All<BeatmapInfo>())
|
||||||
@ -1012,6 +1017,19 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 33:
|
||||||
|
{
|
||||||
|
// Clear default bindings for the chat focus toggle,
|
||||||
|
// as they would conflict with the newly-added leaderboard toggle.
|
||||||
|
var keyBindings = migration.NewRealm.All<RealmKeyBinding>();
|
||||||
|
|
||||||
|
var toggleChatBind = keyBindings.FirstOrDefault(bind => bind.ActionInt == (int)GlobalAction.ToggleChatFocus);
|
||||||
|
if (toggleChatBind != null && toggleChatBind.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Tab }))
|
||||||
|
migration.NewRealm.Remove(toggleChatBind);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms");
|
Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms");
|
||||||
|
@ -116,9 +116,10 @@ namespace osu.Game.Input.Bindings
|
|||||||
new KeyBinding(new[] { InputKey.F3 }, GlobalAction.DecreaseScrollSpeed),
|
new KeyBinding(new[] { InputKey.F3 }, GlobalAction.DecreaseScrollSpeed),
|
||||||
new KeyBinding(new[] { InputKey.F4 }, GlobalAction.IncreaseScrollSpeed),
|
new KeyBinding(new[] { InputKey.F4 }, GlobalAction.IncreaseScrollSpeed),
|
||||||
new KeyBinding(new[] { InputKey.Shift, InputKey.Tab }, GlobalAction.ToggleInGameInterface),
|
new KeyBinding(new[] { InputKey.Shift, InputKey.Tab }, GlobalAction.ToggleInGameInterface),
|
||||||
|
new KeyBinding(InputKey.Tab, GlobalAction.ToggleInGameLeaderboard),
|
||||||
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
|
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
|
||||||
new KeyBinding(InputKey.Control, GlobalAction.HoldForHUD),
|
new KeyBinding(InputKey.Control, GlobalAction.HoldForHUD),
|
||||||
new KeyBinding(InputKey.Tab, GlobalAction.ToggleChatFocus),
|
new KeyBinding(InputKey.Enter, GlobalAction.ToggleChatFocus),
|
||||||
new KeyBinding(InputKey.F1, GlobalAction.SaveReplay),
|
new KeyBinding(InputKey.F1, GlobalAction.SaveReplay),
|
||||||
new KeyBinding(InputKey.F2, GlobalAction.ExportReplay),
|
new KeyBinding(InputKey.F2, GlobalAction.ExportReplay),
|
||||||
};
|
};
|
||||||
@ -204,7 +205,6 @@ namespace osu.Game.Input.Bindings
|
|||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleMute))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleMute))]
|
||||||
ToggleMute,
|
ToggleMute,
|
||||||
|
|
||||||
// In-Game Keybindings
|
|
||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SkipCutscene))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SkipCutscene))]
|
||||||
SkipCutscene,
|
SkipCutscene,
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ namespace osu.Game.Input.Bindings
|
|||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.QuickExit))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.QuickExit))]
|
||||||
QuickExit,
|
QuickExit,
|
||||||
|
|
||||||
// Game-wide beatmap music controller keybindings
|
|
||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.MusicNext))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.MusicNext))]
|
||||||
MusicNext,
|
MusicNext,
|
||||||
|
|
||||||
@ -260,7 +259,6 @@ namespace osu.Game.Input.Bindings
|
|||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.PauseGameplay))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.PauseGameplay))]
|
||||||
PauseGameplay,
|
PauseGameplay,
|
||||||
|
|
||||||
// Editor
|
|
||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSetupMode))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSetupMode))]
|
||||||
EditorSetupMode,
|
EditorSetupMode,
|
||||||
|
|
||||||
@ -285,7 +283,6 @@ namespace osu.Game.Input.Bindings
|
|||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleInGameInterface))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleInGameInterface))]
|
||||||
ToggleInGameInterface,
|
ToggleInGameInterface,
|
||||||
|
|
||||||
// Song select keybindings
|
|
||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleModSelection))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleModSelection))]
|
||||||
ToggleModSelection,
|
ToggleModSelection,
|
||||||
|
|
||||||
@ -378,5 +375,8 @@ namespace osu.Game.Input.Bindings
|
|||||||
|
|
||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleReplaySettings))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleReplaySettings))]
|
||||||
ToggleReplaySettings,
|
ToggleReplaySettings,
|
||||||
|
|
||||||
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleInGameLeaderboard))]
|
||||||
|
ToggleInGameLeaderboard,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,6 +219,11 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString ToggleInGameInterface => new TranslatableString(getKey(@"toggle_in_game_interface"), @"Toggle in-game interface");
|
public static LocalisableString ToggleInGameInterface => new TranslatableString(getKey(@"toggle_in_game_interface"), @"Toggle in-game interface");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Toggle in-game leaderboard"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ToggleInGameLeaderboard => new TranslatableString(getKey(@"toggle_in_game_leaderboard"), @"Toggle in-game leaderboard");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Toggle mod select"
|
/// "Toggle mod select"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
public Bindable<APIUser> LocalUser { get; } = new Bindable<APIUser>(new APIUser
|
public Bindable<APIUser> LocalUser { get; } = new Bindable<APIUser>(new APIUser
|
||||||
{
|
{
|
||||||
Username = @"Dummy",
|
Username = @"Local user",
|
||||||
Id = DUMMY_USER_ID,
|
Id = DUMMY_USER_ID,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ namespace osu.Game.Screens.Play
|
|||||||
public Bindable<bool> ShowHud { get; } = new BindableBool();
|
public Bindable<bool> ShowHud { get; } = new BindableBool();
|
||||||
|
|
||||||
private Bindable<HUDVisibilityMode> configVisibilityMode;
|
private Bindable<HUDVisibilityMode> configVisibilityMode;
|
||||||
|
private Bindable<bool> configLeaderboardVisibility;
|
||||||
private Bindable<bool> configSettingsOverlay;
|
private Bindable<bool> configSettingsOverlay;
|
||||||
|
|
||||||
private readonly BindableBool replayLoaded = new BindableBool();
|
private readonly BindableBool replayLoaded = new BindableBool();
|
||||||
@ -186,6 +187,7 @@ namespace osu.Game.Screens.Play
|
|||||||
ModDisplay.Current.Value = mods;
|
ModDisplay.Current.Value = mods;
|
||||||
|
|
||||||
configVisibilityMode = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode);
|
configVisibilityMode = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode);
|
||||||
|
configLeaderboardVisibility = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard);
|
||||||
configSettingsOverlay = config.GetBindable<bool>(OsuSetting.ReplaySettingsOverlay);
|
configSettingsOverlay = config.GetBindable<bool>(OsuSetting.ReplaySettingsOverlay);
|
||||||
|
|
||||||
if (configVisibilityMode.Value == HUDVisibilityMode.Never && !hasShownNotificationOnce)
|
if (configVisibilityMode.Value == HUDVisibilityMode.Never && !hasShownNotificationOnce)
|
||||||
@ -398,6 +400,10 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case GlobalAction.ToggleInGameLeaderboard:
|
||||||
|
configLeaderboardVisibility.Value = !configLeaderboardVisibility.Value;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user