1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-09 13:02:54 +08:00
osu-lazer/osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs

67 lines
1.7 KiB
C#
Raw Normal View History

2019-05-12 23:36:05 +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.
2018-07-17 05:50:22 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
2019-05-12 23:36:05 +08:00
using osuTK.Graphics;
2018-07-17 05:50:22 +08:00
namespace osu.Game.Overlays.Changelog.Header
{
public class BreadcrumbListing : Breadcrumb
2018-07-17 05:50:22 +08:00
{
2018-07-19 01:32:15 +08:00
private readonly ColourInfo badgeColour;
2018-07-17 05:50:22 +08:00
public BreadcrumbListing(ColourInfo badgeColour)
2019-05-12 23:36:05 +08:00
: base(badgeColour, "Listing", false)
2018-07-17 05:50:22 +08:00
{
this.badgeColour = badgeColour;
Text.Font = Text.Font.With(weight: FontWeight.Bold);
2018-07-19 01:32:15 +08:00
Text.Anchor = Anchor.TopCentre;
Text.Origin = Anchor.TopCentre;
2018-07-17 21:01:53 +08:00
AutoSizeAxes = Axes.None;
}
protected override void LoadComplete()
{
base.LoadComplete();
2018-07-18 21:17:20 +08:00
Activate();
Width = Text.DrawWidth;
2018-07-17 05:50:22 +08:00
}
public override void Activate()
{
if (IsActivated)
return;
2019-05-12 23:36:05 +08:00
base.Activate();
2018-07-17 21:01:53 +08:00
SetTextColour(Color4.White, 100);
2018-07-17 05:50:22 +08:00
}
public override void Deactivate()
{
if (!IsActivated)
return;
2018-07-17 05:50:22 +08:00
base.Deactivate();
SetTextColour(badgeColour, 100);
2018-07-17 05:50:22 +08:00
}
protected override bool OnHover(HoverEvent e)
2018-07-17 05:50:22 +08:00
{
LineBadge.Uncollapse();
return base.OnHover(e);
2018-07-17 05:50:22 +08:00
}
protected override void OnHoverLost(HoverLostEvent e)
2018-07-17 05:50:22 +08:00
{
2018-07-20 06:52:50 +08:00
if (!IsActivated)
LineBadge.Collapse();
base.OnHoverLost(e);
2018-07-17 05:50:22 +08:00
}
}
}