mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Split content recreation methods
This commit is contained in:
parent
d61a72b8fb
commit
5317086171
@ -118,7 +118,8 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
: Array.Empty<ProfileSection>();
|
||||
|
||||
setupBaseContent(OverlayColourScheme.Pink.GetHue(), forceContentRecreation: true);
|
||||
changeOverlayColours(OverlayColourScheme.Pink.GetHue());
|
||||
recreateBaseContent();
|
||||
|
||||
if (API.State.Value != APIState.Offline)
|
||||
{
|
||||
@ -136,8 +137,9 @@ namespace osu.Game.Overlays
|
||||
|
||||
// reuse header and content if same colour scheme, otherwise recreate both.
|
||||
int profileHue = loadedUser.ProfileHue ?? OverlayColourScheme.Pink.GetHue();
|
||||
if (profileHue != ColourProvider.Hue)
|
||||
setupBaseContent(profileHue, forceContentRecreation: false);
|
||||
|
||||
if (changeOverlayColours(profileHue))
|
||||
recreateBaseContent();
|
||||
|
||||
var actualRuleset = rulesets.GetRuleset(userRuleset?.ShortName ?? loadedUser.PlayMode).AsNonNull();
|
||||
|
||||
@ -163,19 +165,8 @@ namespace osu.Game.Overlays
|
||||
loadingLayer.Hide();
|
||||
}
|
||||
|
||||
private void setupBaseContent(int hue, bool forceContentRecreation)
|
||||
private void recreateBaseContent()
|
||||
{
|
||||
int previousHue = ColourProvider.Hue;
|
||||
ColourProvider.ChangeColourScheme(hue);
|
||||
|
||||
if (hue != previousHue)
|
||||
{
|
||||
RecreateHeader();
|
||||
UpdateColours();
|
||||
}
|
||||
else if (!forceContentRecreation)
|
||||
return;
|
||||
|
||||
Child = new OsuContextMenuContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -224,6 +215,18 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
private bool changeOverlayColours(int hue)
|
||||
{
|
||||
if (hue == ColourProvider.Hue)
|
||||
return false;
|
||||
|
||||
ColourProvider.ChangeColourScheme(hue);
|
||||
|
||||
RecreateHeader();
|
||||
UpdateColours();
|
||||
return true;
|
||||
}
|
||||
|
||||
private partial class ProfileSectionTabControl : OsuTabControl<ProfileSection>
|
||||
{
|
||||
public ProfileSectionTabControl()
|
||||
|
Loading…
Reference in New Issue
Block a user