Merge branch 'master' into useroverlay-tabs

This commit is contained in:
Dean Herbert
2019-06-24 17:27:47 +09:00
committed by GitHub
34 changed files with 468 additions and 204 deletions

View File

@ -134,9 +134,9 @@ namespace osu.Game.Overlays.Dialog
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Position = new Vector2(0f, -50f),
Direction = FillDirection.Vertical,
Spacing = new Vector2(0f, 10f),
Padding = new MarginPadding { Bottom = 10 },
Children = new Drawable[]
{
new Container
@ -144,10 +144,6 @@ namespace osu.Game.Overlays.Dialog
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Size = ringSize,
Margin = new MarginPadding
{
Bottom = 30,
},
Children = new Drawable[]
{
ring = new CircularContainer
@ -181,15 +177,15 @@ namespace osu.Game.Overlays.Dialog
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(15),
TextAnchor = Anchor.TopCentre,
},
body = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 18))
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
TextAnchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(15),
TextAnchor = Anchor.TopCentre,
},
},
},

View File

@ -56,16 +56,12 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.X,
Children = new[]
{
new NotificationSection
new NotificationSection(@"Notifications", @"Clear All")
{
Title = @"Notifications",
ClearText = @"Clear All",
AcceptTypes = new[] { typeof(SimpleNotification) }
},
new NotificationSection
new NotificationSection(@"Running Tasks", @"Cancel All")
{
Title = @"Running Tasks",
ClearText = @"Cancel All",
AcceptTypes = new[] { typeof(ProgressNotification) }
}
}

View File

@ -17,10 +17,7 @@ namespace osu.Game.Overlays.Notifications
{
public class NotificationSection : AlwaysUpdateFillFlowContainer<Drawable>
{
private OsuSpriteText titleText;
private OsuSpriteText countText;
private ClearAllButton clearButton;
private OsuSpriteText countDrawable;
private FlowContainer<Notification> notifications;
@ -35,28 +32,14 @@ namespace osu.Game.Overlays.Notifications
public IEnumerable<Type> AcceptTypes;
private string clearText;
private readonly string clearButtonText;
public string ClearText
private readonly string titleText;
public NotificationSection(string title, string clearButtonText)
{
get => clearText;
set
{
clearText = value;
if (clearButton != null) clearButton.Text = clearText;
}
}
private string title;
public string Title
{
get => title;
set
{
title = value;
if (titleText != null) titleText.Text = title.ToUpperInvariant();
}
this.clearButtonText = clearButtonText;
titleText = title;
}
[BackgroundDependencyLoader]
@ -82,9 +65,9 @@ namespace osu.Game.Overlays.Notifications
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
clearButton = new ClearAllButton
new ClearAllButton
{
Text = clearText,
Text = clearButtonText,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Action = clearAll
@ -99,12 +82,12 @@ namespace osu.Game.Overlays.Notifications
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
titleText = new OsuSpriteText
new OsuSpriteText
{
Text = title.ToUpperInvariant(),
Text = titleText.ToUpperInvariant(),
Font = OsuFont.GetFont(weight: FontWeight.Black)
},
countText = new OsuSpriteText
countDrawable = new OsuSpriteText
{
Text = "3",
Colour = colours.Yellow,
@ -134,7 +117,7 @@ namespace osu.Game.Overlays.Notifications
{
base.Update();
countText.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString();
countDrawable.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString();
}
private class ClearAllButton : OsuClickableContainer

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,50 +31,109 @@ namespace osu.Game.Overlays.Profile
protected ProfileSection()
{
Direction = FillDirection.Vertical;
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
InternalChildren = new Drawable[]
{
new OsuSpriteText
background = new Box
{
Text = Title,
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true),
Margin = new MarginPadding
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Vertical = 10
}
RelativeSizeAxes = Axes.Both,
},
content = new FillFlowContainer
new SectionTriangles
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
},
new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding
Children = new Drawable[]
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Bottom = 20
}
},
new Box
{
RelativeSizeAxes = Axes.X,
Height = 1,
Colour = OsuColour.Gray(34),
EdgeSmoothness = new Vector2(1)
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.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
Add(new OsuSpriteText
[BackgroundDependencyLoader]
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!",
Colour = Color4.Gray,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Margin = new MarginPadding { Top = 100, Bottom = 100 }
});
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

@ -0,0 +1,17 @@
// 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.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsNumberBox : SettingsItem<string>
{
protected override Drawable CreateControl() => new OsuNumberBox
{
Margin = new MarginPadding { Top = 5 },
RelativeSizeAxes = Axes.X,
};
}
}

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;
@ -21,7 +22,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;
@ -63,12 +64,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
@ -169,5 +169,21 @@ namespace osu.Game.Overlays
}
}
}
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),
};
}
}
}