1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 14:23:02 +08:00

Remove old header from PaginatedContainer

This commit is contained in:
Andrei Zavatski 2020-09-07 22:24:10 +03:00
parent 5a7e2e96e0
commit 1c55039994
11 changed files with 20 additions and 65 deletions

View File

@ -18,8 +18,8 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
private const float panel_padding = 10f;
private readonly BeatmapSetType type;
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing = "None... yet.")
: base(user, header, missing)
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user)
: base(user, "None... yet.")
{
this.type = type;
@ -38,15 +38,5 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
};
protected override int GetCount(User user) => type switch
{
BeatmapSetType.Favourite => user.FavouriteBeatmapsetCount,
BeatmapSetType.Graveyard => user.GraveyardBeatmapsetCount,
BeatmapSetType.Loved => user.LovedBeatmapsetCount,
BeatmapSetType.RankedAndApproved => user.RankedAndApprovedBeatmapsetCount,
BeatmapSetType.Unranked => user.UnrankedBeatmapsetCount,
_ => 0
};
}
}

View File

@ -16,11 +16,11 @@ namespace osu.Game.Overlays.Profile.Sections
{
Children = new[]
{
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User, "Ranked & Approved Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, "Loved Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User, "Pending Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User),
new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User),
new PaginatedBeatmapContainer(BeatmapSetType.Loved, User),
new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User),
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User)
};
}
}

View File

@ -15,10 +15,9 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
public class PaginatedMostPlayedBeatmapContainer : PaginatedContainer<APIUserMostPlayedBeatmap>
{
public PaginatedMostPlayedBeatmapContainer(Bindable<User> user)
: base(user, "Most Played Beatmaps", "No records. :(")
: base(user, "No records. :(")
{
ItemsPerPage = 5;
ItemsContainer.Direction = FillDirection.Vertical;
}

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Sections
Children = new Drawable[]
{
new PaginatedMostPlayedBeatmapContainer(User),
new PaginatedScoreContainer(ScoreType.Recent, User, "Recent Plays (24h)", "No performance records. :("),
new PaginatedScoreContainer(ScoreType.Recent, User, "No performance records. :("),
};
}
}

View File

@ -13,8 +13,8 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
{
public class PaginatedKudosuHistoryContainer : PaginatedContainer<APIKudosuHistory>
{
public PaginatedKudosuHistoryContainer(Bindable<User> user, string header, string missing)
: base(user, header, missing)
public PaginatedKudosuHistoryContainer(Bindable<User> user, string missing)
: base(user, missing)
{
ItemsPerPage = 5;
}

View File

@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Sections
Children = new Drawable[]
{
new KudosuInfo(User),
new PaginatedKudosuHistoryContainer(User, null, @"This user hasn't received any kudosu!"),
new PaginatedKudosuHistoryContainer(User, "This user hasn't received any kudosu!"),
};
}
}

View File

@ -24,7 +24,6 @@ namespace osu.Game.Overlays.Profile.Sections
private readonly OsuSpriteText missingText;
private APIRequest<List<TModel>> retrievalRequest;
private CancellationTokenSource loadCancellation;
private readonly BindableInt count = new BindableInt();
[Resolved]
private IAPIProvider api { get; set; }
@ -36,7 +35,7 @@ namespace osu.Game.Overlays.Profile.Sections
protected readonly FillFlowContainer ItemsContainer;
protected RulesetStore Rulesets;
protected PaginatedContainer(Bindable<User> user, string header, string missing)
protected PaginatedContainer(Bindable<User> user, string missing)
{
User.BindTo(user);
@ -46,29 +45,6 @@ namespace osu.Game.Overlays.Profile.Sections
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Margin = new MarginPadding { Top = 10, Bottom = 10 },
Children = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = header,
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
},
new CounterPill
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Current = { BindTarget = count }
}
}
},
ItemsContainer = new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
@ -112,7 +88,6 @@ namespace osu.Game.Overlays.Profile.Sections
if (e.NewValue != null)
{
showMore();
count.Value = GetCount(e.NewValue);
}
}
@ -146,8 +121,6 @@ namespace osu.Game.Overlays.Profile.Sections
}, loadCancellation.Token);
});
protected virtual int GetCount(User user) => 0;
protected abstract APIRequest<List<TModel>> CreateRequest();
protected abstract Drawable CreateDrawableItem(TModel model);

View File

@ -17,25 +17,18 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
private readonly ScoreType type;
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string header, string missing)
: base(user, header, missing)
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string missing)
: base(user, missing)
{
this.type = type;
ItemsPerPage = 5;
ItemsContainer.Direction = FillDirection.Vertical;
}
protected override APIRequest<List<APILegacyScoreInfo>> CreateRequest() =>
new GetUserScoresRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
protected override int GetCount(User user) => type switch
{
ScoreType.Firsts => user.ScoresFirstCount,
_ => 0
};
protected override Drawable CreateDrawableItem(APILegacyScoreInfo model)
{
switch (type)

View File

@ -16,8 +16,8 @@ namespace osu.Game.Overlays.Profile.Sections
{
Children = new[]
{
new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance", "No performance records. :("),
new PaginatedScoreContainer(ScoreType.Firsts, User, "First Place Ranks", "No awesome performance records yet. :("),
new PaginatedScoreContainer(ScoreType.Best, User, "No performance records. :("),
new PaginatedScoreContainer(ScoreType.Firsts, User, "No awesome performance records yet. :("),
};
}
}

View File

@ -14,8 +14,8 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
{
public class PaginatedRecentActivityContainer : PaginatedContainer<APIRecentActivity>
{
public PaginatedRecentActivityContainer(Bindable<User> user, string header, string missing)
: base(user, header, missing)
public PaginatedRecentActivityContainer(Bindable<User> user, string missing)
: base(user, missing)
{
ItemsPerPage = 10;
ItemsContainer.Spacing = new Vector2(0, 8);

View File

@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Sections
{
Children = new[]
{
new PaginatedRecentActivityContainer(User, null, @"This user hasn't done anything notable recently!"),
new PaginatedRecentActivityContainer(User, "This user hasn't done anything notable recently!"),
};
}
}