1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 09:02:55 +08:00

Merge pull request #1003 from Jorolf/ruleset-settings

Add ruleset settings
This commit is contained in:
Dean Herbert 2017-07-13 17:08:51 +09:00 committed by GitHub
commit 61c45b0b44
6 changed files with 55 additions and 22 deletions

View File

@ -15,6 +15,7 @@ using System.Collections.Generic;
using System.Linq;
using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Scoring;
using osu.Game.Overlays.Settings;
namespace osu.Game.Rulesets.Osu
{
@ -119,6 +120,8 @@ namespace osu.Game.Rulesets.Osu
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor();
public override SettingsSubsection CreateSettings() => new OsuSettings();
public override int LegacyID => 0;
}
}

View File

@ -0,0 +1,33 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Overlays.Settings;
namespace osu.Game.Rulesets.Osu.UI
{
public class OsuSettings : SettingsSubsection
{
protected override string Header => "osu!";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = "Snaking in sliders",
Bindable = config.GetBindable<bool>(OsuSetting.SnakingInSliders)
},
new SettingsCheckbox
{
LabelText = "Snaking out sliders",
Bindable = config.GetBindable<bool>(OsuSetting.SnakingOutSliders)
},
};
}
}
}

View File

@ -78,6 +78,7 @@
<Compile Include="OsuDifficulty\Skills\Speed.cs" />
<Compile Include="OsuDifficulty\Utils\History.cs" />
<Compile Include="OsuKeyConversionInputManager.cs" />
<Compile Include="UI\OsuSettings.cs" />
<Compile Include="Scoring\OsuScoreProcessor.cs" />
<Compile Include="UI\OsuHitRenderer.cs" />
<Compile Include="UI\OsuPlayfield.cs" />

View File

@ -1,9 +1,13 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Overlays.Settings.Sections.Gameplay;
using osu.Game.Rulesets;
using System.Linq;
namespace osu.Game.Overlays.Settings.Sections
{
@ -20,5 +24,16 @@ namespace osu.Game.Overlays.Settings.Sections
new SongSelectSettings(),
};
}
[BackgroundDependencyLoader]
private void load(RulesetDatabase rulesets)
{
foreach(Ruleset ruleset in rulesets.AllRulesets.Select(info => info.CreateInstance()))
{
SettingsSubsection section = ruleset.CreateSettings();
if (section != null)
Add(section);
}
}
}
}

View File

@ -1,32 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Settings.Sections.Graphics
{
public class DetailSettings : SettingsSubsection
{
protected override string Header => "Detail Settings";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = "Snaking in sliders",
Bindable = config.GetBindable<bool>(OsuSetting.SnakingInSliders)
},
new SettingsCheckbox
{
LabelText = "Snaking out sliders",
Bindable = config.GetBindable<bool>(OsuSetting.SnakingOutSliders)
},
};
}
}
}

View File

@ -8,6 +8,7 @@ using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play;
using System.Collections.Generic;
using osu.Game.Rulesets.Scoring;
using osu.Game.Overlays.Settings;
namespace osu.Game.Rulesets
{
@ -36,6 +37,8 @@ namespace osu.Game.Rulesets
public abstract IEnumerable<KeyCounter> CreateGameplayKeys();
public virtual SettingsSubsection CreateSettings() => null;
/// <summary>
/// Do not override this unless you are a legacy mode.
/// </summary>