mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 18:32:56 +08:00
Refactor API logic
This commit is contained in:
parent
2135a7fd7b
commit
c546df8a80
@ -3,13 +3,13 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetCountriesResponse : ResponseWithCursor
|
||||
{
|
||||
[JsonProperty("ranking")]
|
||||
public List<APICountryRankings> Countries;
|
||||
public List<CountryStatistics> Countries;
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,13 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUsersResponse : ResponseWithCursor
|
||||
{
|
||||
[JsonProperty("ranking")]
|
||||
public List<APIUserRankings> Users;
|
||||
public List<UserStatistics> Users;
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
// 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 Newtonsoft.Json;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
public class APICountryRankings : CountryStatistics
|
||||
{
|
||||
[JsonProperty]
|
||||
public Country Country;
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
// 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 Newtonsoft.Json;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
public class APIUserRankings : UserStatistics
|
||||
{
|
||||
[JsonProperty]
|
||||
public User User;
|
||||
}
|
||||
}
|
@ -7,12 +7,12 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Users.Drawables;
|
||||
using osuTK;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using System;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings.Tables
|
||||
{
|
||||
public class CountriesTable : RankingsTable<APICountryRankings>
|
||||
public class CountriesTable : RankingsTable<CountryStatistics>
|
||||
{
|
||||
public CountriesTable(int page = 1)
|
||||
: base(page)
|
||||
@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
new TableColumn("Avg. Perf.", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
};
|
||||
|
||||
protected override Drawable[] CreateContent(int index, APICountryRankings item) => new Drawable[]
|
||||
protected override Drawable[] CreateContent(int index, CountryStatistics item) => new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
|
@ -9,11 +9,11 @@ using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Users.Drawables;
|
||||
using osuTK;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings.Tables
|
||||
{
|
||||
public class PerformanceTable : RankingsTable<APIUserRankings>
|
||||
public class PerformanceTable : RankingsTable<UserStatistics>
|
||||
{
|
||||
public PerformanceTable(int page = 1)
|
||||
: base(page)
|
||||
@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
new TableColumn("A", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
};
|
||||
|
||||
protected override Drawable[] CreateContent(int index, APIUserRankings item)
|
||||
protected override Drawable[] CreateContent(int index, UserStatistics item)
|
||||
{
|
||||
var content = new List<Drawable>
|
||||
{
|
||||
|
@ -7,13 +7,13 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Users.Drawables;
|
||||
using osuTK;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings.Tables
|
||||
{
|
||||
public class ScoresTable : RankingsTable<APIUserRankings>
|
||||
public class ScoresTable : RankingsTable<UserStatistics>
|
||||
{
|
||||
public ScoresTable(int page = 1)
|
||||
: base(page)
|
||||
@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
new TableColumn("A", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
};
|
||||
|
||||
protected override Drawable[] CreateContent(int index, APIUserRankings item)
|
||||
protected override Drawable[] CreateContent(int index, UserStatistics item)
|
||||
{
|
||||
var content = new List<Drawable>
|
||||
{
|
||||
|
@ -7,6 +7,9 @@ namespace osu.Game.Users
|
||||
{
|
||||
public class CountryStatistics
|
||||
{
|
||||
[JsonProperty]
|
||||
public Country Country;
|
||||
|
||||
[JsonProperty(@"code")]
|
||||
public string FlagName;
|
||||
|
||||
|
@ -10,6 +10,9 @@ namespace osu.Game.Users
|
||||
{
|
||||
public class UserStatistics
|
||||
{
|
||||
[JsonProperty]
|
||||
public User User;
|
||||
|
||||
[JsonProperty(@"level")]
|
||||
public LevelInfo Level;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user