mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Fix incorrect propagation of stream/build on initial display with build
This commit is contained in:
parent
834e82d543
commit
292a82ac27
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -37,7 +38,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
|
||||
Streams.Current.ValueChanged += e =>
|
||||
{
|
||||
if (e.NewValue?.LatestBuild != null && e.NewValue != Current.Value?.UpdateStream)
|
||||
if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Current.Value?.UpdateStream))
|
||||
Current.Value = e.NewValue.LatestBuild;
|
||||
};
|
||||
}
|
||||
@ -54,7 +55,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
BreadcrumbControl.AddItem(e.NewValue.ToString());
|
||||
BreadcrumbControl.Current.Value = e.NewValue.ToString();
|
||||
|
||||
Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == e.NewValue.UpdateStream.Name);
|
||||
updateCurrentStream();
|
||||
|
||||
title.Version = e.NewValue.UpdateStream.DisplayName;
|
||||
}
|
||||
@ -80,6 +81,20 @@ namespace osu.Game.Overlays.Changelog
|
||||
|
||||
protected override ScreenTitle CreateTitle() => title = new ChangelogHeaderTitle();
|
||||
|
||||
public void Populate(List<APIUpdateStream> streams)
|
||||
{
|
||||
Streams.Populate(streams);
|
||||
updateCurrentStream();
|
||||
}
|
||||
|
||||
private void updateCurrentStream()
|
||||
{
|
||||
if (Current.Value == null)
|
||||
return;
|
||||
|
||||
Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == Current.Value.UpdateStream.Name);
|
||||
}
|
||||
|
||||
public class HeaderBackground : Sprite
|
||||
{
|
||||
public HeaderBackground()
|
||||
|
@ -29,8 +29,6 @@ namespace osu.Game.Overlays.Changelog
|
||||
|
||||
public void Populate(List<APIUpdateStream> streams)
|
||||
{
|
||||
Current.Value = null;
|
||||
|
||||
foreach (APIUpdateStream updateStream in streams)
|
||||
AddItem(updateStream);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
@ -181,7 +181,7 @@ namespace osu.Game.Overlays
|
||||
builds = res.Builds;
|
||||
Streams = res.Streams;
|
||||
|
||||
Header.Streams.Populate(res.Streams);
|
||||
Header.Populate(res.Streams);
|
||||
|
||||
tcs.SetResult(true);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user