1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 10:17:32 +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.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.Profile
{
public abstract class ProfileSection : FillFlowContainer
public abstract class ProfileSection : Container
{
public abstract string Title { get; }
public abstract string Identifier { get; }
private readonly FillFlowContainer content;
private readonly Box background;
private readonly Box underscore;
protected override Container<Drawable> Content => content;
@ -27,19 +31,51 @@ namespace osu.Game.Overlays.Profile
protected ProfileSection()
{
Direction = FillDirection.Vertical;
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
InternalChildren = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
},
new SectionTriangles
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
},
new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Children = new Drawable[]
{
new Container
{
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Top = 15,
Bottom = 10,
},
Children = new Drawable[]
{
new OsuSpriteText
{
Text = Title,
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true),
Margin = new MarginPadding
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
},
underscore = new Box
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Vertical = 10
Anchor = Anchor.BottomCentre,
Origin = Anchor.TopCentre,
Margin = new MarginPadding { Top = 4 },
RelativeSizeAxes = Axes.X,
Height = 2,
}
}
},
content = new FillFlowContainer
@ -53,24 +89,51 @@ namespace osu.Game.Overlays.Profile
Bottom = 20
}
},
new Box
{
RelativeSizeAxes = Axes.X,
Height = 1,
Colour = OsuColour.Gray(34),
EdgeSmoothness = new Vector2(1)
},
}
};
}
// placeholder
Add(new OsuSpriteText
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Text = @"coming soon!",
Colour = Color4.Gray,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Margin = new MarginPadding { Top = 100, Bottom = 100 }
});
background.Colour = colours.GreySeafoamDarker;
underscore.Colour = colours.Seafoam;
}
private class SectionTriangles : Container
{
private readonly Triangles triangles;
private readonly Box foreground;
public SectionTriangles()
{
RelativeSizeAxes = Axes.X;
Height = 100;
Masking = true;
Children = new Drawable[]
{
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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
@ -23,7 +24,7 @@ namespace osu.Game.Overlays
private ProfileSection[] sections;
private GetUserRequest userReq;
protected ProfileHeader Header;
private SectionsContainer<ProfileSection> sectionsContainer;
private ProfileSectionsContainer sectionsContainer;
private ProfileTabControl tabs;
public const float CONTENT_X_MARGIN = 70;
@ -65,12 +66,11 @@ namespace osu.Game.Overlays
Add(new Box
{
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(),
FixedHeader = tabs,
HeaderBackground = new Box
@ -180,5 +180,21 @@ namespace osu.Game.Overlays
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),
};
}
}
}