mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	Refonte Background suite
This commit is contained in:
		
							parent
							
								
									712d449f46
								
							
						
					
					
						commit
						e8fe98b227
					
				
					 3 changed files with 96 additions and 93 deletions
				
			
		|  | @ -8,10 +8,33 @@ 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 { SubBackground = null; SetProperty(ref _Background, value); OnPropertyChanged(nameof(BackgroundOrSubBackground)); } } |         public BackgroundItem Background | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return _Background; | ||||||
|  |             } | ||||||
|  |             set | ||||||
|  |             { | ||||||
|  |                 SubBackground = null; | ||||||
|  |                 SetProperty(ref _Background, value); | ||||||
|  |                 OnPropertyChanged(nameof(BackgroundOrSubBackground)); | ||||||
|  |             } | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         private SubBackgroundItem _SubBackground = null; |         private SubBackgroundItem _SubBackground = null; | ||||||
|         public SubBackgroundItem SubBackground { get { return _SubBackground; } set { SetProperty(ref _SubBackground, value); OnPropertyChanged(nameof(BackgroundOrSubBackground)); } } |         public SubBackgroundItem SubBackground | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return _SubBackground; | ||||||
|  |             } | ||||||
|  |             set | ||||||
|  |             { | ||||||
|  |                 SetProperty(ref _SubBackground, value); | ||||||
|  |                 OnPropertyChanged(nameof(BackgroundOrSubBackground)); | ||||||
|  |             } | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         public BackgroundItem BackgroundOrSubBackground |         public BackgroundItem BackgroundOrSubBackground | ||||||
|         { |         { | ||||||
|  | @ -78,43 +101,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             set |             set | ||||||
|             { |             { | ||||||
|                 SetProperty(ref _BackgroundSpecialty, value); |                 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; |         private SkillItem _BackgroundSkill = null; | ||||||
|         public SkillItem BackgroundSkill |         public SkillItem BackgroundSkill | ||||||
|         { |         { | ||||||
|  | @ -125,7 +113,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             set |             set | ||||||
|             { |             { | ||||||
|                 SetProperty(ref _BackgroundSkill, value); |                 SetProperty(ref _BackgroundSkill, value); | ||||||
|                 OnPropertyChanged(nameof(SelectedBackgroundSkill)); |                 OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill)); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         private SkillItem _SubBackgroundSkill = null; |         private SkillItem _SubBackgroundSkill = null; | ||||||
|  | @ -138,10 +126,10 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             set |             set | ||||||
|             { |             { | ||||||
|                 SetProperty(ref _SubBackgroundSkill, value); |                 SetProperty(ref _SubBackgroundSkill, value); | ||||||
|                 OnPropertyChanged(nameof(SelectedBackgroundSkill)); |                 OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill)); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         public SkillItem SelectedBackgroundSkill |         public SkillItem BackgroundOrSubBackgroundSkill | ||||||
|         { |         { | ||||||
|             get |             get | ||||||
|             { |             { | ||||||
|  |  | ||||||
|  | @ -60,8 +60,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             BackgroundSpecialties = null; |             BackgroundSpecialties = null; | ||||||
|             SubBackgroundSpecialties = null; |             SubBackgroundSpecialties = null; | ||||||
|             //BackgroundSpecialty = null; |             //BackgroundSpecialty = null; | ||||||
|             BackgroundSkill = null; |             SelectedPlayerCharacter.Background.BackgroundSkill = null; | ||||||
|             SubBackgroundSkill = null; |             SelectedPlayerCharacter.Background.SubBackgroundSkill = null; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private async void Background_PropertyChanged(object sender, PropertyChangedEventArgs e) |         private async void Background_PropertyChanged(object sender, PropertyChangedEventArgs e) | ||||||
|  | @ -72,6 +72,10 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|                     await LoadBackgroundAsync(SelectedPlayerCharacter.Background.Background); |                     await LoadBackgroundAsync(SelectedPlayerCharacter.Background.Background); | ||||||
|                     //SubBackgrounds = await LoadSubBackgroundsAsync(SelectedPlayerCharacter.Background.Background); |                     //SubBackgrounds = await LoadSubBackgroundsAsync(SelectedPlayerCharacter.Background.Background); | ||||||
|                     break; |                     break; | ||||||
|  |                 case nameof(SelectedPlayerCharacter.Background.SubBackground): | ||||||
|  |                     await LoadSubBackgroundAsync(SelectedPlayerCharacter.Background.SubBackground); | ||||||
|  |                     //SubBackgrounds = await LoadSubBackgroundsAsync(SelectedPlayerCharacter.Background.Background); | ||||||
|  |                     break; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -353,7 +357,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|                 BackgroundSpecialties = await LoadBackgroundsSpecialtiesAsync(background); |                 BackgroundSpecialties = await LoadBackgroundsSpecialtiesAsync(background); | ||||||
|                 //BackgroundSpecialty = null; |                 //BackgroundSpecialty = null; | ||||||
|                 //SubBackgroundSpecialties = null; |                 //SubBackgroundSpecialties = null; | ||||||
|                 BackgroundSkill = await LoadSkillAsync(background); |                 SelectedPlayerCharacter.Background.BackgroundSkill = await LoadSkillAsync(background); | ||||||
|                 //SubBackgroundSkill = null; |                 //SubBackgroundSkill = null; | ||||||
|                 ResetAlignments(); |                 ResetAlignments(); | ||||||
|             } |             } | ||||||
|  | @ -429,13 +433,13 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             if (subbackground == null) |             if (subbackground == null) | ||||||
|             { |             { | ||||||
|                 SubBackgroundSpecialties = null; |                 SubBackgroundSpecialties = null; | ||||||
|                 SubBackgroundSkill = null; |                 SelectedPlayerCharacter.Background.SubBackgroundSkill = null; | ||||||
|                 //SubBackgroundSpecialty = null; |                 //SubBackgroundSpecialty = null; | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                 SubBackgroundSpecialties = await LoadBackgroundsSpecialtiesAsync(subbackground); |                 SubBackgroundSpecialties = await LoadBackgroundsSpecialtiesAsync(subbackground); | ||||||
|                 SubBackgroundSkill = await LoadSkillAsync(subbackground); |                 SelectedPlayerCharacter.Background.SubBackgroundSkill = await LoadSkillAsync(subbackground); | ||||||
|             } |             } | ||||||
|             return subbackground; |             return subbackground; | ||||||
|         } |         } | ||||||
|  | @ -622,41 +626,41 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|         //    } |         //    } | ||||||
|         //} |         //} | ||||||
| 
 | 
 | ||||||
|         private SkillItem _BackgroundSkill = null; |         //private SkillItem _BackgroundSkill = null; | ||||||
|         public SkillItem BackgroundSkill |         //public SkillItem BackgroundSkill | ||||||
|         { |         //{ | ||||||
|             get |         //    get | ||||||
|             { |         //    { | ||||||
|                 return _BackgroundSkill; |         //        return _BackgroundSkill; | ||||||
|             } |         //    } | ||||||
|             set |         //    set | ||||||
|             { |         //    { | ||||||
|                 SetProperty(ref _BackgroundSkill, value); |         //        SetProperty(ref _BackgroundSkill, value); | ||||||
|                 OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill)); |         //        OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill)); | ||||||
|                 //OnPropertyChanged(nameof(HasBackgroundSkill)); |         //        //OnPropertyChanged(nameof(HasBackgroundSkill)); | ||||||
|             } |         //    } | ||||||
|         } |         //} | ||||||
|         private SkillItem _SubBackgroundSkill = null; |         //private SkillItem _SubBackgroundSkill = null; | ||||||
|         public SkillItem SubBackgroundSkill |         //public SkillItem SubBackgroundSkill | ||||||
|         { |         //{ | ||||||
|             get |         //    get | ||||||
|             { |         //    { | ||||||
|                 return _SubBackgroundSkill; |         //        return _SubBackgroundSkill; | ||||||
|             } |         //    } | ||||||
|             set |         //    set | ||||||
|             { |         //    { | ||||||
|                 SetProperty(ref _SubBackgroundSkill, value); |         //        SetProperty(ref _SubBackgroundSkill, value); | ||||||
|                 OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill)); |         //        OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill)); | ||||||
|                 //OnPropertyChanged(nameof(HasBackgroundSkill)); |         //        //OnPropertyChanged(nameof(HasBackgroundSkill)); | ||||||
|             } |         //    } | ||||||
|         } |         //} | ||||||
|         public SkillItem BackgroundOrSubBackgroundSkill |         //public SkillItem BackgroundOrSubBackgroundSkill | ||||||
|         { |         //{ | ||||||
|             get |         //    get | ||||||
|             { |         //    { | ||||||
|                 return _SubBackgroundSkill ?? _BackgroundSkill; |         //        return _SubBackgroundSkill ?? _BackgroundSkill; | ||||||
|             } |         //    } | ||||||
|         } |         //} | ||||||
|         //public bool HasBackgroundSkill |         //public bool HasBackgroundSkill | ||||||
|         //{ |         //{ | ||||||
|         //    get |         //    get | ||||||
|  |  | ||||||
|  | @ -23,6 +23,27 @@ | ||||||
|                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds}" SelectedItem="{Binding SelectedPlayerCharacter.Background.Background, Mode=TwoWay}" /> |                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds}" SelectedItem="{Binding SelectedPlayerCharacter.Background.Background, Mode=TwoWay}" /> | ||||||
|                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedPlayerCharacter.Background.SubBackground, Mode=TwoWay}" IsVisible="{Binding SubBackgrounds, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" /> |                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedPlayerCharacter.Background.SubBackground, Mode=TwoWay}" IsVisible="{Binding SubBackgrounds, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" /> | ||||||
| 
 | 
 | ||||||
|  |                 <pickers:StringPickerView  | ||||||
|  |                     BindingContext="{Binding}"  | ||||||
|  |                     IsVisible="{Binding BackgroundOrSubBackgroundSpecialties, Converter={StaticResource NullToFalseConverter}}"  | ||||||
|  |                     Title="{Binding BackgroundOrSubBackgroundSpecialties.Name}"  | ||||||
|  |                     Description="{Binding BackgroundOrSubBackgroundSpecialties.Description}"  | ||||||
|  |                     ItemsSource="{Binding BackgroundOrSubBackgroundSpecialties.BindableTable}"  | ||||||
|  |                     SelectedItem="{Binding SelectedPlayerCharacter.Background.BackgroundSpecialty, Mode=TwoWay}" /> | ||||||
|  | 
 | ||||||
|  |                 <pickers:StringPickerView  | ||||||
|  |                     BindingContext="{Binding}"  | ||||||
|  |                     Title="Trait de personnalité"  | ||||||
|  |                     IsVisible="{Binding SelectedPlayerCharacter.Background.Background, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}"  | ||||||
|  |                     ItemsSource="{Binding PersonalityTraits}"  | ||||||
|  |                     SelectedItem="{Binding SelectedPlayerCharacter.Background.PersonalityTrait, Mode=TwoWay}" /> | ||||||
|  | 
 | ||||||
|  |                 <pickers:StringPickerView BindingContext="{Binding}" Title="Idéal" IsVisible="{Binding SelectedPlayerCharacter.Background.Background, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityIdeals}" SelectedItem="{Binding SelectedPlayerCharacter.Background.PersonalityIdeal, Mode=TwoWay}" /> | ||||||
|  | 
 | ||||||
|  |                 <pickers:StringPickerView BindingContext="{Binding}" Title="Lien" IsVisible="{Binding SelectedPlayerCharacter.Background.Background, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityLinks}" SelectedItem="{Binding SelectedPlayerCharacter.Background.PersonalityLink, Mode=TwoWay}" /> | ||||||
|  | 
 | ||||||
|  |                 <pickers:StringPickerView BindingContext="{Binding}" Title="Défaut" IsVisible="{Binding SelectedPlayerCharacter.Background.Background, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityDefects}" SelectedItem="{Binding SelectedPlayerCharacter.Background.PersonalityDefect, Mode=TwoWay}" /> | ||||||
|  | 
 | ||||||
|                 <!-- test --> |                 <!-- test --> | ||||||
|                 <!--<views:StringPickerView BindingContext="{Binding}" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" Title="Compétences" SelectedItem="{Binding PreferedBackground.Abilities}" />--> |                 <!--<views:StringPickerView BindingContext="{Binding}" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" Title="Compétences" SelectedItem="{Binding PreferedBackground.Abilities}" />--> | ||||||
| 
 | 
 | ||||||
|  | @ -50,23 +71,13 @@ | ||||||
|                         <mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.Background.BackgroundOrSubBackground.Equipment}" /> |                         <mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.Background.BackgroundOrSubBackground.Equipment}" /> | ||||||
|                     </StackLayout> |                     </StackLayout> | ||||||
|                 </Frame> |                 </Frame> | ||||||
|                 <Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding BackgroundOrSubBackgroundSkill, Converter={StaticResource NullToFalseConverter}}"> |                 <Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Background.BackgroundOrSubBackgroundSkill, Converter={StaticResource NullToFalseConverter}}"> | ||||||
|                     <StackLayout Padding="0"> |                     <StackLayout Padding="0"> | ||||||
|                         <mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding BackgroundOrSubBackgroundSkill.Name, StringFormat='# {0}'}" /> |                         <mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.Background.BackgroundOrSubBackgroundSkill.Name, StringFormat='# {0}'}" /> | ||||||
|                         <mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding BackgroundOrSubBackgroundSkill.Description}" /> |                         <mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.Background.BackgroundOrSubBackgroundSkill.Description}" /> | ||||||
|                     </StackLayout> |                     </StackLayout> | ||||||
|                 </Frame> |                 </Frame> | ||||||
| 
 | 
 | ||||||
