mirror of
https://github.com/ppy/osu.git
synced 2024-11-18 08:12:55 +08:00
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
// 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.Collections.Generic;
|
|
using JetBrains.Annotations;
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Localisation;
|
|
using osu.Game.Graphics.UserInterface;
|
|
using osu.Game.Overlays;
|
|
|
|
namespace osu.Game.Graphics.UserInterfaceV2
|
|
{
|
|
public class RoundedButton : OsuButton, IFilterable
|
|
{
|
|
public override float Height
|
|
{
|
|
get => base.Height;
|
|
set
|
|
{
|
|
base.Height = value;
|
|
|
|
if (IsLoaded)
|
|
updateCornerRadius();
|
|
}
|
|
}
|
|
|
|
[BackgroundDependencyLoader(true)]
|
|
private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours)
|
|
{
|
|
DefaultBackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3;
|
|
}
|
|
|
|
protected override void LoadComplete()
|
|
{
|
|
base.LoadComplete();
|
|
updateCornerRadius();
|
|
}
|
|
|
|
private void updateCornerRadius() => Content.CornerRadius = DrawHeight / 2;
|
|
|
|
public virtual IEnumerable<LocalisableString> FilterTerms => new[] { Text };
|
|
|
|
public bool MatchingFilter
|
|
{
|
|
set => this.FadeTo(value ? 1 : 0);
|
|
}
|
|
|
|
public bool FilteringActive { get; set; }
|
|
}
|
|
}
|