2018-07-17 05:50:22 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Changelog.Header
|
|
|
|
|
{
|
|
|
|
|
public class TextBadgePairRelease : TextBadgePair
|
|
|
|
|
{
|
|
|
|
|
private TextBadgePairListing listingBadge;
|
2018-07-17 21:01:53 +08:00
|
|
|
|
private const float transition_duration = 125;
|
2018-07-17 05:50:22 +08:00
|
|
|
|
|
|
|
|
|
public TextBadgePairRelease(ColourInfo badgeColour, string displayText) : base(badgeColour, displayText)
|
|
|
|
|
{
|
2018-07-19 01:32:15 +08:00
|
|
|
|
Text.Font = "Exo2.0-Bold";
|
|
|
|
|
Text.Y = 20;
|
|
|
|
|
Text.Alpha = 0;
|
2018-07-17 05:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-07-20 03:49:13 +08:00
|
|
|
|
public void SetText(string displayText) => Text.Text = displayText;
|
2018-07-17 05:50:22 +08:00
|
|
|
|
|
|
|
|
|
public void Activate(string displayText = null)
|
|
|
|
|
{
|
2018-07-19 01:32:15 +08:00
|
|
|
|
if (IsActivated)
|
|
|
|
|
{
|
2018-07-20 06:52:50 +08:00
|
|
|
|
if (displayText != Text.Text)
|
|
|
|
|
ChangeText(transition_duration, displayText);
|
2018-07-19 01:32:15 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ShowText(transition_duration, displayText);
|
2018-07-20 06:52:50 +08:00
|
|
|
|
IsActivated = true;
|
2018-07-19 01:32:15 +08:00
|
|
|
|
SampleActivate?.Play();
|
2018-07-17 05:50:22 +08:00
|
|
|
|
OnActivation?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Deactivate()
|
|
|
|
|
{
|
2018-07-19 01:32:15 +08:00
|
|
|
|
IsActivated = false;
|
2018-07-17 21:01:53 +08:00
|
|
|
|
HideText(transition_duration);
|
2018-07-17 05:50:22 +08:00
|
|
|
|
OnDeactivation?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|