mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:07:44 +08:00
commit
065271f903
@ -28,7 +28,12 @@ namespace osu.Game.Rulesets.Mania.Configuration
|
||||
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
|
||||
{
|
||||
new TrackedSetting<double>(ManiaRulesetSetting.ScrollTime,
|
||||
v => new SettingDescription(v, "Scroll Speed", $"{(int)Math.Round(DrawableManiaRuleset.MAX_TIME_RANGE / v)} ({v}ms)"))
|
||||
scrollTime => new SettingDescription(
|
||||
rawValue: scrollTime,
|
||||
name: "Scroll Speed",
|
||||
value: $"{(int)Math.Round(DrawableManiaRuleset.MAX_TIME_RANGE / scrollTime)} ({scrollTime}ms)"
|
||||
)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,13 @@ using System.Diagnostics;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Configuration.Tracking;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Input;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Select;
|
||||
@ -185,20 +188,52 @@ namespace osu.Game.Configuration
|
||||
|
||||
return new TrackedSettings
|
||||
{
|
||||
new TrackedSetting<bool>(OsuSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled", LookupKeyBindings(GlobalAction.ToggleGameplayMouseButtons))),
|
||||
new TrackedSetting<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode, m => new SettingDescription(m, "HUD Visibility", m.GetDescription(), $"cycle: {LookupKeyBindings(GlobalAction.ToggleInGameInterface)} quick view: {LookupKeyBindings(GlobalAction.HoldForHUD)}")),
|
||||
new TrackedSetting<ScalingMode>(OsuSetting.Scaling, m => new SettingDescription(m, "scaling", m.GetDescription())),
|
||||
new TrackedSetting<int>(OsuSetting.Skin, m =>
|
||||
new TrackedSetting<bool>(OsuSetting.MouseDisableButtons, disabledState => new SettingDescription(
|
||||
rawValue: !disabledState,
|
||||
name: GlobalActionKeyBindingStrings.ToggleGameplayMouseButtons,
|
||||
value: disabledState ? CommonStrings.Disabled.ToLower() : CommonStrings.Enabled.ToLower(),
|
||||
shortcut: LookupKeyBindings(GlobalAction.ToggleGameplayMouseButtons))
|
||||
),
|
||||
new TrackedSetting<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode, visibilityMode => new SettingDescription(
|
||||
rawValue: visibilityMode,
|
||||
name: GameplaySettingsStrings.HUDVisibilityMode,
|
||||
value: visibilityMode.GetLocalisableDescription(),
|
||||
shortcut: new TranslatableString(@"_", @"{0}: {1} {2}: {3}",
|
||||
GlobalActionKeyBindingStrings.ToggleInGameInterface,
|
||||
LookupKeyBindings(GlobalAction.ToggleInGameInterface),
|
||||
GlobalActionKeyBindingStrings.HoldForHUD,
|
||||
LookupKeyBindings(GlobalAction.HoldForHUD)))
|
||||
),
|
||||
new TrackedSetting<ScalingMode>(OsuSetting.Scaling, scalingMode => new SettingDescription(
|
||||
rawValue: scalingMode,
|
||||
name: GraphicsSettingsStrings.ScreenScaling,
|
||||
value: scalingMode.GetLocalisableDescription()
|
||||
)
|
||||
),
|
||||
new TrackedSetting<int>(OsuSetting.Skin, skin =>
|
||||
{
|
||||
string skinName = LookupSkinName(m) ?? string.Empty;
|
||||
return new SettingDescription(skinName, "skin", skinName, $"random: {LookupKeyBindings(GlobalAction.RandomSkin)}");
|
||||
})
|
||||
string skinName = LookupSkinName(skin) ?? string.Empty;
|
||||
|
||||
return new SettingDescription(
|
||||
rawValue: skinName,
|
||||
name: SkinSettingsStrings.SkinSectionHeader,
|
||||
value: skinName,
|
||||
shortcut: $"{GlobalActionKeyBindingStrings.RandomSkin}: {LookupKeyBindings(GlobalAction.RandomSkin)}"
|
||||
);
|
||||
}),
|
||||
new TrackedSetting<float>(OsuSetting.UIScale, scale => new SettingDescription(
|
||||
rawValue: scale,
|
||||
name: GraphicsSettingsStrings.UIScaling,
|
||||
value: $"{scale:N2}x"
|
||||
// TODO: implement lookup for framework platform key bindings
|
||||
)
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
public Func<int, string> LookupSkinName { private get; set; }
|
||||
|
||||
public Func<GlobalAction, string> LookupKeyBindings { get; set; }
|
||||
public Func<GlobalAction, LocalisableString> LookupKeyBindings { get; set; }
|
||||
}
|
||||
|
||||
// IMPORTANT: These are used in user configuration files.
|
||||
|
@ -24,6 +24,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString Enabled => new TranslatableString(getKey(@"enabled"), @"Enabled");
|
||||
|
||||
/// <summary>
|
||||
/// "Disabled"
|
||||
/// </summary>
|
||||
public static LocalisableString Disabled => new TranslatableString(getKey(@"disabled"), @"Disabled");
|
||||
|
||||
/// <summary>
|
||||
/// "Default"
|
||||
/// </summary>
|
||||
|
@ -29,6 +29,9 @@ namespace osu.Game.Localisation
|
||||
{
|
||||
var split = lookup.Split(':');
|
||||
|
||||
if (split.Length < 2)
|
||||
return null;
|
||||
|
||||
string ns = split[0];
|
||||
string key = split[1];
|
||||
|
||||
|
39
osu.Game/Localisation/ToastStrings.cs
Normal file
39
osu.Game/Localisation/ToastStrings.cs
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Localisation
|
||||
{
|
||||
public static class ToastStrings
|
||||
{
|
||||
private const string prefix = @"osu.Game.Resources.Localisation.Toast";
|
||||
|
||||
/// <summary>
|
||||
/// "no key bound"
|
||||
/// </summary>
|
||||
public static LocalisableString NoKeyBound => new TranslatableString(getKey(@"no_key_bound"), @"no key bound");
|
||||
|
||||
/// <summary>
|
||||
/// "Music Playback"
|
||||
/// </summary>
|
||||
public static LocalisableString MusicPlayback => new TranslatableString(getKey(@"music_playback"), @"Music Playback");
|
||||
|
||||
/// <summary>
|
||||
/// "Pause track"
|
||||
/// </summary>
|
||||
public static LocalisableString PauseTrack => new TranslatableString(getKey(@"pause_track"), @"Pause track");
|
||||
|
||||
/// <summary>
|
||||
/// "Play track"
|
||||
/// </summary>
|
||||
public static LocalisableString PlayTrack => new TranslatableString(getKey(@"play_track"), @"Play track");
|
||||
|
||||
/// <summary>
|
||||
/// "Restart track"
|
||||
/// </summary>
|
||||
public static LocalisableString RestartTrack => new TranslatableString(getKey(@"restart_track"), @"Restart track");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
@ -657,9 +657,9 @@ namespace osu.Game
|
||||
var combinations = KeyBindingStore.GetReadableKeyCombinationsFor(l);
|
||||
|
||||
if (combinations.Count == 0)
|
||||
return "none";
|
||||
return ToastStrings.NoKeyBound;
|
||||
|
||||
return string.Join(" or ", combinations);
|
||||
return string.Join(" / ", combinations);
|
||||
};
|
||||
|
||||
Container logoContainer;
|
||||
|
@ -3,12 +3,15 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays.OSD;
|
||||
|
||||
namespace osu.Game.Overlays.Music
|
||||
@ -39,11 +42,11 @@ namespace osu.Game.Overlays.Music
|
||||
bool wasPlaying = musicController.IsPlaying;
|
||||
|
||||
if (musicController.TogglePause())
|
||||
onScreenDisplay?.Display(new MusicActionToast(wasPlaying ? "Pause track" : "Play track", e.Action));
|
||||
onScreenDisplay?.Display(new MusicActionToast(wasPlaying ? ToastStrings.PauseTrack : ToastStrings.PlayTrack, e.Action));
|
||||
return true;
|
||||
|
||||
case GlobalAction.MusicNext:
|
||||
musicController.NextTrack(() => onScreenDisplay?.Display(new MusicActionToast("Next track", e.Action)));
|
||||
musicController.NextTrack(() => onScreenDisplay?.Display(new MusicActionToast(GlobalActionKeyBindingStrings.MusicNext, e.Action)));
|
||||
|
||||
return true;
|
||||
|
||||
@ -53,11 +56,11 @@ namespace osu.Game.Overlays.Music
|
||||
switch (res)
|
||||
{
|
||||
case PreviousTrackResult.Restart:
|
||||
onScreenDisplay?.Display(new MusicActionToast("Restart track", e.Action));
|
||||
onScreenDisplay?.Display(new MusicActionToast(ToastStrings.RestartTrack, e.Action));
|
||||
break;
|
||||
|
||||
case PreviousTrackResult.Previous:
|
||||
onScreenDisplay?.Display(new MusicActionToast("Previous track", e.Action));
|
||||
onScreenDisplay?.Display(new MusicActionToast(GlobalActionKeyBindingStrings.MusicPrev, e.Action));
|
||||
break;
|
||||
}
|
||||
});
|
||||
@ -76,8 +79,8 @@ namespace osu.Game.Overlays.Music
|
||||
{
|
||||
private readonly GlobalAction action;
|
||||
|
||||
public MusicActionToast(string value, GlobalAction action)
|
||||
: base("Music Playback", value, string.Empty)
|
||||
public MusicActionToast(LocalisableString value, GlobalAction action)
|
||||
: base(ToastStrings.MusicPlayback, value, string.Empty)
|
||||
{
|
||||
this.action = action;
|
||||
}
|
||||
@ -85,7 +88,7 @@ namespace osu.Game.Overlays.Music
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
ShortcutText.Text = config.LookupKeyBindings(action).ToUpperInvariant();
|
||||
ShortcutText.Text = config.LookupKeyBindings(action).ToUpper();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,16 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
namespace osu.Game.Overlays.OSD
|
||||
{
|
||||
@ -23,7 +26,7 @@ namespace osu.Game.Overlays.OSD
|
||||
|
||||
protected readonly OsuSpriteText ShortcutText;
|
||||
|
||||
protected Toast(string description, string value, string shortcut)
|
||||
protected Toast(LocalisableString description, LocalisableString value, LocalisableString shortcut)
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
@ -60,12 +63,12 @@ namespace osu.Game.Overlays.OSD
|
||||
Spacing = new Vector2(1, 0),
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = description.ToUpperInvariant()
|
||||
Text = description.ToUpper()
|
||||
},
|
||||
ValueText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light),
|
||||
Padding = new MarginPadding { Left = 10, Right = 10 },
|
||||
Padding = new MarginPadding { Horizontal = 10 },
|
||||
Name = "Value",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -77,9 +80,9 @@ namespace osu.Game.Overlays.OSD
|
||||
Origin = Anchor.BottomCentre,
|
||||
Name = "Shortcut",
|
||||
Alpha = 0.3f,
|
||||
Margin = new MarginPadding { Bottom = 15 },
|
||||
Margin = new MarginPadding { Bottom = 15, Horizontal = 10 },
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||
Text = string.IsNullOrEmpty(shortcut) ? "NO KEY BOUND" : shortcut.ToUpperInvariant()
|
||||
Text = string.IsNullOrEmpty(shortcut.ToString()) ? ToastStrings.NoKeyBound.ToUpper() : shortcut.ToUpper()
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Overlays.OSD
|
||||
private Sample sampleChange;
|
||||
|
||||
public TrackedSettingToast(SettingDescription description)
|
||||
: base(description.Name.ToString(), description.Value.ToString(), description.Shortcut.ToString())
|
||||
: base(description.Name, description.Value, description.Shortcut)
|
||||
{
|
||||
FillFlowContainer<OptionLight> optionLights;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user