mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 23:12:55 +08:00
Change order in TextBadgePair.cs
This commit is contained in:
parent
e27292fef8
commit
554c56d51f
@ -25,53 +25,6 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
private SampleChannel sampleHover;
|
private SampleChannel sampleHover;
|
||||||
protected SampleChannel SampleActivate;
|
protected SampleChannel SampleActivate;
|
||||||
|
|
||||||
public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None)
|
|
||||||
{
|
|
||||||
Text.FadeColour(newColour, duration, easing);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetBadgeColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None)
|
|
||||||
{
|
|
||||||
LineBadge.FadeColour(newColour, duration, easing);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HideText(double duration = 0, Easing easing = Easing.InOutCubic)
|
|
||||||
{
|
|
||||||
LineBadge.Collapse();
|
|
||||||
Text.MoveToY(20, duration, easing)
|
|
||||||
.FadeOut(duration, easing);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic)
|
|
||||||
{
|
|
||||||
LineBadge.Uncollapse();
|
|
||||||
if (!string.IsNullOrEmpty(displayText))
|
|
||||||
Text.Text = displayText;
|
|
||||||
Text.MoveToY(0, duration, easing)
|
|
||||||
.FadeIn(duration, easing);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <param name="duration">
|
|
||||||
/// The duration of popping in and popping out not combined.
|
|
||||||
/// Full change takes double this time.</param>
|
|
||||||
public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic)
|
|
||||||
{
|
|
||||||
LineBadge.Collapse();
|
|
||||||
Text.MoveToY(20, duration, easing)
|
|
||||||
.FadeOut(duration, easing)
|
|
||||||
.Then()
|
|
||||||
.MoveToY(0, duration, easing)
|
|
||||||
.FadeIn(duration, easing);
|
|
||||||
|
|
||||||
// since using .finally/.oncomplete after first fadeout made the badge not hide
|
|
||||||
// sometimes in visual tests (https://streamable.com/0qssq), I'm using a scheduler here
|
|
||||||
Scheduler.AddDelayed(() =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText;
|
|
||||||
LineBadge.Uncollapse();
|
|
||||||
}, duration);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true)
|
public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.X;
|
AutoSizeAxes = Axes.X;
|
||||||
@ -98,6 +51,27 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <param name="duration">
|
||||||
|
/// The duration of popping in and popping out not combined.
|
||||||
|
/// Full change takes double this time.</param>
|
||||||
|
public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic)
|
||||||
|
{
|
||||||
|
LineBadge.Collapse();
|
||||||
|
Text.MoveToY(20, duration, easing)
|
||||||
|
.FadeOut(duration, easing)
|
||||||
|
.Then()
|
||||||
|
.MoveToY(0, duration, easing)
|
||||||
|
.FadeIn(duration, easing);
|
||||||
|
|
||||||
|
// since using .finally/.oncomplete after first fadeout made the badge not hide
|
||||||
|
// sometimes in visual tests (https://streamable.com/0qssq), I'm using a scheduler here
|
||||||
|
Scheduler.AddDelayed(() =>
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText;
|
||||||
|
LineBadge.Uncollapse();
|
||||||
|
}, duration);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Deactivate()
|
public virtual void Deactivate()
|
||||||
{
|
{
|
||||||
IsActivated = false;
|
IsActivated = false;
|
||||||
@ -113,6 +87,32 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
SampleActivate?.Play();
|
SampleActivate?.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None)
|
||||||
|
{
|
||||||
|
Text.FadeColour(newColour, duration, easing);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetBadgeColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None)
|
||||||
|
{
|
||||||
|
LineBadge.FadeColour(newColour, duration, easing);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HideText(double duration = 0, Easing easing = Easing.InOutCubic)
|
||||||
|
{
|
||||||
|
LineBadge.Collapse();
|
||||||
|
Text.MoveToY(20, duration, easing)
|
||||||
|
.FadeOut(duration, easing);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic)
|
||||||
|
{
|
||||||
|
LineBadge.Uncollapse();
|
||||||
|
if (!string.IsNullOrEmpty(displayText))
|
||||||
|
Text.Text = displayText;
|
||||||
|
Text.MoveToY(0, duration, easing)
|
||||||
|
.FadeIn(duration, easing);
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
if (!IsActivated)
|
if (!IsActivated)
|
||||||
|
Loading…
Reference in New Issue
Block a user