Hide graph when it's unavailable; Scroll change

This commit is contained in:
HoutarouOreki
2018-07-25 00:59:21 +02:00
parent a00f4e8178
commit cd79c2cc45
2 changed files with 26 additions and 20 deletions

View File

@ -17,6 +17,10 @@ namespace osu.Game.Overlays.Changelog
// maybe look to osu.Game.Screens.Play.SquareGraph for reference later // maybe look to osu.Game.Screens.Play.SquareGraph for reference later
public class ChangelogChart : BufferedContainer public class ChangelogChart : BufferedContainer
{ {
private const float height = 100;
private const float transition_duration = 300;
private readonly Container container;
private readonly Box background; private readonly Box background;
private readonly SpriteText text; private readonly SpriteText text;
private APIAccess api; private APIAccess api;
@ -24,7 +28,11 @@ namespace osu.Game.Overlays.Changelog
public ChangelogChart() public ChangelogChart()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = 100; AutoSizeAxes = Axes.Y;
Child = container = new Container
{
RelativeSizeAxes = Axes.X,
Height = height,
Children = new Drawable[] Children = new Drawable[]
{ {
background = new Box background = new Box
@ -39,6 +47,7 @@ namespace osu.Game.Overlays.Changelog
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
}, },
},
}; };
} }
@ -55,13 +64,10 @@ namespace osu.Game.Overlays.Changelog
if (!isEmpty(chartInfo)) if (!isEmpty(chartInfo))
{ {
background.Colour = StreamColour.FromStreamName(updateStreamName); background.Colour = StreamColour.FromStreamName(updateStreamName);
text.Text = "Graph placeholder\n(chart is not empty)"; container.MoveToY(0, transition_duration, Easing.InOutQuad).FadeIn(transition_duration);
} }
else else
{ container.MoveToY(-height, transition_duration, Easing.InOutQuad).FadeOut(transition_duration);
background.Colour = Color4.Black;
text.Text = "Graph placeholder\n(chart is empty)";
}
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -197,13 +197,13 @@ namespace osu.Game.Overlays
badges.SelectUpdateStream(build.UpdateStream.Name); badges.SelectUpdateStream(build.UpdateStream.Name);
chart.ShowUpdateStream(build.UpdateStream.Name); chart.ShowUpdateStream(build.UpdateStream.Name);
req.Success += APIChangelog => req.Success += apiChangelog =>
{ {
listing.Hide(); listing.Hide();
content.Show(); content.Show();
content.ShowBuild(APIChangelog); content.ShowBuild(apiChangelog);
if (scroll.Current > scroll.GetChildPosInContent(content)) if (scroll.Current > scroll.GetChildPosInContent(content))
scroll.ScrollTo(content); scroll.ScrollTo(chart);
if (isAtListing) if (isAtListing)
savedScrollPosition = scroll.Current; savedScrollPosition = scroll.Current;
isAtListing = false; isAtListing = false;