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