1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 23:22:55 +08:00

Ensure tooltips of RowAttributes are up-to-date

This commit is contained in:
Dean Herbert 2019-10-28 16:20:54 +09:00
parent 0a11cbf656
commit 9c3e54909c
2 changed files with 8 additions and 7 deletions

View File

@ -128,17 +128,17 @@ namespace osu.Game.Screens.Edit.Timing
switch (controlPoint)
{
case TimingControlPoint timing:
return new RowAttribute("timing", $"{60000 / timing.BeatLength:n1}bpm {timing.TimeSignature}");
return new RowAttribute("timing", () => $"{60000 / timing.BeatLength:n1}bpm {timing.TimeSignature}");
case DifficultyControlPoint difficulty:
return new RowAttribute("difficulty", $"{difficulty.SpeedMultiplier:n2}x");
return new RowAttribute("difficulty", () => $"{difficulty.SpeedMultiplier:n2}x");
case EffectControlPoint effect:
return new RowAttribute("effect", $"{(effect.KiaiMode ? "Kiai " : "")}{(effect.OmitFirstBarLine ? "NoBarLine " : "")}");
return new RowAttribute("effect", () => $"{(effect.KiaiMode ? "Kiai " : "")}{(effect.OmitFirstBarLine ? "NoBarLine " : "")}");
case SampleControlPoint sample:
return new RowAttribute("sample", $"{sample.SampleBank} {sample.SampleVolume}%");
return new RowAttribute("sample", () => $"{sample.SampleBank} {sample.SampleVolume}%");
}
return null;

View File

@ -1,6 +1,7 @@
// 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.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -14,9 +15,9 @@ namespace osu.Game.Screens.Edit.Timing
public class RowAttribute : CompositeDrawable, IHasTooltip
{
private readonly string header;
private readonly string content;
private readonly Func<string> content;
public RowAttribute(string header, string content)
public RowAttribute(string header, Func<string> content)
{
this.header = header;
this.content = content;
@ -54,6 +55,6 @@ namespace osu.Game.Screens.Edit.Timing
};
}
public string TooltipText => content;
public string TooltipText => content();
}
}