|                 <pickers:StringPickerView BindingContext="{Binding}" IsVisible="{Binding BackgroundSpecialties, Converter={StaticResource NullToFalseConverter}}" Title="{Binding BackgroundOrSubBackgroundSpecialties.Name}" Description="{Binding PreferedBackgroundSpecialties.Description}" ItemsSource="{Binding PreferedBackgroundSpecialties.BindableTable}" SelectedItem="{Binding SelectedPlayerCharacter.Background.BackgroundSpecialty, Mode=TwoWay}" /> |  | ||||||
| 
 |  | ||||||
|                 <pickers:StringPickerView BindingContext="{Binding}" Title="Trait de personnalité" IsVisible="{Binding SelectedPlayerCharacter.Background.Background, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityTraits}" SelectedItem="{Binding SelectedPlayerCharacter.Background.PersonalityTrait, Mode=TwoWay}" /> |  | ||||||
| 
 |  | ||||||
|                 <pickers:StringPickerView BindingContext="{Binding}" Title="Idéal" IsVisible="{Binding SelectedPlayerCharacter.Background.Background, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityIdeals}" SelectedItem="{Binding SelectedPlayerCharacter.Background.PersonalityIdeal, Mode=TwoWay}" /> |  | ||||||
| 
 |  | ||||||
|                 <pickers:StringPickerView BindingContext="{Binding}" Title="Lien" IsVisible="{Binding SelectedPlayerCharacter.Background.Background, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityLinks}" SelectedItem="{Binding SelectedPlayerCharacter.Background.PersonalityLink, Mode=TwoWay}" /> |  | ||||||
| 
 |  | ||||||
|                 <pickers:StringPickerView BindingContext="{Binding}" Title="Défaut" IsVisible="{Binding SelectedPlayerCharacter.Background.Background, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityDefects}" SelectedItem="{Binding SelectedPlayerCharacter.Background.PersonalityDefect, Mode=TwoWay}" /> |  | ||||||
| 
 |  | ||||||
|             </StackLayout> |             </StackLayout> | ||||||
|         </ScrollView> |         </ScrollView> | ||||||
|     </ContentView.Content> |     </ContentView.Content> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez