1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-07 16:12:55 +08:00

Remove fadeContainer and adjust fade condition

This commit is contained in:
Andrei Zavatski 2020-02-27 15:33:01 +03:00
parent a8c31c31ad
commit f9aa6b9c07

View File

@ -26,7 +26,6 @@ namespace osu.Game.Overlays.Changelog
private readonly APIUpdateStream stream; private readonly APIUpdateStream stream;
private Container fadeContainer;
private FillFlowContainer<SpriteText> text; private FillFlowContainer<SpriteText> text;
private ExpandingBar expandingBar; private ExpandingBar expandingBar;
@ -44,47 +43,39 @@ namespace osu.Game.Overlays.Changelog
AddRange(new Drawable[] AddRange(new Drawable[]
{ {
fadeContainer = new Container text = new FillFlowContainer<SpriteText>
{ {
RelativeSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Direction = FillDirection.Vertical,
Margin = new MarginPadding { Top = 6 },
Children = new[]
{ {
text = new FillFlowContainer<SpriteText> new OsuSpriteText
{ {
AutoSizeAxes = Axes.X, Text = stream.DisplayName,
RelativeSizeAxes = Axes.Y, Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black),
Direction = FillDirection.Vertical,
Margin = new MarginPadding { Top = 6 },
Children = new[]
{
new OsuSpriteText
{
Text = stream.DisplayName,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black),
},
new OsuSpriteText
{
Text = stream.LatestBuild.DisplayVersion,
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
},
new OsuSpriteText
{
Text = stream.LatestBuild.Users > 0 ? $"{"user".ToQuantity(stream.LatestBuild.Users, "N0")} online" : null,
Font = OsuFont.GetFont(size: 10),
Colour = colourProvider.Foreground1
},
}
}, },
expandingBar = new ExpandingBar new OsuSpriteText
{ {
Anchor = Anchor.TopCentre, Text = stream.LatestBuild.DisplayVersion,
Colour = stream.Colour, Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
ExpandedSize = 4, },
CollapsedSize = 2, new OsuSpriteText
IsCollapsed = true {
Text = stream.LatestBuild.Users > 0 ? $"{"user".ToQuantity(stream.LatestBuild.Users, "N0")} online" : null,
Font = OsuFont.GetFont(size: 10),
Colour = colourProvider.Foreground1
}, },
} }
}, },
expandingBar = new ExpandingBar
{
Anchor = Anchor.TopCentre,
Colour = stream.Colour,
ExpandedSize = 4,
CollapsedSize = 2,
IsCollapsed = true
},
new HoverClickSounds() new HoverClickSounds()
}); });
@ -112,21 +103,23 @@ namespace osu.Game.Overlays.Changelog
// Expand based on the local state // Expand based on the local state
bool shouldExpand = Active.Value || IsHovered; bool shouldExpand = Active.Value || IsHovered;
bool allHighlighted = SelectedTab.Value == null && !externalDimRequested;
// Expand based on whether no build is selected and the badge area is hovered // Expand based on whether no build is selected and the badge area is hovered
shouldExpand |= SelectedTab.Value == null && !externalDimRequested; shouldExpand |= allHighlighted;
if (shouldExpand) if (shouldExpand)
{ {
expandingBar.Expand(); expandingBar.Expand();
fadeContainer.FadeTo(1, transition_duration); expandingBar.FadeTo(1, transition_duration, Easing.OutQuint);
} }
else else
{ {
expandingBar.Collapse(); expandingBar.Collapse();
fadeContainer.FadeTo(0.5f, transition_duration); expandingBar.FadeTo(0.5f, transition_duration, Easing.OutQuint);
} }
text.FadeTo(externalDimRequested && !IsHovered ? 0.5f : 1, transition_duration); text.FadeTo(IsHovered || (Active.Value && !externalDimRequested) || allHighlighted ? 1 : 0.5f, transition_duration, Easing.OutQuint);
} }
private bool externalDimRequested; private bool externalDimRequested;