mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
move overridability to SettingDescription method
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
// 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.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
@ -30,10 +31,21 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
Value = 5,
|
Value = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
public override string IconTooltip => ($"{Name} ({(CircleSize.IsDefault ? "" : $"CS {CircleSize.Value}, ")}" +
|
public override string SettingDescription
|
||||||
$"{(DrainRate.IsDefault ? "" : $"HP {DrainRate.Value}, ")}" +
|
{
|
||||||
$"{(OverallDifficulty.IsDefault ? "" : $"OD {OverallDifficulty.Value}, ")}" +
|
get
|
||||||
$"{(ApproachRate.IsDefault ? "" : $"AR {ApproachRate.Value}")}").TrimEnd(new char[] { ',', ' ' }) + ")";
|
{
|
||||||
|
string circleSize = CircleSize.IsDefault ? "" : $"CS {CircleSize.Value.ToString()}";
|
||||||
|
string drainRate = DrainRate.IsDefault ? "" : $"HP {DrainRate.Value.ToString()}";
|
||||||
|
string overallDifficulty = OverallDifficulty.IsDefault ? "" : $"OD {OverallDifficulty.Value.ToString()}";
|
||||||
|
string approachRate = ApproachRate.IsDefault ? "" : $"AR {ApproachRate.Value.ToString()}";
|
||||||
|
|
||||||
|
string[] settings = new string[] { circleSize, drainRate, overallDifficulty, approachRate };
|
||||||
|
// filter out empty strings so we don't have orphaned commas
|
||||||
|
settings = Array.FindAll(settings, s => !string.IsNullOrEmpty(s));
|
||||||
|
return string.Join(", ", settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void TransferSettings(BeatmapDifficulty difficulty)
|
protected override void TransferSettings(BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
@ -30,10 +31,21 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
Value = 5,
|
Value = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
public override string IconTooltip => ($"{Name} ({(CircleSize.IsDefault ? "" : $"CS {CircleSize.Value}, ")}" +
|
public override string SettingDescription
|
||||||
$"{(DrainRate.IsDefault ? "" : $"HP {DrainRate.Value}, ")}" +
|
{
|
||||||
$"{(OverallDifficulty.IsDefault ? "" : $"OD {OverallDifficulty.Value}, ")}" +
|
get
|
||||||
$"{(ApproachRate.IsDefault ? "" : $"AR {ApproachRate.Value}")}").TrimEnd(new char[] { ',', ' ' }) + ")";
|
{
|
||||||
|
string circleSize = CircleSize.IsDefault ? "" : $"CS {CircleSize.Value.ToString()}";
|
||||||
|
string drainRate = DrainRate.IsDefault ? "" : $"HP {DrainRate.Value.ToString()}";
|
||||||
|
string overallDifficulty = OverallDifficulty.IsDefault ? "" : $"OD {OverallDifficulty.Value.ToString()}";
|
||||||
|
string approachRate = ApproachRate.IsDefault ? "" : $"AR {ApproachRate.Value.ToString()}";
|
||||||
|
|
||||||
|
string[] settings = new string[] { circleSize, drainRate, overallDifficulty, approachRate };
|
||||||
|
// filter out empty strings so we don't have orphaned commas
|
||||||
|
settings = Array.FindAll(settings, s => !string.IsNullOrEmpty(s));
|
||||||
|
return string.Join(", ", settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void TransferSettings(BeatmapDifficulty difficulty)
|
protected override void TransferSettings(BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,23 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// are displayed in the tooltip.
|
/// are displayed in the tooltip.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public virtual string IconTooltip => Name;
|
public string IconTooltip
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string settingDescription = string.IsNullOrEmpty(SettingDescription) ? "" : $" ({SettingDescription})";
|
||||||
|
return $"{Name}{settingDescription}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The description of editable settings of a mod to use in the <see cref="IconTooltip"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Parentheses are added to the tooltip, surrounding the value of this property. If this property is <c>string.Empty</c>,
|
||||||
|
/// the tooltip will not have parentheses.
|
||||||
|
/// </remarks>
|
||||||
|
public virtual string SettingDescription => string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The score multiplier of this mod.
|
/// The score multiplier of this mod.
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
@ -52,8 +53,19 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
Value = 5,
|
Value = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
public override string IconTooltip => $"{Name} ({(DrainRate.IsDefault ? $"HP {DrainRate.Value.ToString()}, " : "")}" +
|
public override string SettingDescription
|
||||||
$"{(OverallDifficulty.IsDefault ? $"OD {OverallDifficulty.Value.ToString()}, " : "")})";
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string drainRate = DrainRate.IsDefault ? "" : $"HP {DrainRate.Value.ToString()}";
|
||||||
|
string overallDifficulty = OverallDifficulty.IsDefault ? "" : $"OD {OverallDifficulty.Value.ToString()}";
|
||||||
|
|
||||||
|
string[] settings = new string[] { drainRate, overallDifficulty };
|
||||||
|
// filter out empty strings so we don't have orphaned commas
|
||||||
|
settings = Array.FindAll(settings, s => !string.IsNullOrEmpty(s));
|
||||||
|
return string.Join(", ", settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private BeatmapDifficulty difficulty;
|
private BeatmapDifficulty difficulty;
|
||||||
|
|
||||||
|
@ -31,6 +31,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
Precision = 0.01,
|
Precision = 0.01,
|
||||||
};
|
};
|
||||||
|
|
||||||
public override string IconTooltip => $"{Name}{(SpeedChange.IsDefault ? "" : $" ({SpeedChange.Value}x)")}";
|
public override string SettingDescription => SpeedChange.IsDefault ? "" : $" ({SpeedChange.Value}x)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
MaxValue = 10
|
MaxValue = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
public override string IconTooltip => $"{Name}{(Retries.IsDefault ? "" : $" ({Retries.Value} lives)")}";
|
public override string SettingDescription => Retries.IsDefault ? "" : $" ({Retries.Value} lives)";
|
||||||
|
|
||||||
private int retries;
|
private int retries;
|
||||||
|
|
||||||
|
@ -31,6 +31,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
Precision = 0.01,
|
Precision = 0.01,
|
||||||
};
|
};
|
||||||
|
|
||||||
public override string IconTooltip => $"{Name}{(SpeedChange.IsDefault ? "" : $" ({SpeedChange.Value}x)")}";
|
public override string SettingDescription => SpeedChange.IsDefault ? "" : $" ({SpeedChange.Value}x)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
[SettingSource("Final rate", "The final speed to ramp to")]
|
[SettingSource("Final rate", "The final speed to ramp to")]
|
||||||
public abstract BindableNumber<double> FinalRate { get; }
|
public abstract BindableNumber<double> FinalRate { get; }
|
||||||
|
|
||||||
public override string IconTooltip => $"{Name} ({InitialRate.Value}x to {FinalRate.Value}x)";
|
public override string SettingDescription => $"{InitialRate.Value} to {FinalRate.Value}";
|
||||||
|
|
||||||
private double finalRateTime;
|
private double finalRateTime;
|
||||||
private double beginRampTime;
|
private double beginRampTime;
|
||||||
|
Reference in New Issue
Block a user