mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 05:52:55 +08:00
Remove old header from PaginatedContainer
This commit is contained in:
parent
5a7e2e96e0
commit
1c55039994
@ -18,8 +18,8 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
|||||||
private const float panel_padding = 10f;
|
private const float panel_padding = 10f;
|
||||||
private readonly BeatmapSetType type;
|
private readonly BeatmapSetType type;
|
||||||
|
|
||||||
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing = "None... yet.")
|
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user)
|
||||||
: base(user, header, missing)
|
: base(user, "None... yet.")
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
@ -38,15 +38,5 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = 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
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,11 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps"),
|
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User, "Ranked & Approved Beatmaps"),
|
new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, "Loved Beatmaps"),
|
new PaginatedBeatmapContainer(BeatmapSetType.Loved, User),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User, "Pending Beatmaps"),
|
new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded Beatmaps"),
|
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,9 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
public class PaginatedMostPlayedBeatmapContainer : PaginatedContainer<APIUserMostPlayedBeatmap>
|
public class PaginatedMostPlayedBeatmapContainer : PaginatedContainer<APIUserMostPlayedBeatmap>
|
||||||
{
|
{
|
||||||
public PaginatedMostPlayedBeatmapContainer(Bindable<User> user)
|
public PaginatedMostPlayedBeatmapContainer(Bindable<User> user)
|
||||||
: base(user, "Most Played Beatmaps", "No records. :(")
|
: base(user, "No records. :(")
|
||||||
{
|
{
|
||||||
ItemsPerPage = 5;
|
ItemsPerPage = 5;
|
||||||
|
|
||||||
ItemsContainer.Direction = FillDirection.Vertical;
|
ItemsContainer.Direction = FillDirection.Vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new PaginatedMostPlayedBeatmapContainer(User),
|
new PaginatedMostPlayedBeatmapContainer(User),
|
||||||
new PaginatedScoreContainer(ScoreType.Recent, User, "Recent Plays (24h)", "No performance records. :("),
|
new PaginatedScoreContainer(ScoreType.Recent, User, "No performance records. :("),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
|||||||
{
|
{
|
||||||
public class PaginatedKudosuHistoryContainer : PaginatedContainer<APIKudosuHistory>
|
public class PaginatedKudosuHistoryContainer : PaginatedContainer<APIKudosuHistory>
|
||||||
{
|
{
|
||||||
public PaginatedKudosuHistoryContainer(Bindable<User> user, string header, string missing)
|
public PaginatedKudosuHistoryContainer(Bindable<User> user, string missing)
|
||||||
: base(user, header, missing)
|
: base(user, missing)
|
||||||
{
|
{
|
||||||
ItemsPerPage = 5;
|
ItemsPerPage = 5;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new KudosuInfo(User),
|
new KudosuInfo(User),
|
||||||
new PaginatedKudosuHistoryContainer(User, null, @"This user hasn't received any kudosu!"),
|
new PaginatedKudosuHistoryContainer(User, "This user hasn't received any kudosu!"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
private readonly OsuSpriteText missingText;
|
private readonly OsuSpriteText missingText;
|
||||||
private APIRequest<List<TModel>> retrievalRequest;
|
private APIRequest<List<TModel>> retrievalRequest;
|
||||||
private CancellationTokenSource loadCancellation;
|
private CancellationTokenSource loadCancellation;
|
||||||
private readonly BindableInt count = new BindableInt();
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
@ -36,7 +35,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
protected readonly FillFlowContainer ItemsContainer;
|
protected readonly FillFlowContainer ItemsContainer;
|
||||||
protected RulesetStore Rulesets;
|
protected RulesetStore Rulesets;
|
||||||
|
|
||||||
protected PaginatedContainer(Bindable<User> user, string header, string missing)
|
protected PaginatedContainer(Bindable<User> user, string missing)
|
||||||
{
|
{
|
||||||
User.BindTo(user);
|
User.BindTo(user);
|
||||||
|
|
||||||
@ -46,29 +45,6 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
|
|
||||||
Children = new Drawable[]
|
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
|
ItemsContainer = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
@ -112,7 +88,6 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
if (e.NewValue != null)
|
if (e.NewValue != null)
|
||||||
{
|
{
|
||||||
showMore();
|
showMore();
|
||||||
count.Value = GetCount(e.NewValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,8 +121,6 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
}, loadCancellation.Token);
|
}, loadCancellation.Token);
|
||||||
});
|
});
|
||||||
|
|
||||||
protected virtual int GetCount(User user) => 0;
|
|
||||||
|
|
||||||
protected abstract APIRequest<List<TModel>> CreateRequest();
|
protected abstract APIRequest<List<TModel>> CreateRequest();
|
||||||
|
|
||||||
protected abstract Drawable CreateDrawableItem(TModel model);
|
protected abstract Drawable CreateDrawableItem(TModel model);
|
||||||
|
@ -17,25 +17,18 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
{
|
{
|
||||||
private readonly ScoreType type;
|
private readonly ScoreType type;
|
||||||
|
|
||||||
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string header, string missing)
|
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string missing)
|
||||||
: base(user, header, missing)
|
: base(user, missing)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
ItemsPerPage = 5;
|
ItemsPerPage = 5;
|
||||||
|
|
||||||
ItemsContainer.Direction = FillDirection.Vertical;
|
ItemsContainer.Direction = FillDirection.Vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override APIRequest<List<APILegacyScoreInfo>> CreateRequest() =>
|
protected override APIRequest<List<APILegacyScoreInfo>> CreateRequest() =>
|
||||||
new GetUserScoresRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
|
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)
|
protected override Drawable CreateDrawableItem(APILegacyScoreInfo model)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -16,8 +16,8 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance", "No performance records. :("),
|
new PaginatedScoreContainer(ScoreType.Best, User, "No performance records. :("),
|
||||||
new PaginatedScoreContainer(ScoreType.Firsts, User, "First Place Ranks", "No awesome performance records yet. :("),
|
new PaginatedScoreContainer(ScoreType.Firsts, User, "No awesome performance records yet. :("),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
|||||||
{
|
{
|
||||||
public class PaginatedRecentActivityContainer : PaginatedContainer<APIRecentActivity>
|
public class PaginatedRecentActivityContainer : PaginatedContainer<APIRecentActivity>
|
||||||
{
|
{
|
||||||
public PaginatedRecentActivityContainer(Bindable<User> user, string header, string missing)
|
public PaginatedRecentActivityContainer(Bindable<User> user, string missing)
|
||||||
: base(user, header, missing)
|
: base(user, missing)
|
||||||
{
|
{
|
||||||
ItemsPerPage = 10;
|
ItemsPerPage = 10;
|
||||||
ItemsContainer.Spacing = new Vector2(0, 8);
|
ItemsContainer.Spacing = new Vector2(0, 8);
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
{
|
{
|
||||||
Children = new[]
|
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!"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user