79 lines
2.3 KiB
C#
79 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using JD.Guinness.WPF.Module.Configuration.Ps5;
|
|
using JD.Guinness.WPF.Module.Extension;
|
|
using JD.SonyTrophy.Service;
|
|
|
|
namespace JD.Guinness.WPF.Module.Model.Ps5
|
|
{
|
|
public sealed class Ps5Trophy : APlatformChallenge
|
|
{
|
|
private TrophyGrade _grade;
|
|
private bool _isSecret;
|
|
private bool _isRequiredForPlatinium;
|
|
private string _imagePath;
|
|
|
|
public TrophyGrade Grade
|
|
{
|
|
get => _grade;
|
|
set => SetProperty(ref _grade, value);
|
|
}
|
|
|
|
public bool IsSecret
|
|
{
|
|
get => _isSecret;
|
|
set => SetProperty(ref _isSecret, value);
|
|
}
|
|
|
|
public bool IsRequiredForPlatinium
|
|
{
|
|
get => _isRequiredForPlatinium;
|
|
set => SetProperty(ref _isRequiredForPlatinium, value);
|
|
}
|
|
|
|
public string ImagePath
|
|
{
|
|
get => _imagePath;
|
|
set => SetProperty(ref _imagePath, value);
|
|
}
|
|
|
|
public Ps5Trophy(Challenge challenge)
|
|
: base(challenge)
|
|
{ }
|
|
|
|
public Ps5Trophy DuplicateInto(Challenge challenge)
|
|
{
|
|
Ps5Trophy trophy = new Ps5Trophy(challenge)
|
|
{
|
|
Grade = Grade,
|
|
ImagePath = ImagePath,
|
|
Id = Id,
|
|
IsRequiredForPlatinium = IsRequiredForPlatinium,
|
|
IsSecret = IsSecret
|
|
};
|
|
trophy.CustomData.Add(CustomData.Values);
|
|
|
|
return trophy;
|
|
}
|
|
|
|
public Trophy ToServiceTrophy(IEnumerable<LanguageInfo> languages) => new Trophy(
|
|
Id,
|
|
IsSecret,
|
|
IsRequiredForPlatinium,
|
|
Grade,
|
|
languages.ToDictionary(
|
|
l => l.Ps5Id,
|
|
l => new Text(Challenge.Name.GetTranslation(l.Language), Challenge.Objective.GetTranslation(l.Language))),
|
|
ImagePath);
|
|
|
|
public Ps5TrophySave ToSave(string workspacePath) => new Ps5TrophySave
|
|
{
|
|
Extra = CustomData.Values.ToDictionary(p => p.Key, p => p.Value),
|
|
Grade = Grade,
|
|
Id = Id,
|
|
ImagePath = ImagePath.ToRelativePath(workspacePath),
|
|
IsRequiredForPlatinium = IsRequiredForPlatinium,
|
|
IsSecret = IsSecret
|
|
};
|
|
}
|
|
}
|