mirror of
https://github.com/ppy/osu
synced 2024-12-26 00:32:52 +00:00
Expose header background for SectionsContainer.
This commit is contained in:
parent
9f9107b847
commit
e94d98fa84
@ -15,9 +15,9 @@ namespace osu.Game.Graphics.Containers
|
||||
/// </summary>
|
||||
public class SectionsContainer : Container
|
||||
{
|
||||
private Drawable expandableHeader, fixedHeader, footer;
|
||||
private Drawable expandableHeader, fixedHeader, footer, headerBackground;
|
||||
public readonly ScrollContainer ScrollContainer;
|
||||
private readonly Container<Drawable> sectionsContainer;
|
||||
private readonly Container<Drawable> sectionsContainer, headerBackgroundContainer;
|
||||
|
||||
public Drawable ExpandableHeader
|
||||
{
|
||||
@ -72,6 +72,22 @@ namespace osu.Game.Graphics.Containers
|
||||
}
|
||||
}
|
||||
|
||||
public Drawable HeaderBackground
|
||||
{
|
||||
get { return headerBackground; }
|
||||
set
|
||||
{
|
||||
if (value == headerBackground) return;
|
||||
|
||||
headerBackgroundContainer.Clear();
|
||||
headerBackground = value;
|
||||
if (value == null) return;
|
||||
|
||||
headerBackgroundContainer.Add(headerBackground);
|
||||
lastKnownScroll = float.NaN;
|
||||
}
|
||||
}
|
||||
|
||||
public Bindable<Drawable> SelectedSection { get; } = new Bindable<Drawable>();
|
||||
|
||||
protected virtual Container<Drawable> CreateScrollContentContainer()
|
||||
@ -120,6 +136,7 @@ namespace osu.Game.Graphics.Containers
|
||||
Masking = false,
|
||||
Children = new Drawable[] { sectionsContainer = CreateScrollContentContainer() }
|
||||
});
|
||||
Add(headerBackgroundContainer = new Container<Drawable> { RelativeSizeAxes = Axes.X });
|
||||
originalSectionsMargin = sectionsContainer.Margin;
|
||||
}
|
||||
|
||||
@ -150,6 +167,9 @@ namespace osu.Game.Graphics.Containers
|
||||
fixedHeader.Y = -offset + expandableHeader.LayoutSize.Y;
|
||||
}
|
||||
|
||||
headerBackgroundContainer.Height = (ExpandableHeader?.LayoutSize.Y ?? 0) + (FixedHeader?.LayoutSize.Y ?? 0);
|
||||
headerBackgroundContainer.Y = ExpandableHeader?.Y ?? 0;
|
||||
|
||||
Drawable bestMatch = null;
|
||||
float minDiff = float.MaxValue;
|
||||
|
||||
|
@ -151,7 +151,6 @@ namespace osu.Game.Overlays
|
||||
private class SettingsSectionsContainer : SectionsContainer
|
||||
{
|
||||
public SearchContainer SearchContainer;
|
||||
private readonly Box headerBackground;
|
||||
|
||||
protected override Container<Drawable> CreateScrollContentContainer()
|
||||
=> SearchContainer = new SearchContainer
|
||||
@ -164,11 +163,11 @@ namespace osu.Game.Overlays
|
||||
public SettingsSectionsContainer()
|
||||
{
|
||||
ScrollContainer.ScrollbarVisible = false;
|
||||
Add(headerBackground = new Box
|
||||
HeaderBackground = new Box
|
||||
{
|
||||
Colour = Color4.Black,
|
||||
RelativeSizeAxes = Axes.X
|
||||
});
|
||||
RelativeSizeAxes = Axes.Both
|
||||
};
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
@ -176,9 +175,7 @@ namespace osu.Game.Overlays
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
// no null check because the usage of this class is strict
|
||||
headerBackground.Height = ExpandableHeader.LayoutSize.Y + FixedHeader.LayoutSize.Y;
|
||||
headerBackground.Y = ExpandableHeader.Y;
|
||||
headerBackground.Alpha = -ExpandableHeader.Y / ExpandableHeader.LayoutSize.Y * 0.5f;
|
||||
HeaderBackground.Alpha = -ExpandableHeader.Y / ExpandableHeader.LayoutSize.Y * 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,11 @@ namespace osu.Game.Users.Profile
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fill,
|
||||
OnLoadComplete = d => d.FadeInFromZero(200)
|
||||
}) { RelativeSizeAxes = Axes.Both },
|
||||
})
|
||||
{
|
||||
Masking = true,
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new UpdateableAvatar
|
||||
{
|
||||
User = user,
|
||||
|
@ -35,6 +35,11 @@ namespace osu.Game.Users
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ExpandableHeader = new UserPageHeader(user),
|
||||
FixedHeader = tab,
|
||||
HeaderBackground = new Box
|
||||
{
|
||||
Colour = OsuColour.Gray(34),
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
Sections = sections
|
||||
};
|
||||
Add(sectionsContainer);
|
||||
|
Loading…
Reference in New Issue
Block a user