1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

show mod settings in ModIcon tooltip

This commit is contained in:
Liam DeVoe 2020-03-18 23:43:26 -04:00
parent e59d7fee26
commit 18bf7c913b
9 changed files with 33 additions and 1 deletions

View File

@ -30,6 +30,11 @@ namespace osu.Game.Rulesets.Catch.Mods
Value = 5,
};
public override string IconTooltip => ($"{Name} ({(CircleSize.IsDefault ? "" : $"CS {CircleSize.Value.ToString()}, ")}" +
$"{(DrainRate.IsDefault ? "" : $"HP {DrainRate.Value.ToString()}, ")}" +
$"{(OverallDifficulty.IsDefault ? "" : $"OD {OverallDifficulty.Value.ToString()}, ")}" +
$"{(ApproachRate.IsDefault ? "" : $"AR {ApproachRate.Value.ToString()}")}").TrimEnd(new char[] { ',', ' ' }) + ")";
protected override void TransferSettings(BeatmapDifficulty difficulty)
{
base.TransferSettings(difficulty);

View File

@ -30,6 +30,11 @@ namespace osu.Game.Rulesets.Osu.Mods
Value = 5,
};
public override string IconTooltip => ($"{Name} ({(CircleSize.IsDefault ? "" : $"CS {CircleSize.Value.ToString()}, ")}" +
$"{(DrainRate.IsDefault ? "" : $"HP {DrainRate.Value.ToString()}, ")}" +
$"{(OverallDifficulty.IsDefault ? "" : $"OD {OverallDifficulty.Value.ToString()}, ")}" +
$"{(ApproachRate.IsDefault ? "" : $"AR {ApproachRate.Value.ToString()}")}").TrimEnd(new char[] { ',', ' ' }) + ")";
protected override void TransferSettings(BeatmapDifficulty difficulty)
{
base.TransferSettings(difficulty);

View File

@ -5,6 +5,7 @@ using System;
using Newtonsoft.Json;
using osu.Framework.Graphics.Sprites;
using osu.Game.IO.Serialization;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mods
{
@ -42,6 +43,16 @@ namespace osu.Game.Rulesets.Mods
[JsonIgnore]
public virtual string Description => string.Empty;
/// <summary>
/// The tooltip to display for this mod when used in a <see cref="ModIcon"/>.
/// </summary>
/// <remarks>
/// Differs from <see cref="Name"/>, as the value of attributes (AR, CS, etc) changeable via the mod
/// are displayed in the tooltip.
/// </remarks>
[JsonIgnore]
public virtual string IconTooltip => Name;
/// <summary>
/// The score multiplier of this mod.
/// </summary>

View File

@ -52,6 +52,9 @@ namespace osu.Game.Rulesets.Mods
Value = 5,
};
public override string IconTooltip => $"{Name} ({(DrainRate.IsDefault ? $"HP {DrainRate.Value.ToString()}, " : "")}" +
$"{(OverallDifficulty.IsDefault ? $"OD {OverallDifficulty.Value.ToString()}, " : "")})";
private BeatmapDifficulty difficulty;
public void ReadFromDifficulty(BeatmapDifficulty difficulty)

View File

@ -30,5 +30,7 @@ namespace osu.Game.Rulesets.Mods
Value = 1.5,
Precision = 0.01,
};
public override string IconTooltip => $"{Name}{(SpeedChange.IsDefault ? "" : $" ({SpeedChange.Value}x)")}";
}
}

View File

@ -28,6 +28,8 @@ namespace osu.Game.Rulesets.Mods
MaxValue = 10
};
public override string IconTooltip => $"{Name}{(Retries.IsDefault ? "" : $" ({Retries.Value} lives)")}";
private int retries;
private BindableNumber<double> health;

View File

@ -30,5 +30,7 @@ namespace osu.Game.Rulesets.Mods
Value = 0.75,
Precision = 0.01,
};
public override string IconTooltip => $"{Name}{(SpeedChange.IsDefault ? "" : $" ({SpeedChange.Value}x)")}";
}
}

View File

@ -26,6 +26,8 @@ namespace osu.Game.Rulesets.Mods
[SettingSource("Final rate", "The final speed to ramp to")]
public abstract BindableNumber<double> FinalRate { get; }
public override string IconTooltip => $"{Name} ({InitialRate.Value}x to {FinalRate.Value}x)";
private double finalRateTime;
private double beginRampTime;

View File

@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.UI
type = mod.Type;
TooltipText = mod.Name;
TooltipText = mod.IconTooltip;
Size = new Vector2(size);