mirror of
https://github.com/ppy/osu
synced 2024-12-12 01:48:49 +00:00
Define local current bindable to bind value change instead
This commit is contained in:
parent
f013a1e37f
commit
51e7b9950e
@ -26,6 +26,8 @@ namespace osu.Game.Overlays.Changelog
|
||||
|
||||
public static LocalisableString ListingString => LayoutStrings.HeaderChangelogIndex;
|
||||
|
||||
private readonly Bindable<APIUpdateStream> currentStream = new Bindable<APIUpdateStream>();
|
||||
|
||||
private Box streamsBackground;
|
||||
|
||||
public ChangelogHeader()
|
||||
@ -38,6 +40,12 @@ namespace osu.Game.Overlays.Changelog
|
||||
};
|
||||
|
||||
Build.ValueChanged += showBuild;
|
||||
|
||||
currentStream.ValueChanged += e =>
|
||||
{
|
||||
if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream))
|
||||
Build.Value = e.NewValue.LatestBuild;
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -61,7 +69,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
else
|
||||
{
|
||||
Current.Value = ListingString;
|
||||
Streams.Current.Value = null;
|
||||
currentStream.Value = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,17 +96,11 @@ namespace osu.Game.Overlays.Changelog
|
||||
Horizontal = 65,
|
||||
Vertical = 20
|
||||
},
|
||||
Child = Streams = new ChangelogUpdateStreamControl()
|
||||
Child = Streams = new ChangelogUpdateStreamControl { Current = currentStream },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Streams.Current.ValueChanged += e =>
|
||||
{
|
||||
if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream))
|
||||
Build.Value = e.NewValue.LatestBuild;
|
||||
};
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
@ -115,7 +117,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
if (Build.Value == null)
|
||||
return;
|
||||
|
||||
Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == Build.Value.UpdateStream.Name);
|
||||
currentStream.Value = Streams.Items.FirstOrDefault(s => s.Name == Build.Value.UpdateStream.Name);
|
||||
}
|
||||
|
||||
private class ChangelogHeaderTitle : OverlayTitle
|
||||
|
Loading…
Reference in New Issue
Block a user