2019-03-10 06:58:14 +08:00
|
|
|
|
// 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;
|
2020-01-31 02:45:12 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-03-10 06:58:14 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2024-11-01 12:53:57 +08:00
|
|
|
|
using osu.Framework.Graphics.Colour;
|
2019-03-10 06:58:14 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
2024-11-01 12:53:57 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2019-03-10 06:58:14 +08:00
|
|
|
|
|
2019-04-26 12:49:44 +08:00
|
|
|
|
namespace osu.Game.Overlays.Profile.Header.Components
|
2019-03-10 06:58:14 +08:00
|
|
|
|
{
|
2019-05-19 10:28:24 +08:00
|
|
|
|
public abstract partial class ProfileHeaderButton : OsuHoverContainer
|
2019-03-10 06:58:14 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly Box background;
|
|
|
|
|
private readonly Container content;
|
2024-11-01 12:53:57 +08:00
|
|
|
|
private readonly LoadingLayer loading;
|
2019-03-10 06:58:14 +08:00
|
|
|
|
|
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
|
|
|
|
|
|
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
|
|
|
|
|
2019-04-26 12:29:58 +08:00
|
|
|
|
protected ProfileHeaderButton()
|
2019-03-10 06:58:14 +08:00
|
|
|
|
{
|
2019-04-25 19:05:59 +08:00
|
|
|
|
AutoSizeAxes = Axes.X;
|
2021-01-22 03:56:12 +08:00
|
|
|
|
Height = 40;
|
2019-04-25 19:05:59 +08:00
|
|
|
|
|
2019-03-10 06:58:14 +08:00
|
|
|
|
base.Content.Add(new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
Masking = true,
|
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
background = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
content = new Container
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Padding = new MarginPadding { Horizontal = 10 },
|
2024-11-01 12:53:57 +08:00
|
|
|
|
},
|
|
|
|
|
loading = new LoadingLayer(true, false)
|
2019-03-10 06:58:14 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-01-31 02:45:12 +08:00
|
|
|
|
|
2024-11-01 14:42:50 +08:00
|
|
|
|
protected void SetBackgroundColour(ColourInfo colorInfo, double duration = 0)
|
2024-11-01 12:53:57 +08:00
|
|
|
|
{
|
|
|
|
|
background.FadeColour(colorInfo, duration);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-01 14:42:50 +08:00
|
|
|
|
protected void ShowLoadingLayer()
|
2024-11-01 12:53:57 +08:00
|
|
|
|
{
|
|
|
|
|
loading.Show();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-01 14:42:50 +08:00
|
|
|
|
protected void HideLoadingLayer()
|
2024-11-01 12:53:57 +08:00
|
|
|
|
{
|
|
|
|
|
loading.Hide();
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-31 02:45:12 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
|
|
|
|
{
|
|
|
|
|
IdleColour = colourProvider.Background6;
|
|
|
|
|
HoverColour = colourProvider.Background5;
|
|
|
|
|
}
|
2019-03-10 06:58:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|