mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
@ -28,7 +28,12 @@ namespace osu.Game.Rulesets.Mania.Configuration
|
|||||||
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
|
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
|
||||||
{
|
{
|
||||||
new TrackedSetting<double>(ManiaRulesetSetting.ScrollTime,
|
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;
|
||||||
using osu.Framework.Configuration.Tracking;
|
using osu.Framework.Configuration.Tracking;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Framework.Extensions.LocalisationExtensions;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
@ -185,20 +188,52 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
return new TrackedSettings
|
return new TrackedSettings
|
||||||
{
|
{
|
||||||
new TrackedSetting<bool>(OsuSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled", LookupKeyBindings(GlobalAction.ToggleGameplayMouseButtons))),
|
new TrackedSetting<bool>(OsuSetting.MouseDisableButtons, disabledState => new SettingDescription(
|
||||||
new TrackedSetting<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode, m => new SettingDescription(m, "HUD Visibility", m.GetDescription(), $"cycle: {LookupKeyBindings(GlobalAction.ToggleInGameInterface)} quick view: {LookupKeyBindings(GlobalAction.HoldForHUD)}")),
|
rawValue: !disabledState,
|
||||||
new TrackedSetting<ScalingMode>(OsuSetting.Scaling, m => new SettingDescription(m, "scaling", m.GetDescription())),
|
name: GlobalActionKeyBindingStrings.ToggleGameplayMouseButtons,
|
||||||
new TrackedSetting<int>(OsuSetting.Skin, m =>
|
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;
|
string skinName = LookupSkinName(skin) ?? string.Empty;
|
||||||
return new SettingDescription(skinName, "skin", skinName, $"random: {LookupKeyBindings(GlobalAction.RandomSkin)}");
|
|
||||||
})
|
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<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.
|
// IMPORTANT: These are used in user configuration files.
|
||||||
|
@ -24,6 +24,11 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString Enabled => new TranslatableString(getKey(@"enabled"), @"Enabled");
|
public static LocalisableString Enabled => new TranslatableString(getKey(@"enabled"), @"Enabled");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Disabled"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString Disabled => new TranslatableString(getKey(@"disabled"), @"Disabled");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Default"
|
/// "Default"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -29,6 +29,9 @@ namespace osu.Game.Localisation
|
|||||||
{
|
{
|
||||||
var split = lookup.Split(':');
|
var split = lookup.Split(':');
|
||||||
|
|
||||||
|
if (split.Length < 2)
|
||||||
|
return null;
|
||||||
|
|
||||||
string ns = split[0];
|
string ns = split[0];
|
||||||
string key = split[1];
|
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);
|
var combinations = KeyBindingStore.GetReadableKeyCombinationsFor(l);
|
||||||
|
|
||||||
if (combinations.Count == 0)
|
if (combinations.Count == 0)
|
||||||
return "none";
|
return ToastStrings.NoKeyBound;
|
||||||
|
|
||||||
return string.Join(" or ", combinations);
|
return string.Join(" / ", combinations);
|
||||||
};
|
};
|
||||||
|
|
||||||
Container logoContainer;
|
Container logoContainer;
|
||||||
|
@ -3,12 +3,15 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions.LocalisationExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Overlays.OSD;
|
using osu.Game.Overlays.OSD;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Music
|
namespace osu.Game.Overlays.Music
|
||||||
@ -39,11 +42,11 @@ namespace osu.Game.Overlays.Music
|
|||||||
bool wasPlaying = musicController.IsPlaying;
|
bool wasPlaying = musicController.IsPlaying;
|
||||||
|
|
||||||
if (musicController.TogglePause())
|
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;
|
return true;
|
||||||
|
|
||||||
case GlobalAction.MusicNext:
|
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;
|
return true;
|
||||||
|
|
||||||
@ -53,11 +56,11 @@ namespace osu.Game.Overlays.Music
|
|||||||
switch (res)
|
switch (res)
|
||||||
{
|
{
|
||||||
case PreviousTrackResult.Restart:
|
case PreviousTrackResult.Restart:
|
||||||
onScreenDisplay?.Display(new MusicActionToast("Restart track", e.Action));
|
onScreenDisplay?.Display(new MusicActionToast(ToastStrings.RestartTrack, e.Action));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PreviousTrackResult.Previous:
|
case PreviousTrackResult.Previous:
|
||||||
onScreenDisplay?.Display(new MusicActionToast("Previous track", e.Action));
|
onScreenDisplay?.Display(new MusicActionToast(GlobalActionKeyBindingStrings.MusicPrev, e.Action));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -76,8 +79,8 @@ namespace osu.Game.Overlays.Music
|
|||||||
{
|
{
|
||||||
private readonly GlobalAction action;
|
private readonly GlobalAction action;
|
||||||
|
|
||||||
public MusicActionToast(string value, GlobalAction action)
|
public MusicActionToast(LocalisableString value, GlobalAction action)
|
||||||
: base("Music Playback", value, string.Empty)
|
: base(ToastStrings.MusicPlayback, value, string.Empty)
|
||||||
{
|
{
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
@ -85,7 +88,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
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.
|
// 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.
|
// 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;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
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 osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.OSD
|
namespace osu.Game.Overlays.OSD
|
||||||
{
|
{
|
||||||
@ -23,7 +26,7 @@ namespace osu.Game.Overlays.OSD
|
|||||||
|
|
||||||
protected readonly OsuSpriteText ShortcutText;
|
protected readonly OsuSpriteText ShortcutText;
|
||||||
|
|
||||||
protected Toast(string description, string value, string shortcut)
|
protected Toast(LocalisableString description, LocalisableString value, LocalisableString shortcut)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
@ -60,12 +63,12 @@ namespace osu.Game.Overlays.OSD
|
|||||||
Spacing = new Vector2(1, 0),
|
Spacing = new Vector2(1, 0),
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Text = description.ToUpperInvariant()
|
Text = description.ToUpper()
|
||||||
},
|
},
|
||||||
ValueText = new OsuSpriteText
|
ValueText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light),
|
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light),
|
||||||
Padding = new MarginPadding { Left = 10, Right = 10 },
|
Padding = new MarginPadding { Horizontal = 10 },
|
||||||
Name = "Value",
|
Name = "Value",
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -77,9 +80,9 @@ namespace osu.Game.Overlays.OSD
|
|||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Name = "Shortcut",
|
Name = "Shortcut",
|
||||||
Alpha = 0.3f,
|
Alpha = 0.3f,
|
||||||
Margin = new MarginPadding { Bottom = 15 },
|
Margin = new MarginPadding { Bottom = 15, Horizontal = 10 },
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
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;
|
private Sample sampleChange;
|
||||||
|
|
||||||
public TrackedSettingToast(SettingDescription description)
|
public TrackedSettingToast(SettingDescription description)
|
||||||
: base(description.Name.ToString(), description.Value.ToString(), description.Shortcut.ToString())
|
: base(description.Name, description.Value, description.Shortcut)
|
||||||
{
|
{
|
||||||
FillFlowContainer<OptionLight> optionLights;
|
FillFlowContainer<OptionLight> optionLights;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user