mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 12:02:55 +08:00
Hide graph when it's unavailable; Scroll change
This commit is contained in:
parent
a00f4e8178
commit
cd79c2cc45
@ -17,6 +17,10 @@ namespace osu.Game.Overlays.Changelog
|
||||
// maybe look to osu.Game.Screens.Play.SquareGraph for reference later
|
||||
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 SpriteText text;
|
||||
private APIAccess api;
|
||||
@ -24,20 +28,25 @@ namespace osu.Game.Overlays.Changelog
|
||||
public ChangelogChart()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 100;
|
||||
Children = new Drawable[]
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Child = container = new Container
|
||||
{
|
||||
background = new Box
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = height,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Colour = StreamColour.STABLE,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
text = new SpriteText
|
||||
{
|
||||
Text = "Graph Placeholder",
|
||||
TextSize = 28,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
background = new Box
|
||||
{
|
||||
Colour = StreamColour.STABLE,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
text = new SpriteText
|
||||
{
|
||||
Text = "Graph Placeholder",
|
||||
TextSize = 28,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -55,13 +64,10 @@ namespace osu.Game.Overlays.Changelog
|
||||
if (!isEmpty(chartInfo))
|
||||
{
|
||||
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
|
||||
{
|
||||
background.Colour = Color4.Black;
|
||||
text.Text = "Graph placeholder\n(chart is empty)";
|
||||
}
|
||||
container.MoveToY(-height, transition_duration, Easing.InOutQuad).FadeOut(transition_duration);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -197,13 +197,13 @@ namespace osu.Game.Overlays
|
||||
badges.SelectUpdateStream(build.UpdateStream.Name);
|
||||
|
||||
chart.ShowUpdateStream(build.UpdateStream.Name);
|
||||
req.Success += APIChangelog =>
|
||||
req.Success += apiChangelog =>
|
||||
{
|
||||
listing.Hide();
|
||||
content.Show();
|
||||
content.ShowBuild(APIChangelog);
|
||||
content.ShowBuild(apiChangelog);
|
||||
if (scroll.Current > scroll.GetChildPosInContent(content))
|
||||
scroll.ScrollTo(content);
|
||||
scroll.ScrollTo(chart);
|
||||
if (isAtListing)
|
||||
savedScrollPosition = scroll.Current;
|
||||
isAtListing = false;
|
||||
|
Loading…
Reference in New Issue
Block a user