1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:17:23 +08:00

Move missing text to PaginatedProfileSubsection

This commit is contained in:
Andrei Zavatski 2020-11-21 23:03:54 +03:00
parent 11c3ccfcaa
commit dbfc839df3
2 changed files with 17 additions and 18 deletions

View File

@ -13,6 +13,8 @@ using System.Linq;
using System.Threading;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Profile.Sections
{
@ -33,10 +35,13 @@ namespace osu.Game.Overlays.Profile.Sections
private CancellationTokenSource loadCancellation;
private ShowMoreButton moreButton;
private OsuSpriteText missing;
private readonly string missingText;
protected PaginatedProfileSubsection(Bindable<User> user, string headerText = "", string missingText = "", CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
: base(user, headerText, missingText, counterVisibilityState)
: base(user, headerText, counterVisibilityState)
{
this.missingText = missingText;
}
protected override Drawable CreateContent() => new FillFlowContainer
@ -59,6 +64,12 @@ namespace osu.Game.Overlays.Profile.Sections
Alpha = 0,
Margin = new MarginPadding { Top = 10 },
Action = showMore,
},
missing = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 15),
Text = missingText,
Alpha = 0,
}
}
};
@ -97,15 +108,15 @@ namespace osu.Game.Overlays.Profile.Sections
moreButton.Hide();
moreButton.IsLoading = false;
if (!string.IsNullOrEmpty(Missing.Text))
Missing.Show();
if (!string.IsNullOrEmpty(missingText))
missing.Show();
return;
}
LoadComponentsAsync(items.Select(CreateDrawableItem).Where(d => d != null), drawables =>
{
Missing.Hide();
missing.Hide();
moreButton.FadeTo(items.Count == ItemsPerPage ? 1 : 0);
moreButton.IsLoading = false;

View File

@ -5,8 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using JetBrains.Annotations;
@ -16,18 +14,14 @@ namespace osu.Game.Overlays.Profile.Sections
{
protected readonly Bindable<User> User = new Bindable<User>();
protected OsuSpriteText Missing { get; private set; }
private readonly string headerText;
private readonly string missingText;
private readonly CounterVisibilityState counterVisibilityState;
private ProfileSubsectionHeader header;
protected ProfileSubsection(Bindable<User> user, string headerText = "", string missingText = "", CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
protected ProfileSubsection(Bindable<User> user, string headerText = "", CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
{
this.headerText = headerText;
this.missingText = missingText;
this.counterVisibilityState = counterVisibilityState;
User.BindTo(user);
}
@ -45,13 +39,7 @@ namespace osu.Game.Overlays.Profile.Sections
{
Alpha = string.IsNullOrEmpty(headerText) ? 0 : 1
},
CreateContent(),
Missing = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 15),
Text = missingText,
Alpha = 0,
},
CreateContent()
};
}