mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 07:26:09 +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 | ||||
|     { | ||||
|         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; | ||||
|         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 | ||||
|         private PlayerCharacterViewModel _SelectedPlayerCharacter = new PlayerCharacterViewModel(); | ||||
|         private PlayerCharacterViewModel _SelectedPlayerCharacter = new PlayerCharacterViewModel() { Background = new BackgroundViewModel() }; | ||||
|         public PlayerCharacterViewModel SelectedPlayerCharacter | ||||
|         { | ||||
|             get | ||||
|  | @ -130,10 +130,10 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
|         private void ResetAlignments() | ||||
|         { | ||||
|             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 match = regex.Match(SelectedPlayerCharacter.PersonalityIdeal); | ||||
|                 var match = regex.Match(SelectedPlayerCharacter.Background.PersonalityIdeal); | ||||
|                 var alignment = match.Groups["alignment"].Value; | ||||
|                 if (!string.IsNullOrEmpty(alignment) && alignment.ToLower() != "tous") | ||||
|                 { | ||||
|  | @ -240,13 +240,13 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
| 
 | ||||
|         private async Task<BackgroundItem> LoadBackgroundAsync(BackgroundItem background) | ||||
|         { | ||||
|             SelectedPlayerCharacter.SubBackground = null; | ||||
|             SelectedPlayerCharacter.PersonalityTrait = null; | ||||
|             SelectedPlayerCharacter.PersonalityIdeal = null; | ||||
|             SelectedPlayerCharacter.PersonalityLink = null; | ||||
|             SelectedPlayerCharacter.PersonalityDefect = null; | ||||
|             SelectedPlayerCharacter.BackgroundSpecialty = null; | ||||
|             SelectedPlayerCharacter.Background = background; | ||||
|             SelectedPlayerCharacter.Background.SubBackground = null; | ||||
|             SelectedPlayerCharacter.Background.PersonalityTrait = null; | ||||
|             SelectedPlayerCharacter.Background.PersonalityIdeal = null; | ||||
|             SelectedPlayerCharacter.Background.PersonalityLink = null; | ||||
|             SelectedPlayerCharacter.Background.PersonalityDefect = null; | ||||
|             SelectedPlayerCharacter.Background.BackgroundSpecialty = null; | ||||
|             SelectedPlayerCharacter.Background.Background = background; | ||||
| 
 | ||||
|             if (background != null) | ||||
|             { | ||||
|  | @ -336,7 +336,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
| 
 | ||||
|         private async Task<SubBackgroundItem> LoadSubBackgroundAsync(SubBackgroundItem subbackground) | ||||
|         { | ||||
|             SelectedPlayerCharacter.SubBackground = subbackground; | ||||
|             SelectedPlayerCharacter.Background.SubBackground = subbackground; | ||||
|             if (subbackground == null) | ||||
|             { | ||||
|                 SubBackgroundSpecialties = null; | ||||
|  | @ -381,7 +381,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
|             set | ||||
|             { | ||||
|                 SetProperty(ref _SelectedPersonalityTrait, value); | ||||
|                 SelectedPlayerCharacter.PersonalityTrait = value; | ||||
|                 SelectedPlayerCharacter.Background.PersonalityTrait = value; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | @ -407,7 +407,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
|             set | ||||
|             { | ||||
|                 SetProperty(ref _SelectedPersonalityIdeal, value); | ||||
|                 SelectedPlayerCharacter.PersonalityIdeal = value; | ||||
|                 SelectedPlayerCharacter.Background.PersonalityIdeal = value; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | @ -433,7 +433,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
|             set | ||||
|             { | ||||
|                 SetProperty(ref _SelectedPersonalityLink, value); | ||||
|                 SelectedPlayerCharacter.PersonalityLink = value; | ||||
|                 SelectedPlayerCharacter.Background.PersonalityLink = value; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | @ -459,7 +459,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
|             set | ||||
|             { | ||||
|                 SetProperty(ref _SelectedPersonalityDefect, value); | ||||
|                 SelectedPlayerCharacter.PersonalityDefect = value; | ||||
|                 SelectedPlayerCharacter.Background.PersonalityDefect = value; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | @ -516,7 +516,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
|             set | ||||
|             { | ||||
|                 SetProperty(ref _BackgroundSpecialty, value); | ||||
|                 SelectedPlayerCharacter.BackgroundSpecialty = BackgroundSpecialty; | ||||
|                 SelectedPlayerCharacter.Background.BackgroundSpecialty = BackgroundSpecialty; | ||||
|             } | ||||
|         } | ||||
|         private string _SubBackgroundSpecialty = null; | ||||
|  | @ -529,7 +529,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
|             set | ||||
|             { | ||||
|                 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("Classe", SelectedPlayerCharacter?.Class?.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é",  | ||||
|                 (SelectedPersonalityTrait ?? string.Empty) + "\n\n" + | ||||
|                 (SelectedPersonalityIdeal ?? string.Empty) + "\n\n" + | ||||
|  |  | |||
|  | @ -44,27 +44,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
|                 _Class.LoadDetailsAsync().ConfigureAwait(true); | ||||
|             } | ||||
|         } | ||||
|         //private BackgroundViewModel _Background = null; | ||||
|         //public BackgroundViewModel Background | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        return _Background; | ||||
|         //    } | ||||
|         //    set | ||||
|         //    { | ||||
|         //        SetProperty(ref _Background, value); | ||||
|         //        _Background.LoadDetailsAsync().ConfigureAwait(true); | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         #region Background | ||||
|         private BackgroundItem _Background = null; | ||||
|         public BackgroundItem Background | ||||
|         private BackgroundViewModel _Background = null; | ||||
|         public BackgroundViewModel Background | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|  | @ -73,157 +54,41 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
|             set | ||||
|             { | ||||
|                 SetProperty(ref _Background, value); | ||||
|                 OnPropertyChanged(nameof(SelectedBackground)); | ||||
|             } | ||||
|         } | ||||
|         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; | ||||
|                 //_Background.LoadDetailsAsync().ConfigureAwait(true); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         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; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         #region Background | ||||
|         //private BackgroundItem _Background = null; | ||||
|         //public BackgroundItem Background | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        return _Background; | ||||
|         //    } | ||||
|         //    set | ||||
|         //    { | ||||
|         //        SetProperty(ref _Background, value); | ||||
|         //        OnPropertyChanged(nameof(SelectedBackground)); | ||||
|         //    } | ||||
|         //} | ||||
|         //private SubBackgroundItem _SubBackground = null; | ||||
|         //public SubBackgroundItem SubBackground | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        return _SubBackground; | ||||
|         //    } | ||||
|         //    set | ||||
|         //    { | ||||
|         //        SetProperty(ref _SubBackground, value); | ||||
|         //        OnPropertyChanged(nameof(SelectedBackground)); | ||||
|         //    } | ||||
|         //} | ||||
|         #endregion Background | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez