2024-08-05 11:38:55 +00:00
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.Net.Http.Json;
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using RustTools.muqing;
|
2024-07-14 11:24:10 +00:00
|
|
|
|
|
|
|
|
|
namespace RustTools.ViewModels;
|
|
|
|
|
|
|
|
|
|
public partial class RankingViewModel : ObservableRecipient
|
|
|
|
|
{
|
2024-08-05 11:38:55 +00:00
|
|
|
|
public ObservableCollection<ModListResponse.ModData> RankingList { get; set; } = new();
|
2024-07-14 11:24:10 +00:00
|
|
|
|
public RankingViewModel()
|
|
|
|
|
{
|
2024-08-05 11:38:55 +00:00
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
private async void Init()
|
|
|
|
|
{
|
|
|
|
|
//List必须小于10才能重新加载
|
|
|
|
|
var StringList = await ApiFox.mod.list("downloadNumber", "10", "");
|
|
|
|
|
var modData = JsonConvert.DeserializeObject<ModListResponse>(StringList);
|
|
|
|
|
foreach (var item in modData.Data)
|
|
|
|
|
{
|
|
|
|
|
item.Icon = item.Icon.Equals("") ? "/Assets/image/image.svg" : item.Icon.Replace("..", "https://rust.coldmint.top");
|
|
|
|
|
RankingList.Add(item);
|
|
|
|
|
}
|
2024-07-14 11:24:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|