1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +08:00

Move update streams inside header content

This commit is contained in:
Dean Herbert 2019-05-22 23:56:50 +09:00
parent 661fc01e7d
commit 81e42041e6
2 changed files with 15 additions and 19 deletions

View File

@ -22,6 +22,8 @@ namespace osu.Game.Overlays.Changelog
public Action ListingSelected; public Action ListingSelected;
public UpdateStreamBadgeArea Streams;
private const string listing_string = "Listing"; private const string listing_string = "Listing";
public ChangelogHeader() public ChangelogHeader()
@ -34,6 +36,12 @@ namespace osu.Game.Overlays.Changelog
}; };
Current.ValueChanged += showBuild; Current.ValueChanged += showBuild;
Streams.Current.ValueChanged += e =>
{
if (e.NewValue?.LatestBuild != null && e.NewValue != Current.Value?.UpdateStream)
Current.Value = e.NewValue.LatestBuild;
};
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -54,11 +62,14 @@ namespace osu.Game.Overlays.Changelog
TabControl.AddItem(e.NewValue.ToString()); TabControl.AddItem(e.NewValue.ToString());
TabControl.Current.Value = e.NewValue.ToString(); TabControl.Current.Value = e.NewValue.ToString();
Streams.Current.Value = e.NewValue.UpdateStream;
title.Version = e.NewValue.UpdateStream.DisplayName; title.Version = e.NewValue.UpdateStream.DisplayName;
} }
else else
{ {
TabControl.Current.Value = listing_string; TabControl.Current.Value = listing_string;
Streams.Current.Value = null;
title.Version = null; title.Version = null;
} }
} }
@ -67,10 +78,11 @@ namespace osu.Game.Overlays.Changelog
protected override Drawable CreateContent() => new Container protected override Drawable CreateContent() => new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]
{ {
// todo: move badge display here Streams = new UpdateStreamBadgeArea(),
} }
}; };

View File

@ -26,8 +26,6 @@ namespace osu.Game.Overlays
{ {
private ChangelogHeader header; private ChangelogHeader header;
private UpdateStreamBadgeArea updateStreamBadges;
private Container<ChangelogContent> content; private Container<ChangelogContent> content;
private SampleChannel sampleBack; private SampleChannel sampleBack;
@ -81,7 +79,6 @@ namespace osu.Game.Overlays
{ {
ListingSelected = ShowListing, ListingSelected = ShowListing,
}, },
updateStreamBadges = new UpdateStreamBadgeArea(),
content = new Container<ChangelogContent> content = new Container<ChangelogContent>
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -92,12 +89,6 @@ namespace osu.Game.Overlays
}, },
}; };
updateStreamBadges.Current.ValueChanged += e =>
{
if (e.NewValue?.LatestBuild != null && e.NewValue != Current.Value?.UpdateStream)
ShowBuild(e.NewValue.LatestBuild);
};
sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); sampleBack = audio.Sample.Get(@"UI/generic-select-soft");
header.Current.BindTo(Current); header.Current.BindTo(Current);
@ -105,16 +96,9 @@ namespace osu.Game.Overlays
Current.BindValueChanged(e => Current.BindValueChanged(e =>
{ {
if (e.NewValue != null) if (e.NewValue != null)
{
updateStreamBadges.Current.Value = e.NewValue.UpdateStream;
loadContent(new ChangelogSingleBuild(e.NewValue)); loadContent(new ChangelogSingleBuild(e.NewValue));
}
else else
{
updateStreamBadges.Current.Value = null;
loadContent(new ChangelogListing(builds)); loadContent(new ChangelogListing(builds));
}
}); });
} }
@ -161,7 +145,7 @@ namespace osu.Game.Overlays
res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id));
builds = res.Builds; builds = res.Builds;
updateStreamBadges.Populate(res.Streams); header.Streams.Populate(res.Streams);
Current.TriggerChange(); Current.TriggerChange();
}; };