mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 07:26:09 +00:00 
			
		
		
		
	Début refonte pc
This commit is contained in:
		
							parent
							
								
									c46212b76e
								
							
						
					
					
						commit
						020ed61657
					
				
					 5 changed files with 129 additions and 128 deletions
				
			
		|  | @ -26,44 +26,41 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|         { |         { | ||||||
|             get |             get | ||||||
|             { |             { | ||||||
|                 return new Command(async() => await ExecuteResetPlayerCharacterCommandAsync()); |                 return new Command(async () => await ExecuteResetPlayerCharacterCommandAsync()); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private async Task ExecuteResetPlayerCharacterCommandAsync() |         private async Task ExecuteResetPlayerCharacterCommandAsync() | ||||||
|         { |         { | ||||||
|             await Task.Run(() => |             _Random = new Random(DateTime.Now.Millisecond); | ||||||
|             { |  | ||||||
|                 _Random = new Random(DateTime.Now.Millisecond); |  | ||||||
| 
 | 
 | ||||||
|                 SelectedPlayerCharacter = new PlayerCharacterViewModel() { Background = new BackgroundViewModel(), Abilities = new AbilitiesViewModel() }; |             SelectedPlayerCharacter = new PlayerCharacterViewModel() { Background = new BackgroundViewModel(), Abilities = new AbilitiesViewModel() }; | ||||||
|                 SelectedPlayerCharacter.PropertyChanged += SelectedPlayerCharacter_PropertyChanged; |             SelectedPlayerCharacter.PropertyChanged += SelectedPlayerCharacter_PropertyChanged; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|                 ResetAlignments(); |             ResetAlignments(); | ||||||
|                 Races = new NotifyTaskCompletion<List<RaceViewModel>>(Task.Run(() => LoadRacesAsync())); |             Races = await Task.Run(async () => await LoadRacesAsync()); | ||||||
|                 Classes = new NotifyTaskCompletion<List<ClassViewModel>>(Task.Run(() => LoadClassesAsync())); |             Classes = await Task.Run(async () => await LoadClassesAsync()); | ||||||
| 
 | 
 | ||||||
|                 Backgrounds = new NotifyTaskCompletion<List<BackgroundItem>>(Task.Run(() => LoadBackgroundsAsync())); |             Backgrounds = await Task.Run(async () => await LoadBackgroundsAsync()); | ||||||
|                 SelectedBackground = null; |             SelectedBackground = null; | ||||||
|                 //NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(null); |             //NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(null); | ||||||
|                 SubBackgrounds = null; |             SubBackgrounds = null; | ||||||
|                 SelectedSubBackground = null; |             SelectedSubBackground = null; | ||||||
|                 //NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(null); |             //NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(null); | ||||||
|                 PersonalityTraits = null; |             PersonalityTraits = null; | ||||||
|                 PersonalityIdeals = null; |             PersonalityIdeals = null; | ||||||
|                 PersonalityLinks = null; |             PersonalityLinks = null; | ||||||
|                 PersonalityDefects = null; |             PersonalityDefects = null; | ||||||
|                 SelectedPersonalityTrait = null; |             SelectedPersonalityTrait = null; | ||||||
|                 SelectedPersonalityIdeal = null; |             SelectedPersonalityIdeal = null; | ||||||
|                 SelectedPersonalityLink = null; |             SelectedPersonalityLink = null; | ||||||
|                 SelectedPersonalityDefect = null; |             SelectedPersonalityDefect = null; | ||||||
|                 BackgroundSpecialties = null; |             BackgroundSpecialties = null; | ||||||
|                 SubBackgroundSpecialties = null; |             SubBackgroundSpecialties = null; | ||||||
|                 BackgroundSpecialty = null; |             BackgroundSpecialty = null; | ||||||
|                 BackgroundSkill = null; |             BackgroundSkill = null; | ||||||
|                 SubBackgroundSkill = null; |             SubBackgroundSkill = null; | ||||||
|             }); |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public PlayerCharacterEditorViewModel() |         public PlayerCharacterEditorViewModel() | ||||||
|  | @ -71,9 +68,9 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             ExecuteResetPlayerCharacterCommandAsync(); |             ExecuteResetPlayerCharacterCommandAsync(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private void SelectedPlayerCharacter_PropertyChanged(object sender, PropertyChangedEventArgs e) |         private async void SelectedPlayerCharacter_PropertyChanged(object sender, PropertyChangedEventArgs e) | ||||||
|         { |         { | ||||||
|             switch(e.PropertyName) |             switch (e.PropertyName) | ||||||
|             { |             { | ||||||
|                 case nameof(SelectedPlayerCharacter.Race): |                 case nameof(SelectedPlayerCharacter.Race): | ||||||
|                     SelectedPlayerCharacter.Abilities.Unlisten(); |                     SelectedPlayerCharacter.Abilities.Unlisten(); | ||||||
|  | @ -107,6 +104,9 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
| 
 | 
 | ||||||
|                     SelectedPlayerCharacter.Abilities.Listen(); |                     SelectedPlayerCharacter.Abilities.Listen(); | ||||||
|                     break; |                     break; | ||||||
|  |                 case nameof(SelectedPlayerCharacter.Background): | ||||||
|  |                     SubBackgrounds = await LoadSubBackgroundsAsync(SelectedPlayerCharacter.Background.Background); | ||||||
|  |                     break; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -120,7 +120,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             } |             } | ||||||
|             set |             set | ||||||
|             { |             { | ||||||
|                 if(_SelectedPlayerCharacter != null) |                 if (_SelectedPlayerCharacter != null) | ||||||
|                 { |                 { | ||||||
|                     _SelectedPlayerCharacter.PropertyChanged -= _SelectedPlayerCharacter_PropertyChanged; |                     _SelectedPlayerCharacter.PropertyChanged -= _SelectedPlayerCharacter_PropertyChanged; | ||||||
|                 } |                 } | ||||||
|  | @ -134,7 +134,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
| 
 | 
 | ||||||
|         private void _SelectedPlayerCharacter_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |         private void _SelectedPlayerCharacter_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) | ||||||
|         { |         { | ||||||
|             if(string.IsNullOrEmpty(e.PropertyName) || e.PropertyName == "Race") |             if (string.IsNullOrEmpty(e.PropertyName) || e.PropertyName == "Race") | ||||||
|             { |             { | ||||||
|                 OnSelectedPlayerCharacterRaceChanged(); |                 OnSelectedPlayerCharacterRaceChanged(); | ||||||
|             } |             } | ||||||
|  | @ -228,7 +228,9 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|         #endregion Alignment |         #endregion Alignment | ||||||
| 
 | 
 | ||||||
|         #region Race |         #region Race | ||||||
|         public NotifyTaskCompletion<List<RaceViewModel>> Races { get; private set; } | 
 | ||||||
|  |         private List<RaceViewModel> _Races = null; | ||||||
|  |         public List<RaceViewModel> Races { get { return _Races; } private set { SetProperty(ref _Races, value); } } | ||||||
| 
 | 
 | ||||||
|         public async Task<List<RaceViewModel>> LoadRacesAsync() |         public async Task<List<RaceViewModel>> LoadRacesAsync() | ||||||
|         { |         { | ||||||
|  | @ -258,7 +260,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|         #endregion Race |         #endregion Race | ||||||
| 
 | 
 | ||||||
|         #region Class |         #region Class | ||||||
|         public NotifyTaskCompletion<List<ClassViewModel>> Classes { get; private set; } |         private List<ClassViewModel> _Classes = null; | ||||||
|  |         public List<ClassViewModel> Classes { get { return _Classes; } private set { SetProperty(ref _Classes, value); } } | ||||||
| 
 | 
 | ||||||
|         public async Task<List<ClassViewModel>> LoadClassesAsync() |         public async Task<List<ClassViewModel>> LoadClassesAsync() | ||||||
|         { |         { | ||||||
|  | @ -270,7 +273,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|         #endregion Class |         #endregion Class | ||||||
| 
 | 
 | ||||||
|         #region Background |         #region Background | ||||||
|         public NotifyTaskCompletion<List<BackgroundItem>> Backgrounds { get; private set; } |         private List<BackgroundItem> _Backgrounds = null; | ||||||
|  |         public List<BackgroundItem> Backgrounds { get { return _Backgrounds; } private set { SetProperty(ref _Backgrounds, value); } } | ||||||
| 
 | 
 | ||||||
|         //private int _BackgroundSelectedIndex = -1; |         //private int _BackgroundSelectedIndex = -1; | ||||||
|         //public int BackgroundSelectedIndex |         //public int BackgroundSelectedIndex | ||||||
|  | @ -858,84 +862,84 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             "2 (-4)", "3 (-4)", "4 (-3)", "5 (-3)", "6 (-2)", "7 (-2)", "8 (-1)", "9 (-1)", "10 (+0)", "11 (+0)", "12 (+1)", "13 (+1)", "14 (+2)", "15 (+2)", "16 (+3)", "17 (+3)", "18 (+4)", "19 (+4)", "20 (+5)", "21 (+5)" |             "2 (-4)", "3 (-4)", "4 (-3)", "5 (-3)", "6 (-2)", "7 (-2)", "8 (-1)", "9 (-1)", "10 (+0)", "11 (+0)", "12 (+1)", "13 (+1)", "14 (+2)", "15 (+2)", "16 (+3)", "17 (+3)", "18 (+4)", "19 (+4)", "20 (+5)", "21 (+5)" | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
| /*        private int? _Strength = null; |         /*        private int? _Strength = null; | ||||||
|         public int? Strength |                 public int? Strength | ||||||
|         { |                 { | ||||||
|             get |                     get | ||||||
|             { |                     { | ||||||
|                 return _Strength; |                         return _Strength; | ||||||
|             } |                     } | ||||||
|             set |                     set | ||||||
|             { |                     { | ||||||
|                 SetProperty(ref _Strength, value); |                         SetProperty(ref _Strength, value); | ||||||
|             } |                     } | ||||||
|         } |                 } | ||||||
| 
 | 
 | ||||||
|         private int? _Dexterity = null; |                 private int? _Dexterity = null; | ||||||
|         public int? Dexterity |                 public int? Dexterity | ||||||
|         { |                 { | ||||||
|             get |                     get | ||||||
|             { |                     { | ||||||
|                 return _Dexterity; |                         return _Dexterity; | ||||||
|             } |                     } | ||||||
|             set |                     set | ||||||
|             { |                     { | ||||||
|                 SetProperty(ref _Dexterity, value); |                         SetProperty(ref _Dexterity, value); | ||||||
|             } |                     } | ||||||
|         } |                 } | ||||||
| 
 | 
 | ||||||
|         private int? _Constitution = null; |                 private int? _Constitution = null; | ||||||
|         public int? Constitution |                 public int? Constitution | ||||||
|         { |                 { | ||||||
|             get |                     get | ||||||
|             { |                     { | ||||||
|                 return _Constitution; |                         return _Constitution; | ||||||
|             } |                     } | ||||||
|             set |                     set | ||||||
|             { |                     { | ||||||
|                 SetProperty(ref _Constitution, value); |                         SetProperty(ref _Constitution, value); | ||||||
|             } |                     } | ||||||
|         } |                 } | ||||||
| 
 | 
 | ||||||
|         private int? _Intelligence = null; |                 private int? _Intelligence = null; | ||||||
|         public int? Intelligence |                 public int? Intelligence | ||||||
|         { |                 { | ||||||
|             get |                     get | ||||||
|             { |                     { | ||||||
|                 return _Intelligence; |                         return _Intelligence; | ||||||
|             } |                     } | ||||||
|             set |                     set | ||||||
|             { |                     { | ||||||
|                 SetProperty(ref _Intelligence, value); |                         SetProperty(ref _Intelligence, value); | ||||||
|             } |                     } | ||||||
|         } |                 } | ||||||
| 
 | 
 | ||||||
|         private int? _Wisdom = null; |                 private int? _Wisdom = null; | ||||||
|         public int? Wisdom |                 public int? Wisdom | ||||||
|         { |                 { | ||||||
|             get |                     get | ||||||
|             { |                     { | ||||||
|                 return _Wisdom; |                         return _Wisdom; | ||||||
|             } |                     } | ||||||
|             set |                     set | ||||||
|             { |                     { | ||||||
|                 SetProperty(ref _Wisdom, value); |                         SetProperty(ref _Wisdom, value); | ||||||
|             } |                     } | ||||||
|         } |                 } | ||||||
| 
 | 
 | ||||||
|         private int? _Charisma = null; |                 private int? _Charisma = null; | ||||||
|         public int? Charisma |                 public int? Charisma | ||||||
|         { |                 { | ||||||
|             get |                     get | ||||||
|             { |                     { | ||||||
|                 return _Charisma; |                         return _Charisma; | ||||||
|             } |                     } | ||||||
|             set |                     set | ||||||
|             { |                     { | ||||||
|                 SetProperty(ref _Charisma, value); |                         SetProperty(ref _Charisma, value); | ||||||
|             } |                     } | ||||||
|         } |                 } | ||||||
|         */ |                 */ | ||||||
|         public ICommand RollDicesMRickCommand |         public ICommand RollDicesMRickCommand | ||||||
|         { |         { | ||||||
|             get |             get | ||||||
|  | @ -1072,7 +1076,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|         { |         { | ||||||
|             if (resources != null) |             if (resources != null) | ||||||
|             { |             { | ||||||
|                 foreach(DictionaryEntry res in resources) |                 foreach (DictionaryEntry res in resources) | ||||||
|                 { |                 { | ||||||
|                     Debug.WriteLine(res.Key); |                     Debug.WriteLine(res.Key); | ||||||
|                 } |                 } | ||||||
|  | @ -1147,7 +1151,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|                 processResource(set, resources); |                 processResource(set, resources); | ||||||
|             } |             } | ||||||
|             return set; |             return set; | ||||||
|             } |         } | ||||||
| 
 | 
 | ||||||
|         public static void processResource(Dictionary<String, PRIndirectReference> set, PdfDictionary resource) |         public static void processResource(Dictionary<String, PRIndirectReference> set, PdfDictionary resource) | ||||||
|         { |         { | ||||||
|  | @ -1198,7 +1202,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             //cb.Rectangle(x, y, width, height); |             //cb.Rectangle(x, y, width, height); | ||||||
|             //cb.Stroke(); |             //cb.Stroke(); | ||||||
|             ColumnText ct = new ColumnText(cb); |             ColumnText ct = new ColumnText(cb); | ||||||
|             ct.SetSimpleColumn(x, y , x + width, y + height); |             ct.SetSimpleColumn(x, y, x + width, y + height); | ||||||
|             var p = new Paragraph(text, font); |             var p = new Paragraph(text, font); | ||||||
|             p.Alignment = alignment; |             p.Alignment = alignment; | ||||||
|             ct.AddElement(p); |             ct.AddElement(p); | ||||||
|  | @ -1468,7 +1472,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|         private List<int> Roll6x2d6plus6() |         private List<int> Roll6x2d6plus6() | ||||||
|         { |         { | ||||||
|             var dices = new List<int>(); |             var dices = new List<int>(); | ||||||
|             for(int i = 0; i < 6; i++) |             for (int i = 0; i < 6; i++) | ||||||
|             { |             { | ||||||
|                 dices.Add(Roll2d6() + 6); |                 dices.Add(Roll2d6() + 6); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ | ||||||
|                 <Label Text="{Binding NotifySelectedBackground.Status, StringFormat='NotifySelectedBackground.Status = {0}'}" /> |                 <Label Text="{Binding NotifySelectedBackground.Status, StringFormat='NotifySelectedBackground.Status = {0}'}" /> | ||||||
|                 <Label Text="{Binding NotifySelectedSubBackground.Status, StringFormat='NotifySelectedSubBackground.Status = {0}'}" />--> |                 <Label Text="{Binding NotifySelectedSubBackground.Status, StringFormat='NotifySelectedSubBackground.Status = {0}'}" />--> | ||||||
| 
 | 
 | ||||||
|                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds.Result}" SelectedItem="{Binding SelectedBackground, Mode=TwoWay}" /> |                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds}" SelectedItem="{Binding SelectedBackground, Mode=TwoWay}" /> | ||||||
|                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedSubBackground, Mode=TwoWay}" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" /> |                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedSubBackground, Mode=TwoWay}" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" /> | ||||||
| 
 | 
 | ||||||
|                 <!-- test --> |                 <!-- test --> | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ | ||||||
|     <ContentView.Content> |     <ContentView.Content> | ||||||
|         <ScrollView Grid.ColumnSpan="2" Orientation="Vertical"> |         <ScrollView Grid.ColumnSpan="2" Orientation="Vertical"> | ||||||
|             <StackLayout> |             <StackLayout> | ||||||
|                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Classe" ItemsSource="{Binding Classes.Result}" SelectedItem="{Binding SelectedPlayerCharacter.Class, Mode=TwoWay}" /> |                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Classe" ItemsSource="{Binding Classes}" SelectedItem="{Binding SelectedPlayerCharacter.Class, Mode=TwoWay}" /> | ||||||
|                 <!--<Picker Title="Classe" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Classes.IsSuccessfullyCompleted}" ItemsSource="{Binding Classes.Result}" ItemDisplayBinding="{Binding Name}"  SelectedIndex="{Binding ClassSelectedIndex, Mode=TwoWay}" />--> |                 <!--<Picker Title="Classe" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Classes.IsSuccessfullyCompleted}" ItemsSource="{Binding Classes.Result}" ItemDisplayBinding="{Binding Name}"  SelectedIndex="{Binding ClassSelectedIndex, Mode=TwoWay}" />--> | ||||||
| 
 | 
 | ||||||
|                 <Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Class, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" > |                 <Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Class, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" > | ||||||
|  |  | ||||||
|  | @ -52,9 +52,6 @@ | ||||||
|             <tools:NullToFalseConverter x:Key="NullToFalseConverter" /> |             <tools:NullToFalseConverter x:Key="NullToFalseConverter" /> | ||||||
|         </ResourceDictionary> |         </ResourceDictionary> | ||||||
|     </CarouselPage.Resources> |     </CarouselPage.Resources> | ||||||
|     <!--<CarouselPage.ToolbarItems> |  | ||||||
|         <ToolbarItem Text="Ouvrir en PDF avec..." Command="{Binding GenerateAndOpenPdfCommand}" Order="Secondary" /> |  | ||||||
|     </CarouselPage.ToolbarItems>--> |  | ||||||
|     <ContentPage x:Name="Race" Title="Race"> |     <ContentPage x:Name="Race" Title="Race"> | ||||||
|         <Grid> |         <Grid> | ||||||
|             <Grid.ColumnDefinitions> |             <Grid.ColumnDefinitions> | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ | ||||||
|     <ContentView.Content> |     <ContentView.Content> | ||||||
|         <ScrollView Grid.ColumnSpan="2" Orientation="Vertical"> |         <ScrollView Grid.ColumnSpan="2" Orientation="Vertical"> | ||||||
|             <StackLayout> |             <StackLayout> | ||||||
|                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Race" ItemsSource="{Binding Races.Result}" SelectedItem="{Binding SelectedPlayerCharacter.Race, Mode=TwoWay}" IsEnabled="{Binding Races.IsSuccessfullyCompleted}" /> |                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Race" ItemsSource="{Binding Races}" SelectedItem="{Binding SelectedPlayerCharacter.Race, Mode=TwoWay}" IsEnabled="{Binding Races, Converter={StaticResource NullToFalseConverter}}}" /> | ||||||
|                 <!--<Picker Title="Race" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Races.IsSuccessfullyCompleted}" ItemsSource="{Binding Races.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding RaceSelectedIndex, Mode=TwoWay}" />--> |                 <!--<Picker Title="Race" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Races.IsSuccessfullyCompleted}" ItemsSource="{Binding Races.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding RaceSelectedIndex, Mode=TwoWay}" />--> | ||||||
| 
 | 
 | ||||||
|                 <Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Race, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" > |                 <Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Race, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" > | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez