mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 15:36:07 +00:00 
			
		
		
		
	Nouvelle ergo pc
This commit is contained in:
		
							parent
							
								
									d25de58c6d
								
							
						
					
					
						commit
						bd9a1535f0
					
				
					 4 changed files with 67 additions and 41 deletions
				
			
		|  | @ -1,5 +1,6 @@ | |||
| using AideDeJeu.ViewModels; | ||||
| using AideDeJeu.ViewModels.Library; | ||||
| using AideDeJeu.ViewModels.PlayerCharacter; | ||||
| using AideDeJeu.Views; | ||||
| using AideDeJeuLib; | ||||
| using System.Linq; | ||||
|  | @ -20,6 +21,7 @@ namespace AideDeJeu | |||
|             DependencyService.Register<MainViewModel>(); | ||||
|             DependencyService.Register<BookmarksViewModel>(); | ||||
|             DependencyService.Register<StoreViewModel>(); | ||||
|             DependencyService.Register<PlayerCharacterEditorViewModel>(); | ||||
|             var vm = DependencyService.Get<MainViewModel>(); | ||||
|             var titlered = (Color)Resources["HDRed"]; | ||||
|             var bgtan = (Color)Resources["HDWhite"]; | ||||
|  |  | |||
|  | @ -21,37 +21,54 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | |||
|     public class PlayerCharacterEditorViewModel : BaseViewModel | ||||
|     { | ||||
|         private Random _Random; | ||||
| 
 | ||||
|         public ICommand ResetPlayerCharacterCommand | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 return new Command(async() => await ExecuteResetPlayerCharacterCommandAsync()); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         private async Task ExecuteResetPlayerCharacterCommandAsync() | ||||
|         { | ||||
|             await Task.Run(() => | ||||
|             { | ||||
|                 _Random = new Random(DateTime.Now.Millisecond); | ||||
| 
 | ||||
|                 SelectedPlayerCharacter = new PlayerCharacterViewModel() { Background = new BackgroundViewModel(), Abilities = new AbilitiesViewModel() }; | ||||
|                 SelectedPlayerCharacter.PropertyChanged += SelectedPlayerCharacter_PropertyChanged; | ||||
| 
 | ||||
| 
 | ||||
|                 ResetAlignments(); | ||||
|                 Races = new NotifyTaskCompletion<List<RaceViewModel>>(Task.Run(() => LoadRacesAsync())); | ||||
|                 Classes = new NotifyTaskCompletion<List<ClassViewModel>>(Task.Run(() => LoadClassesAsync())); | ||||
| 
 | ||||
|                 Backgrounds = new NotifyTaskCompletion<List<BackgroundItem>>(Task.Run(() => LoadBackgroundsAsync())); | ||||
|                 SelectedBackground = null; | ||||
|                 //NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(null); | ||||
|                 SubBackgrounds = null; | ||||
|                 SelectedSubBackground = null; | ||||
|                 //NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(null); | ||||
|                 PersonalityTraits = null; | ||||
|                 PersonalityIdeals = null; | ||||
|                 PersonalityLinks = null; | ||||
|                 PersonalityDefects = null; | ||||
|                 SelectedPersonalityTrait = null; | ||||
|                 SelectedPersonalityIdeal = null; | ||||
|                 SelectedPersonalityLink = null; | ||||
|                 SelectedPersonalityDefect = null; | ||||
|                 BackgroundSpecialties = null; | ||||
|                 SubBackgroundSpecialties = null; | ||||
|                 BackgroundSpecialty = null; | ||||
|                 BackgroundSkill = null; | ||||
|                 SubBackgroundSkill = null; | ||||
|             }); | ||||
|         } | ||||
| 
 | ||||
|         public PlayerCharacterEditorViewModel() | ||||
|         { | ||||
|             _Random = new Random(DateTime.Now.Millisecond); | ||||
| 
 | ||||
|             SelectedPlayerCharacter = new PlayerCharacterViewModel() { Background = new BackgroundViewModel(), Abilities = new AbilitiesViewModel() }; | ||||
|             SelectedPlayerCharacter.PropertyChanged += SelectedPlayerCharacter_PropertyChanged; | ||||
| 
 | ||||
| 
 | ||||
|             ResetAlignments(); | ||||
|             Races = new NotifyTaskCompletion<List<RaceViewModel>>(Task.Run(() => LoadRacesAsync())); | ||||
|             Classes = new NotifyTaskCompletion<List<ClassViewModel>>(Task.Run(() => LoadClassesAsync())); | ||||
| 
 | ||||
|             Backgrounds = new NotifyTaskCompletion<List<BackgroundItem>>(Task.Run(() => LoadBackgroundsAsync())); | ||||
|             SelectedBackground = null; | ||||
|             //NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(null); | ||||
|             SubBackgrounds = null; | ||||
|             SelectedSubBackground = null; | ||||
|             //NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(null); | ||||
|             PersonalityTraits = null; | ||||
|             PersonalityIdeals = null; | ||||
|             PersonalityLinks = null; | ||||
|             PersonalityDefects = null; | ||||
|             SelectedPersonalityTrait = null; | ||||
|             SelectedPersonalityIdeal = null; | ||||
|             SelectedPersonalityLink = null; | ||||
|             SelectedPersonalityDefect = null; | ||||
|             BackgroundSpecialties = null; | ||||
|             SubBackgroundSpecialties = null; | ||||
|             BackgroundSpecialty = null; | ||||
|             BackgroundSkill = null; | ||||
|             SubBackgroundSkill = null; | ||||
|             ExecuteResetPlayerCharacterCommandAsync(); | ||||
|         } | ||||
| 
 | ||||
|         private void SelectedPlayerCharacter_PropertyChanged(object sender, PropertyChangedEventArgs e) | ||||
|  |  | |||
|  | @ -52,9 +52,9 @@ | |||
|             <tools:NullToFalseConverter x:Key="NullToFalseConverter" /> | ||||
|         </ResourceDictionary> | ||||
|     </CarouselPage.Resources> | ||||
|     <CarouselPage.ToolbarItems> | ||||
|     <!--<CarouselPage.ToolbarItems> | ||||
|         <ToolbarItem Text="Ouvrir en PDF avec..." Command="{Binding GenerateAndOpenPdfCommand}" Order="Secondary" /> | ||||
|     </CarouselPage.ToolbarItems> | ||||
|     </CarouselPage.ToolbarItems>--> | ||||
|     <ContentPage x:Name="Race" Title="Race"> | ||||
|         <Grid> | ||||
|             <Grid.ColumnDefinitions> | ||||
|  | @ -68,6 +68,7 @@ | |||
|              | ||||
|             <pcviews:RaceView Grid.ColumnSpan="2" BindingContext="{Binding}" /> | ||||
| 
 | ||||
|             <Button Grid.Column="0" Grid.Row="1" Text="Nouveau" Command="{Binding ResetPlayerCharacterCommand}"/> | ||||
|             <Button Grid.Column="1" Grid.Row="1" Text="Classe" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Class}"/> | ||||
|         </Grid> | ||||
|     </ContentPage> | ||||
|  | @ -170,6 +171,7 @@ | |||
|             <pcviews:ResumeView Grid.ColumnSpan="2" BindingContext="{Binding}" /> | ||||
| 
 | ||||
