mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 13:42:54 +08:00
Integration into overlay
This commit is contained in:
parent
8cd96acffc
commit
023892738a
@ -38,5 +38,27 @@ 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)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case BeatmapSetType.Favourite:
|
||||||
|
return user.FavouriteBeatmapsetCount;
|
||||||
|
|
||||||
|
case BeatmapSetType.Graveyard:
|
||||||
|
return user.GraveyardBeatmapsetCount;
|
||||||
|
|
||||||
|
case BeatmapSetType.Loved:
|
||||||
|
return user.LovedBeatmapsetCount;
|
||||||
|
|
||||||
|
case BeatmapSetType.RankedAndApproved:
|
||||||
|
return user.RankedAndApprovedBeatmapsetCount;
|
||||||
|
|
||||||
|
case BeatmapSetType.Unranked:
|
||||||
|
return user.UnrankedBeatmapsetCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ 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; }
|
||||||
@ -44,11 +45,28 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Text = header,
|
AutoSizeAxes = Axes.Both,
|
||||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(5, 0),
|
||||||
Margin = new MarginPadding { Top = 10, Bottom = 10 },
|
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
|
||||||
{
|
{
|
||||||
@ -90,6 +108,8 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
VisiblePages = 0;
|
VisiblePages = 0;
|
||||||
ItemsContainer.Clear();
|
ItemsContainer.Clear();
|
||||||
|
|
||||||
|
count.Value = GetCount(e.NewValue);
|
||||||
|
|
||||||
if (e.NewValue != null)
|
if (e.NewValue != null)
|
||||||
showMore();
|
showMore();
|
||||||
}
|
}
|
||||||
@ -124,6 +144,8 @@ 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);
|
||||||
|
@ -32,6 +32,18 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
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)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case ScoreType.Firsts:
|
||||||
|
return user.ScoresFirstCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override Drawable CreateDrawableItem(APILegacyScoreInfo model)
|
protected override Drawable CreateDrawableItem(APILegacyScoreInfo model)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -126,6 +126,24 @@ namespace osu.Game.Users
|
|||||||
[JsonProperty(@"follower_count")]
|
[JsonProperty(@"follower_count")]
|
||||||
public int FollowerCount;
|
public int FollowerCount;
|
||||||
|
|
||||||
|
[JsonProperty(@"favourite_beatmapset_count")]
|
||||||
|
public int FavouriteBeatmapsetCount;
|
||||||
|
|
||||||
|
[JsonProperty(@"graveyard_beatmapset_count")]
|
||||||
|
public int GraveyardBeatmapsetCount;
|
||||||
|
|
||||||
|
[JsonProperty(@"loved_beatmapset_count")]
|
||||||
|
public int LovedBeatmapsetCount;
|
||||||
|
|
||||||
|
[JsonProperty(@"ranked_and_approved_beatmapset_count")]
|
||||||
|
public int RankedAndApprovedBeatmapsetCount;
|
||||||
|
|
||||||
|
[JsonProperty(@"unranked_beatmapset_count")]
|
||||||
|
public int UnrankedBeatmapsetCount;
|
||||||
|
|
||||||
|
[JsonProperty(@"scores_first_count")]
|
||||||
|
public int ScoresFirstCount;
|
||||||
|
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
private string[] playstyle
|
private string[] playstyle
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user