mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Add slider placement binding description in tooltip
This commit is contained in:
parent
683d5310b1
commit
310265c43f
@ -15,6 +15,13 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
public SliderCompositionTool()
|
||||
: base(nameof(Slider))
|
||||
{
|
||||
TooltipText = """
|
||||
Left click for new point.
|
||||
Left click twice or S key for new segment.
|
||||
Tab, Shift-Tab, or Alt-1~4 to change current segment type.
|
||||
Right click to finish.
|
||||
Click and drag for drawing mode.
|
||||
""";
|
||||
}
|
||||
|
||||
public override Drawable CreateIcon() => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders);
|
||||
|
@ -215,14 +215,14 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
toolboxCollection.Items = CompositionTools
|
||||
.Prepend(new SelectTool())
|
||||
.Select(t => new RadioButton(t.Name, () => toolSelected(t), t.CreateIcon))
|
||||
.Select(t => new HitObjectCompositionToolButton(t, () => toolSelected(t)))
|
||||
.ToList();
|
||||
|
||||
foreach (var item in toolboxCollection.Items)
|
||||
{
|
||||
item.Selected.DisabledChanged += isDisabled =>
|
||||
{
|
||||
item.TooltipText = isDisabled ? "Add at least one timing point first!" : string.Empty;
|
||||
item.TooltipText = isDisabled ? "Add at least one timing point first!" : ((HitObjectCompositionToolButton)item).TooltipText;
|
||||
};
|
||||
}
|
||||
|
||||
|
22
osu.Game/Rulesets/Edit/HitObjectCompositionToolButton.cs
Normal file
22
osu.Game/Rulesets/Edit/HitObjectCompositionToolButton.cs
Normal file
@ -0,0 +1,22 @@
|
||||
// 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.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Screens.Edit.Components.RadioButtons;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
public class HitObjectCompositionToolButton : RadioButton
|
||||
{
|
||||
public HitObjectCompositionTool Tool { get; }
|
||||
|
||||
public HitObjectCompositionToolButton(HitObjectCompositionTool tool, Action? action)
|
||||
: base(tool.Name, action, tool.CreateIcon)
|
||||
{
|
||||
Tool = tool;
|
||||
|
||||
TooltipText = tool.TooltipText;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Tools
|
||||
{
|
||||
@ -11,6 +10,8 @@ namespace osu.Game.Rulesets.Edit.Tools
|
||||
{
|
||||
public readonly string Name;
|
||||
|
||||
public LocalisableString TooltipText { get; init; } = default;
|
||||
|
||||
protected HitObjectCompositionTool(string name)
|
||||
{
|
||||
Name = name;
|
||||
@ -18,7 +19,7 @@ namespace osu.Game.Rulesets.Edit.Tools
|
||||
|
||||
public abstract PlacementBlueprint CreatePlacementBlueprint();
|
||||
|
||||
public virtual Drawable CreateIcon() => null;
|
||||
public virtual Drawable? CreateIcon() => null;
|
||||
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
|
@ -24,11 +24,11 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
|
||||
/// <summary>
|
||||
/// A function which creates a drawable icon to represent this item. If null, a sane default should be used.
|
||||
/// </summary>
|
||||
public readonly Func<Drawable>? CreateIcon;
|
||||
public readonly Func<Drawable?>? CreateIcon;
|
||||
|
||||
private readonly Action? action;
|
||||
|
||||
public RadioButton(string label, Action? action, Func<Drawable>? createIcon = null)
|
||||
public RadioButton(string label, Action? action, Func<Drawable?>? createIcon = null)
|
||||
{
|
||||
Label = label;
|
||||
CreateIcon = createIcon;
|
||||
|
Loading…
Reference in New Issue
Block a user