1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-10 21:40:34 +08:00

Disable button instead of hiding (and add tooltip)

This commit is contained in:
Dean Herbert 2025-02-27 15:14:53 +09:00
parent 6b76b8ccdd
commit 0b453772da
No known key found for this signature in database
6 changed files with 24 additions and 15 deletions

View File

@ -100,7 +100,19 @@ namespace osu.Game.Graphics.UserInterfaceV2
if (args.Action != NotifyCollectionChangedAction.Replace) if (args.Action != NotifyCollectionChangedAction.Replace)
updateColours(); updateColours();
}, true); }, true);
CanAdd.BindValueChanged(_ => addButton.Alpha = CanAdd.Value ? 1 : 0, true); CanAdd.BindValueChanged(canAdd =>
{
if (canAdd.NewValue)
{
addButton.Enabled.Value = true;
addButton.TooltipText = string.Empty;
}
else
{
addButton.Enabled.Value = false;
addButton.TooltipText = "Maximum combo colours reached";
}
}, true);
updateState(); updateState();
} }

View File

@ -8,6 +8,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
@ -17,7 +18,7 @@ using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterfaceV2 namespace osu.Game.Graphics.UserInterfaceV2
{ {
public partial class RoundedButton : OsuButton, IFilterable public partial class RoundedButton : OsuButton, IFilterable, IHasTooltip
{ {
protected TrianglesV2? Triangles { get; private set; } protected TrianglesV2? Triangles { get; private set; }
@ -107,5 +108,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
} }
public bool FilteringActive { get; set; } public bool FilteringActive { get; set; }
public virtual LocalisableString TooltipText { get; set; }
} }
} }

View File

@ -7,7 +7,6 @@ using System.Diagnostics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -21,7 +20,7 @@ using APIUser = osu.Game.Online.API.Requests.Responses.APIUser;
namespace osu.Game.Overlays.BeatmapSet.Buttons namespace osu.Game.Overlays.BeatmapSet.Buttons
{ {
public partial class FavouriteButton : HeaderButton, IHasTooltip public partial class FavouriteButton : HeaderButton
{ {
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>(); public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
@ -32,7 +31,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
private readonly IBindable<APIUser> localUser = new Bindable<APIUser>(); private readonly IBindable<APIUser> localUser = new Bindable<APIUser>();
public LocalisableString TooltipText public override LocalisableString TooltipText
{ {
get get
{ {

View File

@ -6,13 +6,12 @@ using System.Collections.Generic;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Overlays.Settings namespace osu.Game.Overlays.Settings
{ {
public partial class SettingsButton : RoundedButton, IHasTooltip, IConditionalFilterable public partial class SettingsButton : RoundedButton, IConditionalFilterable
{ {
public SettingsButton() public SettingsButton()
{ {
@ -25,8 +24,6 @@ namespace osu.Game.Overlays.Settings
public BindableBool CanBeShown { get; } = new BindableBool(true); public BindableBool CanBeShown { get; } = new BindableBool(true);
IBindable<bool> IConditionalFilterable.CanBeShown => CanBeShown; IBindable<bool> IConditionalFilterable.CanBeShown => CanBeShown;
public LocalisableString TooltipText { get; set; }
public override IEnumerable<LocalisableString> FilterTerms public override IEnumerable<LocalisableString> FilterTerms
{ {
get get

View File

@ -3,7 +3,6 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Online; using osu.Game.Online;
@ -11,7 +10,7 @@ using osu.Game.Online.Rooms;
namespace osu.Game.Screens.OnlinePlay.Components namespace osu.Game.Screens.OnlinePlay.Components
{ {
public abstract partial class ReadyButton : RoundedButton, IHasTooltip public abstract partial class ReadyButton : RoundedButton
{ {
public new readonly BindableBool Enabled = new BindableBool(); public new readonly BindableBool Enabled = new BindableBool();
@ -29,7 +28,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
private void updateState() => private void updateState() =>
base.Enabled.Value = availability.Value.State == DownloadState.LocallyAvailable && Enabled.Value; base.Enabled.Value = availability.Value.State == DownloadState.LocallyAvailable && Enabled.Value;
public virtual LocalisableString TooltipText public override LocalisableString TooltipText
{ {
get get
{ {

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Collections; using osu.Game.Collections;
@ -18,7 +17,7 @@ using Realms;
namespace osu.Game.Screens.OnlinePlay.Playlists namespace osu.Game.Screens.OnlinePlay.Playlists
{ {
public partial class AddPlaylistToCollectionButton : RoundedButton, IHasTooltip public partial class AddPlaylistToCollectionButton : RoundedButton
{ {
private readonly Room room; private readonly Room room;
@ -161,7 +160,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
collectionSubscription?.Dispose(); collectionSubscription?.Dispose();
} }
public LocalisableString TooltipText public override LocalisableString TooltipText
{ {
get get
{ {