|             <Button Grid.Column="0" Grid.Row="1" Text="Finalisation" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Finalize}"/> | ||||
|             <Button Grid.Column="1" Grid.Row="1" Text="Ouvrir en PDF" Command="{Binding GenerateAndOpenPdfCommand}" /> | ||||
|         </Grid> | ||||
|     </ContentPage> | ||||
| </CarouselPage> | ||||
|  | @ -17,21 +17,26 @@ namespace AideDeJeu.Views.PlayerCharacter | |||
|     { | ||||
|         public PlayerCharacterEditorPage() | ||||
|         { | ||||
|             BindingContext = new PlayerCharacterEditorViewModel(); | ||||
|             //if(DependencyService.Get<PlayerCharacterEditorViewModel>() == null) | ||||
|             //{ | ||||
|             //    DependencyService.Register<PlayerCharacterEditorViewModel>(); | ||||
|             //} | ||||
| 
 | ||||
|             BindingContext = DependencyService.Get<PlayerCharacterEditorViewModel>(); // new PlayerCharacterEditorViewModel(); | ||||
| 
 | ||||
|             InitializeComponent(); | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         protected override bool OnBackButtonPressed() | ||||
|         { | ||||
|             Device.BeginInvokeOnMainThread(async () => { | ||||
|                 var result = await this.DisplayAlert("Attention", "Si vous revenez au menu, vous perdrez le personnage en cours de création", "Menu", "Annuler"); | ||||
|                 if (result) await this.Navigation.PopAsync(); | ||||
|             }); | ||||
|             return true; | ||||
|             //return base.OnBackButtonPressed(); | ||||
|         } | ||||
|         //protected override bool OnBackButtonPressed() | ||||
|         //{ | ||||
|         //    Device.BeginInvokeOnMainThread(async () => { | ||||
|         //        var result = await this.DisplayAlert("Attention", "Si vous revenez au menu, vous perdrez le personnage en cours de création", "Menu", "Annuler"); | ||||
|         //        if (result) await this.Navigation.PopAsync(); | ||||
|         //    }); | ||||
|         //    return true; | ||||
|         //    //return base.OnBackButtonPressed(); | ||||
|         //} | ||||
| 
 | ||||
|         public Command ChangePageCommand | ||||
|         { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez