mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09: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>
|
/// </summary>
|
||||||
public class SectionsContainer : Container
|
public class SectionsContainer : Container
|
||||||
{
|
{
|
||||||
private Drawable expandableHeader, fixedHeader, footer;
|
private Drawable expandableHeader, fixedHeader, footer, headerBackground;
|
||||||
public readonly ScrollContainer ScrollContainer;
|
public readonly ScrollContainer ScrollContainer;
|
||||||
private readonly Container<Drawable> sectionsContainer;
|
private readonly Container<Drawable> sectionsContainer, headerBackgroundContainer;
|
||||||
|
|
||||||
public Drawable ExpandableHeader
|
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>();
|
public Bindable<Drawable> SelectedSection { get; } = new Bindable<Drawable>();
|
||||||
|
|
||||||
protected virtual Container<Drawable> CreateScrollContentContainer()
|
protected virtual Container<Drawable> CreateScrollContentContainer()
|
||||||
@ -120,6 +136,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
Masking = false,
|
Masking = false,
|
||||||
Children = new Drawable[] { sectionsContainer = CreateScrollContentContainer() }
|
Children = new Drawable[] { sectionsContainer = CreateScrollContentContainer() }
|
||||||
});
|
});
|
||||||
|
Add(headerBackgroundContainer = new Container<Drawable> { RelativeSizeAxes = Axes.X });
|
||||||
originalSectionsMargin = sectionsContainer.Margin;
|
originalSectionsMargin = sectionsContainer.Margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,6 +167,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
fixedHeader.Y = -offset + expandableHeader.LayoutSize.Y;
|
fixedHeader.Y = -offset + expandableHeader.LayoutSize.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
headerBackgroundContainer.Height = (ExpandableHeader?.LayoutSize.Y ?? 0) + (FixedHeader?.LayoutSize.Y ?? 0);
|
||||||
|
headerBackgroundContainer.Y = ExpandableHeader?.Y ?? 0;
|
||||||
|
|
||||||
Drawable bestMatch = null;
|
Drawable bestMatch = null;
|
||||||
float minDiff = float.MaxValue;
|
float minDiff = float.MaxValue;
|
||||||
|
|
||||||
|
@ -151,7 +151,6 @@ namespace osu.Game.Overlays
|
|||||||
private class SettingsSectionsContainer : SectionsContainer
|
private class SettingsSectionsContainer : SectionsContainer
|
||||||
{
|
{
|
||||||
public SearchContainer SearchContainer;
|
public SearchContainer SearchContainer;
|
||||||
private readonly Box headerBackground;
|
|
||||||
|
|
||||||
protected override Container<Drawable> CreateScrollContentContainer()
|
protected override Container<Drawable> CreateScrollContentContainer()
|
||||||
=> SearchContainer = new SearchContainer
|
=> SearchContainer = new SearchContainer
|
||||||
@ -164,11 +163,11 @@ namespace osu.Game.Overlays
|
|||||||
public SettingsSectionsContainer()
|
public SettingsSectionsContainer()
|
||||||
{
|
{
|
||||||
ScrollContainer.ScrollbarVisible = false;
|
ScrollContainer.ScrollbarVisible = false;
|
||||||
Add(headerBackground = new Box
|
HeaderBackground = new Box
|
||||||
{
|
{
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
RelativeSizeAxes = Axes.X
|
RelativeSizeAxes = Axes.Both
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
@ -176,9 +175,7 @@ namespace osu.Game.Overlays
|
|||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
// no null check because the usage of this class is strict
|
// no null check because the usage of this class is strict
|
||||||
headerBackground.Height = ExpandableHeader.LayoutSize.Y + FixedHeader.LayoutSize.Y;
|
HeaderBackground.Alpha = -ExpandableHeader.Y / ExpandableHeader.LayoutSize.Y * 0.5f;
|
||||||
headerBackground.Y = ExpandableHeader.Y;
|
|
||||||
headerBackground.Alpha = -ExpandableHeader.Y / ExpandableHeader.LayoutSize.Y * 0.5f;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,11 @@ namespace osu.Game.Users.Profile
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
FillMode = FillMode.Fill,
|
FillMode = FillMode.Fill,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(200)
|
OnLoadComplete = d => d.FadeInFromZero(200)
|
||||||
}) { RelativeSizeAxes = Axes.Both },
|
})
|
||||||
|
{
|
||||||
|
Masking = true,
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
},
|
||||||
new UpdateableAvatar
|
new UpdateableAvatar
|
||||||
{
|
{
|
||||||
User = user,
|
User = user,
|
||||||
|
@ -35,6 +35,11 @@ namespace osu.Game.Users
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ExpandableHeader = new UserPageHeader(user),
|
ExpandableHeader = new UserPageHeader(user),
|
||||||
FixedHeader = tab,
|
FixedHeader = tab,
|
||||||
|
HeaderBackground = new Box
|
||||||
|
{
|
||||||
|
Colour = OsuColour.Gray(34),
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
},
|
||||||
Sections = sections
|
Sections = sections
|
||||||
};
|
};
|
||||||
Add(sectionsContainer);
|
Add(sectionsContainer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user