34 lines
926 B
C#
34 lines
926 B
C#
using System.Text;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using LeagueAPI.Models.DDragon.Champions;
|
|
|
|
namespace ARAMUtility.ViewModel;
|
|
|
|
public partial class ChampionViewModel(ChampionData data) : ObservableObject
|
|
{
|
|
[ObservableProperty]
|
|
public partial int Id { get; set; } = data.Id;
|
|
|
|
[ObservableProperty]
|
|
public partial string? Name { get; set; } = data.Name;
|
|
|
|
[ObservableProperty]
|
|
public required partial string ImagePath { get; set; }
|
|
|
|
public string AramBalanceText { get; } = GetAramBalanceText(data);
|
|
|
|
[ObservableProperty]
|
|
public required partial bool IsNeededForChallenge { get; set; }
|
|
|
|
private static string GetAramBalanceText(ChampionData data)
|
|
{
|
|
StringBuilder sb = new();
|
|
sb.AppendLine(data.Name);
|
|
if (data.AramBalance.HasValue)
|
|
{
|
|
data.AramBalance.Value.ToDisplayString(sb);
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
}
|