mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-12-17 07:40:41 +00:00
Déplacement background view model
This commit is contained in:
parent
e57bb0f6f5
commit
9cf62f4de3
3 changed files with 189 additions and 188 deletions
|
|
@ -8,9 +8,145 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
public class BackgroundViewModel : BaseViewModel
|
public class BackgroundViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
private BackgroundItem _Background = null;
|
private BackgroundItem _Background = null;
|
||||||
public BackgroundItem Background { get { return _Background; } set { SetProperty(ref _Background, value); } }
|
public BackgroundItem Background { get { return _Background; } set { SetProperty(ref _Background, value); OnPropertyChanged(nameof(SelectedBackground)); } }
|
||||||
|
|
||||||
private SubBackgroundItem _SubBackground = null;
|
private SubBackgroundItem _SubBackground = null;
|
||||||
public SubBackgroundItem SubBackground { get { return _SubBackground; } set { SetProperty(ref _SubBackground, value); } }
|
public SubBackgroundItem SubBackground { get { return _SubBackground; } set { SetProperty(ref _SubBackground, value); OnPropertyChanged(nameof(SelectedBackground)); } }
|
||||||
|
|
||||||
|
public BackgroundItem SelectedBackground
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _SubBackground ?? _Background;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _PersonalityTrait = null;
|
||||||
|
public string PersonalityTrait
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _PersonalityTrait;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _PersonalityTrait, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _PersonalityIdeal = null;
|
||||||
|
public string PersonalityIdeal
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _PersonalityIdeal;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _PersonalityIdeal, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _PersonalityLink = null;
|
||||||
|
public string PersonalityLink
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _PersonalityLink;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _PersonalityLink, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _PersonalityDefect = null;
|
||||||
|
public string PersonalityDefect
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _PersonalityDefect;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _PersonalityDefect, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _BackgroundSpecialty = null;
|
||||||
|
public string BackgroundSpecialty
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _BackgroundSpecialty;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _BackgroundSpecialty, value);
|
||||||
|
OnPropertyChanged(nameof(SelectedBackgroundSpecialty));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _SubBackgroundSpecialty = null;
|
||||||
|
public string SubBackgroundSpecialty
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _SubBackgroundSpecialty;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _SubBackgroundSpecialty, value);
|
||||||
|
OnPropertyChanged(nameof(SelectedBackgroundSpecialty));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string SelectedBackgroundSpecialty
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _SubBackgroundSpecialty ?? _BackgroundSpecialty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _PickedBackgroundSpecialty = null;
|
||||||
|
public string PickedBackgroundSpecialty
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _PickedBackgroundSpecialty;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _PickedBackgroundSpecialty, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private SkillItem _BackgroundSkill = null;
|
||||||
|
public SkillItem BackgroundSkill
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _BackgroundSkill;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _BackgroundSkill, value);
|
||||||
|
OnPropertyChanged(nameof(SelectedBackgroundSkill));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private SkillItem _SubBackgroundSkill = null;
|
||||||
|
public SkillItem SubBackgroundSkill
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _SubBackgroundSkill;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _SubBackgroundSkill, value);
|
||||||
|
OnPropertyChanged(nameof(SelectedBackgroundSkill));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public SkillItem SelectedBackgroundSkill
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _SubBackgroundSkill ?? _BackgroundSkill;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Selected PC
|
#region Selected PC
|
||||||
private PlayerCharacterViewModel _SelectedPlayerCharacter = new PlayerCharacterViewModel();
|
private PlayerCharacterViewModel _SelectedPlayerCharacter = new PlayerCharacterViewModel() { Background = new BackgroundViewModel() };
|
||||||
public PlayerCharacterViewModel SelectedPlayerCharacter
|
public PlayerCharacterViewModel SelectedPlayerCharacter
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -130,10 +130,10 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
private void ResetAlignments()
|
private void ResetAlignments()
|
||||||
{
|
{
|
||||||
Alignments = new NotifyTaskCompletion<List<AlignmentItem>>(Task.Run(() => LoadAlignmentsAsync()));
|
Alignments = new NotifyTaskCompletion<List<AlignmentItem>>(Task.Run(() => LoadAlignmentsAsync()));
|
||||||
if (!string.IsNullOrEmpty(SelectedPlayerCharacter.PersonalityIdeal))
|
if (!string.IsNullOrEmpty(SelectedPlayerCharacter.Background.PersonalityIdeal))
|
||||||
{
|
{
|
||||||
var regex = new Regex(".*\\((?<alignment>.*?)\\)$");
|
var regex = new Regex(".*\\((?<alignment>.*?)\\)$");
|
||||||
var match = regex.Match(SelectedPlayerCharacter.PersonalityIdeal);
|
var match = regex.Match(SelectedPlayerCharacter.Background.PersonalityIdeal);
|
||||||
var alignment = match.Groups["alignment"].Value;
|
var alignment = match.Groups["alignment"].Value;
|
||||||
if (!string.IsNullOrEmpty(alignment) && alignment.ToLower() != "tous")
|
if (!string.IsNullOrEmpty(alignment) && alignment.ToLower() != "tous")
|
||||||
{
|
{
|
||||||
|
|
@ -240,13 +240,13 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
|
|
||||||
private async Task<BackgroundItem> LoadBackgroundAsync(BackgroundItem background)
|
private async Task<BackgroundItem> LoadBackgroundAsync(BackgroundItem background)
|
||||||
{
|
{
|
||||||
SelectedPlayerCharacter.SubBackground = null;
|
SelectedPlayerCharacter.Background.SubBackground = null;
|
||||||
SelectedPlayerCharacter.PersonalityTrait = null;
|
SelectedPlayerCharacter.Background.PersonalityTrait = null;
|
||||||
SelectedPlayerCharacter.PersonalityIdeal = null;
|
SelectedPlayerCharacter.Background.PersonalityIdeal = null;
|
||||||
SelectedPlayerCharacter.PersonalityLink = null;
|
SelectedPlayerCharacter.Background.PersonalityLink = null;
|
||||||
SelectedPlayerCharacter.PersonalityDefect = null;
|
SelectedPlayerCharacter.Background.PersonalityDefect = null;
|
||||||
SelectedPlayerCharacter.BackgroundSpecialty = null;
|
SelectedPlayerCharacter.Background.BackgroundSpecialty = null;
|
||||||
SelectedPlayerCharacter.Background = background;
|
SelectedPlayerCharacter.Background.Background = background;
|
||||||
|
|
||||||
if (background != null)
|
if (background != null)
|
||||||
{
|
{
|
||||||
|
|
@ -336,7 +336,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
|
|
||||||
private async Task<SubBackgroundItem> LoadSubBackgroundAsync(SubBackgroundItem subbackground)
|
private async Task<SubBackgroundItem> LoadSubBackgroundAsync(SubBackgroundItem subbackground)
|
||||||
{
|
{
|
||||||
SelectedPlayerCharacter.SubBackground = subbackground;
|
SelectedPlayerCharacter.Background.SubBackground = subbackground;
|
||||||
if (subbackground == null)
|
if (subbackground == null)
|
||||||
{
|
{
|
||||||
SubBackgroundSpecialties = null;
|
SubBackgroundSpecialties = null;
|
||||||
|
|
@ -381,7 +381,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _SelectedPersonalityTrait, value);
|
SetProperty(ref _SelectedPersonalityTrait, value);
|
||||||
SelectedPlayerCharacter.PersonalityTrait = value;
|
SelectedPlayerCharacter.Background.PersonalityTrait = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -407,7 +407,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _SelectedPersonalityIdeal, value);
|
SetProperty(ref _SelectedPersonalityIdeal, value);
|
||||||
SelectedPlayerCharacter.PersonalityIdeal = value;
|
SelectedPlayerCharacter.Background.PersonalityIdeal = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -433,7 +433,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _SelectedPersonalityLink, value);
|
SetProperty(ref _SelectedPersonalityLink, value);
|
||||||
SelectedPlayerCharacter.PersonalityLink = value;
|
SelectedPlayerCharacter.Background.PersonalityLink = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -459,7 +459,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _SelectedPersonalityDefect, value);
|
SetProperty(ref _SelectedPersonalityDefect, value);
|
||||||
SelectedPlayerCharacter.PersonalityDefect = value;
|
SelectedPlayerCharacter.Background.PersonalityDefect = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -516,7 +516,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _BackgroundSpecialty, value);
|
SetProperty(ref _BackgroundSpecialty, value);
|
||||||
SelectedPlayerCharacter.BackgroundSpecialty = BackgroundSpecialty;
|
SelectedPlayerCharacter.Background.BackgroundSpecialty = BackgroundSpecialty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string _SubBackgroundSpecialty = null;
|
private string _SubBackgroundSpecialty = null;
|
||||||
|
|
@ -529,7 +529,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _SubBackgroundSpecialty, value);
|
SetProperty(ref _SubBackgroundSpecialty, value);
|
||||||
SelectedPlayerCharacter.SubBackgroundSpecialty = SubBackgroundSpecialty;
|
SelectedPlayerCharacter.Background.SubBackgroundSpecialty = SubBackgroundSpecialty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1190,7 +1190,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
form.SetField("Race", SelectedPlayerCharacter?.Race?.Name ?? string.Empty);
|
form.SetField("Race", SelectedPlayerCharacter?.Race?.Name ?? string.Empty);
|
||||||
form.SetField("Classe", SelectedPlayerCharacter?.Class?.Name ?? string.Empty);
|
form.SetField("Classe", SelectedPlayerCharacter?.Class?.Name ?? string.Empty);
|
||||||
form.SetField("Alignement", SelectedPlayerCharacter?.Alignment?.Name ?? string.Empty);
|
form.SetField("Alignement", SelectedPlayerCharacter?.Alignment?.Name ?? string.Empty);
|
||||||
form.SetField("Historique", SelectedPlayerCharacter?.Background?.Name ?? string.Empty);
|
form.SetField("Historique", SelectedPlayerCharacter?.Background?.Background?.Name ?? string.Empty);
|
||||||
form.SetField("Trait de personnalité",
|
form.SetField("Trait de personnalité",
|
||||||
(SelectedPersonalityTrait ?? string.Empty) + "\n\n" +
|
(SelectedPersonalityTrait ?? string.Empty) + "\n\n" +
|
||||||
(SelectedPersonalityIdeal ?? string.Empty) + "\n\n" +
|
(SelectedPersonalityIdeal ?? string.Empty) + "\n\n" +
|
||||||
|
|
|
||||||
|
|
@ -44,27 +44,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
_Class.LoadDetailsAsync().ConfigureAwait(true);
|
_Class.LoadDetailsAsync().ConfigureAwait(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//private BackgroundViewModel _Background = null;
|
private BackgroundViewModel _Background = null;
|
||||||
//public BackgroundViewModel Background
|
public BackgroundViewModel Background
|
||||||
//{
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// return _Background;
|
|
||||||
// }
|
|
||||||
// set
|
|
||||||
// {
|
|
||||||
// SetProperty(ref _Background, value);
|
|
||||||
// _Background.LoadDetailsAsync().ConfigureAwait(true);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Background
|
|
||||||
private BackgroundItem _Background = null;
|
|
||||||
public BackgroundItem Background
|
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
@ -73,157 +54,41 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _Background, value);
|
SetProperty(ref _Background, value);
|
||||||
OnPropertyChanged(nameof(SelectedBackground));
|
//_Background.LoadDetailsAsync().ConfigureAwait(true);
|
||||||
}
|
|
||||||
}
|
|
||||||
private SubBackgroundItem _SubBackground = null;
|
|
||||||
public SubBackgroundItem SubBackground
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _SubBackground;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _SubBackground, value);
|
|
||||||
OnPropertyChanged(nameof(SelectedBackground));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public BackgroundItem SelectedBackground
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _SubBackground ?? _Background;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private string _PersonalityTrait = null;
|
|
||||||
public string PersonalityTrait
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _PersonalityTrait;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _PersonalityTrait, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private string _PersonalityIdeal = null;
|
|
||||||
public string PersonalityIdeal
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _PersonalityIdeal;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _PersonalityIdeal, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private string _PersonalityLink = null;
|
|
||||||
public string PersonalityLink
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _PersonalityLink;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _PersonalityLink, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private string _PersonalityDefect = null;
|
|
||||||
public string PersonalityDefect
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _PersonalityDefect;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _PersonalityDefect, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private string _BackgroundSpecialty = null;
|
|
||||||
public string BackgroundSpecialty
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _BackgroundSpecialty;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _BackgroundSpecialty, value);
|
|
||||||
OnPropertyChanged(nameof(SelectedBackgroundSpecialty));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private string _SubBackgroundSpecialty = null;
|
|
||||||
public string SubBackgroundSpecialty
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _SubBackgroundSpecialty;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _SubBackgroundSpecialty, value);
|
|
||||||
OnPropertyChanged(nameof(SelectedBackgroundSpecialty));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public string SelectedBackgroundSpecialty
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _SubBackgroundSpecialty ?? _BackgroundSpecialty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _PickedBackgroundSpecialty = null;
|
|
||||||
public string PickedBackgroundSpecialty
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _PickedBackgroundSpecialty;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _PickedBackgroundSpecialty, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private SkillItem _BackgroundSkill = null;
|
|
||||||
public SkillItem BackgroundSkill
|
|
||||||
{
|
|
||||||
get
|
#region Background
|
||||||
{
|
//private BackgroundItem _Background = null;
|
||||||
return _BackgroundSkill;
|
//public BackgroundItem Background
|
||||||
}
|
//{
|
||||||
set
|
// get
|
||||||
{
|
// {
|
||||||
SetProperty(ref _BackgroundSkill, value);
|
// return _Background;
|
||||||
OnPropertyChanged(nameof(SelectedBackgroundSkill));
|
// }
|
||||||
}
|
// set
|
||||||
}
|
// {
|
||||||
private SkillItem _SubBackgroundSkill = null;
|
// SetProperty(ref _Background, value);
|
||||||
public SkillItem SubBackgroundSkill
|
// OnPropertyChanged(nameof(SelectedBackground));
|
||||||
{
|
// }
|
||||||
get
|
//}
|
||||||
{
|
//private SubBackgroundItem _SubBackground = null;
|
||||||
return _SubBackgroundSkill;
|
//public SubBackgroundItem SubBackground
|
||||||
}
|
//{
|
||||||
set
|
// get
|
||||||
{
|
// {
|
||||||
SetProperty(ref _SubBackgroundSkill, value);
|
// return _SubBackground;
|
||||||
OnPropertyChanged(nameof(SelectedBackgroundSkill));
|
// }
|
||||||
}
|
// set
|
||||||
}
|
// {
|
||||||
public SkillItem SelectedBackgroundSkill
|
// SetProperty(ref _SubBackground, value);
|
||||||
{
|
// OnPropertyChanged(nameof(SelectedBackground));
|
||||||
get
|
// }
|
||||||
{
|
//}
|
||||||
return _SubBackgroundSkill ?? _BackgroundSkill;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion Background
|
#endregion Background
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue