80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using JD.Guinness.WPF.Module.Configuration.Ps4;
|
|
using JD.Guinness.WPF.Module.Extension;
|
|
using JD.SonyTrophy.Service;
|
|
|
|
namespace JD.Guinness.WPF.Module.Model.Ps4
|
|
{
|
|
public sealed class Ps4Trophy : 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 Ps4Trophy(Challenge challenge)
|
|
: base(challenge)
|
|
{ }
|
|
|
|
public Ps4Trophy DuplicateInto(Challenge challenge)
|
|
{
|
|
Ps4Trophy trophy = new Ps4Trophy(challenge)
|
|
{
|
|
Grade = Grade,
|
|
ImagePath = ImagePath,
|
|
Id = Id,
|
|
IsRequiredForPlatinium = IsRequiredForPlatinium,
|
|
IsSecret = IsSecret
|
|
};
|
|
trophy.CustomData.Add(CustomData.Values);
|
|
|
|
return trophy;
|
|
}
|
|
|
|
public OldTrophy ToServiceTrophy(IEnumerable<LanguageInfo> languages) => new OldTrophy(
|
|
Id,
|
|
IsSecret,
|
|
IsRequiredForPlatinium,
|
|
Grade,
|
|
new Text(Challenge.Name.GetMasterText(), Challenge.Objective.GetMasterText()),
|
|
languages.ToDictionary(
|
|
l => l.Ps4Id,
|
|
l => new Text(Challenge.Name.GetTranslation(l.Language), Challenge.Objective.GetTranslation(l.Language))),
|
|
ImagePath);
|
|
|
|
public Ps4TrophySave ToSave(string workspacePath) => new Ps4TrophySave
|
|
{
|
|
Extra = CustomData.Values.ToDictionary(p => p.Key, p => p.Value),
|
|
Grade = Grade,
|
|
Id = Id,
|
|
ImagePath = ImagePath.ToRelativePath(workspacePath),
|
|
IsRequiredForPlatinium = IsRequiredForPlatinium,
|
|
IsSecret = IsSecret
|
|
};
|
|
}
|
|
}
|