mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Move ruleset settings to own section
This commit is contained in:
19
osu.Game/Localisation/RulesetSettingsStrings.cs
Normal file
19
osu.Game/Localisation/RulesetSettingsStrings.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// 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 RulesetSettingsStrings
|
||||||
|
{
|
||||||
|
private const string prefix = @"osu.Game.Resources.Localisation.RulesetSettings";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Rulesets"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString Rulesets => new TranslatableString(getKey(@"rulesets"), @"Rulesets");
|
||||||
|
|
||||||
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +1,11 @@
|
|||||||
// 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 System;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Overlays.Settings.Sections.Gameplay;
|
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Logging;
|
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
using osu.Game.Overlays.Settings.Sections.Gameplay;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections
|
namespace osu.Game.Overlays.Settings.Sections
|
||||||
{
|
{
|
||||||
@ -35,24 +30,5 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
new ModsSettings(),
|
new ModsSettings(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(RulesetStore rulesets)
|
|
||||||
{
|
|
||||||
foreach (Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance()))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SettingsSubsection section = ruleset.CreateSettings();
|
|
||||||
|
|
||||||
if (section != null)
|
|
||||||
Add(section);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Logger.Error(e, "Failed to load ruleset settings");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
44
osu.Game/Overlays/Settings/Sections/RulesetSection.cs
Normal file
44
osu.Game/Overlays/Settings/Sections/RulesetSection.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// 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 System;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Framework.Logging;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Settings.Sections
|
||||||
|
{
|
||||||
|
public class RulesetSection : SettingsSection
|
||||||
|
{
|
||||||
|
public override LocalisableString Header => RulesetSettingsStrings.Rulesets;
|
||||||
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Regular.Square
|
||||||
|
};
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(RulesetStore rulesets)
|
||||||
|
{
|
||||||
|
foreach (Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance()))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SettingsSubsection section = ruleset.CreateSettings();
|
||||||
|
|
||||||
|
if (section != null)
|
||||||
|
Add(section);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Error(e, "Failed to load ruleset settings");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,7 @@ namespace osu.Game.Overlays
|
|||||||
new InputSection(createSubPanel(new KeyBindingPanel())),
|
new InputSection(createSubPanel(new KeyBindingPanel())),
|
||||||
new UserInterfaceSection(),
|
new UserInterfaceSection(),
|
||||||
new GameplaySection(),
|
new GameplaySection(),
|
||||||
|
new RulesetSection(),
|
||||||
new AudioSection(),
|
new AudioSection(),
|
||||||
new GraphicsSection(),
|
new GraphicsSection(),
|
||||||
new OnlineSection(),
|
new OnlineSection(),
|
||||||
|
Reference in New Issue
Block a user