1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-24 06:47:36 +08:00

Merge branch 'master' into async-beatmap-load

This commit is contained in:
Dan Balasescu 2019-06-24 14:24:07 +09:00 committed by GitHub
commit 5f05b9ac0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 115 additions and 36 deletions

View File

@ -1,25 +1,29 @@
// 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Users; using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.Profile namespace osu.Game.Overlays.Profile
{ {
public abstract class ProfileSection : FillFlowContainer public abstract class ProfileSection : Container
{ {
public abstract string Title { get; } public abstract string Title { get; }
public abstract string Identifier { get; } public abstract string Identifier { get; }
private readonly FillFlowContainer content; private readonly FillFlowContainer content;
private readonly Box background;
private readonly Box underscore;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
@ -27,50 +31,109 @@ namespace osu.Game.Overlays.Profile
protected ProfileSection() protected ProfileSection()
{ {
Direction = FillDirection.Vertical;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new OsuSpriteText background = new Box
{ {
Text = Title, RelativeSizeAxes = Axes.Both,
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true),
Margin = new MarginPadding
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Vertical = 10
}
}, },
content = new FillFlowContainer new SectionTriangles
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
},
new FillFlowContainer
{ {
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Padding = new MarginPadding Children = new Drawable[]
{ {
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, new Container
Bottom = 20 {
} AutoSizeAxes = Axes.Both,
}, Margin = new MarginPadding
new Box {
{ Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
RelativeSizeAxes = Axes.X, Top = 15,
Height = 1, Bottom = 10,
Colour = OsuColour.Gray(34), },
EdgeSmoothness = new Vector2(1) Children = new Drawable[]
{
new OsuSpriteText
{
Text = Title,
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
},
underscore = new Box
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.TopCentre,
Margin = new MarginPadding { Top = 4 },
RelativeSizeAxes = Axes.X,
Height = 2,
}
}
},
content = new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Bottom = 20
}
},
},
} }
}; };
}
// placeholder [BackgroundDependencyLoader]
Add(new OsuSpriteText private void load(OsuColour colours)
{
background.Colour = colours.GreySeafoamDarker;
underscore.Colour = colours.Seafoam;
}
private class SectionTriangles : Container
{
private readonly Triangles triangles;
private readonly Box foreground;
public SectionTriangles()
{ {
Text = @"coming soon!", RelativeSizeAxes = Axes.X;
Colour = Color4.Gray, Height = 100;
Anchor = Anchor.Centre, Masking = true;
Origin = Anchor.Centre, Children = new Drawable[]
Margin = new MarginPadding { Top = 100, Bottom = 100 } {
}); triangles = new Triangles
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.Both,
TriangleScale = 3,
},
foreground = new Box
{
RelativeSizeAxes = Axes.Both,
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
triangles.ColourLight = colours.GreySeafoamDark;
triangles.ColourDark = colours.GreySeafoamDarker.Darken(0.2f);
foreground.Colour = ColourInfo.GradientVertical(colours.GreySeafoamDarker, colours.GreySeafoamDarker.Opacity(0));
}
} }
} }
} }

View File

@ -4,6 +4,7 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -23,7 +24,7 @@ namespace osu.Game.Overlays
private ProfileSection[] sections; private ProfileSection[] sections;
private GetUserRequest userReq; private GetUserRequest userReq;
protected ProfileHeader Header; protected ProfileHeader Header;
private SectionsContainer<ProfileSection> sectionsContainer; private ProfileSectionsContainer sectionsContainer;
private ProfileTabControl tabs; private ProfileTabControl tabs;
public const float CONTENT_X_MARGIN = 70; public const float CONTENT_X_MARGIN = 70;
@ -65,12 +66,11 @@ namespace osu.Game.Overlays
Add(new Box Add(new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.2f) Colour = OsuColour.Gray(0.1f)
}); });
Add(sectionsContainer = new SectionsContainer<ProfileSection> Add(sectionsContainer = new ProfileSectionsContainer
{ {
RelativeSizeAxes = Axes.Both,
ExpandableHeader = Header = new ProfileHeader(), ExpandableHeader = Header = new ProfileHeader(),
FixedHeader = tabs, FixedHeader = tabs,
HeaderBackground = new Box HeaderBackground = new Box
@ -180,5 +180,21 @@ namespace osu.Game.Overlays
bottom.Colour = colours.Yellow; bottom.Colour = colours.Yellow;
} }
} }
private class ProfileSectionsContainer : SectionsContainer<ProfileSection>
{
public ProfileSectionsContainer()
{
RelativeSizeAxes = Axes.Both;
}
protected override FlowContainer<ProfileSection> CreateScrollContentContainer() => new FillFlowContainer<ProfileSection>
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Spacing = new Vector2(0, 20),
};
}
} }
} }