osu/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
2.3 KiB
C#
Raw Normal View History

// 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.
2018-04-13 09:19:50 +00:00
using System;
2018-01-18 08:00:41 +00:00
using osu.Framework.Configuration.Tracking;
using osu.Game.Configuration;
using osu.Game.Localisation;
2018-01-17 11:10:35 +00:00
using osu.Game.Rulesets.Configuration;
2018-06-11 05:36:19 +00:00
using osu.Game.Rulesets.Mania.UI;
2018-04-13 09:19:50 +00:00
2018-01-17 11:10:35 +00:00
namespace osu.Game.Rulesets.Mania.Configuration
{
public class ManiaRulesetConfigManager : RulesetConfigManager<ManiaRulesetSetting>
2018-01-17 11:10:35 +00:00
{
public ManiaRulesetConfigManager(SettingsStore? settings, RulesetInfo ruleset, int? variant = null)
: base(settings, ruleset, variant)
2018-01-17 11:10:35 +00:00
{
}
2018-04-13 09:19:50 +00:00
protected override void InitialiseDefaults()
{
base.InitialiseDefaults();
2018-04-13 09:19:50 +00:00
SetDefault(ManiaRulesetSetting.ScrollSpeed, 8, 1, 40);
SetDefault(ManiaRulesetSetting.ScrollDirection, ManiaScrollingDirection.Down);
SetDefault(ManiaRulesetSetting.TimingBasedNoteColouring, false);
2018-04-13 09:19:50 +00:00
#pragma warning disable CS0618
2023-05-30 08:27:48 +00:00
// Although obsolete, this is still required to populate the bindable from the database in case migration is required.
SetDefault<double?>(ManiaRulesetSetting.ScrollTime, null);
if (Get<double?>(ManiaRulesetSetting.ScrollTime) is double scrollTime)
{
SetValue(ManiaRulesetSetting.ScrollSpeed, (int)Math.Round(DrawableManiaRuleset.MAX_TIME_RANGE / scrollTime));
SetValue<double?>(ManiaRulesetSetting.ScrollTime, null);
}
#pragma warning restore CS0618
2023-05-30 08:27:48 +00:00
}
2018-01-18 08:00:41 +00:00
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
{
new TrackedSetting<int>(ManiaRulesetSetting.ScrollSpeed,
speed => new SettingDescription(
rawValue: speed,
name: RulesetSettingsStrings.ScrollSpeed,
value: RulesetSettingsStrings.ScrollSpeedTooltip((int)DrawableManiaRuleset.ComputeScrollTime(speed), speed)
)
)
2018-01-18 08:00:41 +00:00
};
2018-01-17 11:10:35 +00:00
}
2018-04-13 09:19:50 +00:00
public enum ManiaRulesetSetting
2018-01-17 11:10:35 +00:00
{
[Obsolete("Use ScrollSpeed instead.")] // Can be removed 2023-11-30
2018-06-11 05:36:19 +00:00
ScrollTime,
ScrollSpeed,
2021-04-24 08:23:52 +00:00
ScrollDirection,
TimingBasedNoteColouring
2018-01-17 11:10:35 +00:00
}
}