mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-30 15:06:06 +00:00
Background preqsue ok
This commit is contained in:
parent
0544008b58
commit
505359c68c
2 changed files with 129 additions and 20 deletions
|
|
@ -23,12 +23,17 @@ namespace AideDeJeu.ViewModels
|
|||
SelectedBackground = null;
|
||||
NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(null);
|
||||
SubBackgrounds = null;
|
||||
SelectedSubBackground = new NotifyTaskCompletion<BackgroundItem>(null);
|
||||
SelectedSubBackground = null;
|
||||
NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(null);
|
||||
PersonalityTraits = null;
|
||||
PersonalityIdeals = null;
|
||||
PersonalityLinks = null;
|
||||
PersonalityDefects = null;
|
||||
BackgroundSpecialties = null;
|
||||
SubBackgroundSpecialties = null;
|
||||
BackgroundSpecialty = null;
|
||||
BackgroundSkill = null;
|
||||
SubBackgroundSkill = null;
|
||||
}
|
||||
|
||||
#region Selected PC
|
||||
|
|
@ -252,7 +257,7 @@ namespace AideDeJeu.ViewModels
|
|||
PersonalityLinks = await LoadPersonalityLinksAsync(background);
|
||||
PersonalityDefects = await LoadPersonalityDefectsAsync(background);
|
||||
BackgroundSpecialties = await LoadBackgroundsSpecialtiesAsync(background);
|
||||
await Task.Run(async () => SelectedPlayerCharacter.BackgroundSkill = await LoadSkillAsync(background));
|
||||
BackgroundSkill = await LoadSkillAsync(background);
|
||||
ResetAlignments();
|
||||
}
|
||||
return background;
|
||||
|
|
@ -285,30 +290,54 @@ namespace AideDeJeu.ViewModels
|
|||
{
|
||||
//SelectedPlayerCharacter.SubBackground = null;
|
||||
SubBackgroundSelectedIndex = -1;
|
||||
SelectedSubBackground = new NotifyTaskCompletion<BackgroundItem>(null);
|
||||
SelectedSubBackground = null;
|
||||
}
|
||||
else if (_SubBackgroundSelectedIndex > 0)
|
||||
{
|
||||
SelectedSubBackground = new NotifyTaskCompletion<BackgroundItem>(Task.Run(() => LoadSubBackgroundAsync(SubBackgrounds[_SubBackgroundSelectedIndex])));
|
||||
SelectedSubBackground = SubBackgrounds[_SubBackgroundSelectedIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public NotifyTaskCompletion<BackgroundItem> SelectedSubBackground { get; private set; }
|
||||
private SubBackgroundItem _SelectedSubBackground = null;
|
||||
public SubBackgroundItem SelectedSubBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SelectedSubBackground;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _SelectedSubBackground, value);
|
||||
NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(Task.Run(() => LoadSubBackgroundAsync(SelectedSubBackground)));
|
||||
}
|
||||
}
|
||||
private NotifyTaskCompletion<SubBackgroundItem> _NotifySelectedSubBackground = null;
|
||||
public NotifyTaskCompletion<SubBackgroundItem> NotifySelectedSubBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NotifySelectedSubBackground;
|
||||
}
|
||||
private set
|
||||
{
|
||||
SetProperty(ref _NotifySelectedSubBackground, value);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<BackgroundItem> LoadSubBackgroundAsync(SubBackgroundItem subbackground)
|
||||
private async Task<SubBackgroundItem> LoadSubBackgroundAsync(SubBackgroundItem subbackground)
|
||||
{
|
||||
SelectedPlayerCharacter.SubBackground = subbackground;
|
||||
if (subbackground == null)
|
||||
{
|
||||
SubBackgroundSpecialties = null;
|
||||
SelectedPlayerCharacter.SubBackgroundSkill = null;
|
||||
SelectedPlayerCharacter.SubBackgroundSpecialty = null;
|
||||
SubBackgroundSkill = null;
|
||||
SubBackgroundSpecialty = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
SubBackgroundSpecialties = await LoadBackgroundsSpecialtiesAsync(subbackground);
|
||||
await Task.Run(async () => SelectedPlayerCharacter.SubBackgroundSkill = await LoadSkillAsync(subbackground));
|
||||
SubBackgroundSkill = await LoadSkillAsync(subbackground);
|
||||
}
|
||||
return subbackground;
|
||||
}
|
||||
|
|
@ -427,7 +456,8 @@ namespace AideDeJeu.ViewModels
|
|||
set
|
||||
{
|
||||
SetProperty(ref _BackgroundSpecialties, value);
|
||||
OnPropertyChanged(nameof(SelectedBackgroundSpecialties));
|
||||
OnPropertyChanged(nameof(PreferedBackgroundSpecialties));
|
||||
OnPropertyChanged(nameof(HasBackgroundSpecialties));
|
||||
}
|
||||
}
|
||||
private BackgroundSpecialtyItem _SubBackgroundSpecialties = null;
|
||||
|
|
@ -440,17 +470,94 @@ namespace AideDeJeu.ViewModels
|
|||
set
|
||||
{
|
||||
SetProperty(ref _SubBackgroundSpecialties, value);
|
||||
OnPropertyChanged(nameof(SelectedBackgroundSpecialties));
|
||||
OnPropertyChanged(nameof(PreferedBackgroundSpecialties));
|
||||
OnPropertyChanged(nameof(HasBackgroundSpecialties));
|
||||
}
|
||||
}
|
||||
public BackgroundSpecialtyItem SelectedBackgroundSpecialties
|
||||
public BackgroundSpecialtyItem PreferedBackgroundSpecialties
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SubBackgroundSpecialties ?? _BackgroundSpecialties;
|
||||
}
|
||||
}
|
||||
public bool HasBackgroundSpecialties
|
||||
{
|
||||
get
|
||||
{
|
||||
return PreferedBackgroundSpecialties != null;
|
||||
}
|
||||
}
|
||||
|
||||
private string _BackgroundSpecialty = null;
|
||||
public string BackgroundSpecialty
|
||||
{
|
||||
get
|
||||
{
|
||||
return _BackgroundSpecialty;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _BackgroundSpecialty, value);
|
||||
SelectedPlayerCharacter.BackgroundSpecialty = BackgroundSpecialty;
|
||||
}
|
||||
}
|
||||
private string _SubBackgroundSpecialty = null;
|
||||
public string SubBackgroundSpecialty
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SubBackgroundSpecialty;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _SubBackgroundSpecialty, value);
|
||||
SelectedPlayerCharacter.SubBackgroundSpecialty = SubBackgroundSpecialty;
|
||||
}
|
||||
}
|
||||
|
||||
private SkillItem _BackgroundSkill = null;
|
||||
public SkillItem BackgroundSkill
|
||||
{
|
||||
get
|
||||
{
|
||||
return _BackgroundSkill;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _BackgroundSkill, value);
|
||||
OnPropertyChanged(nameof(PreferedBackgroundSkill));
|
||||
OnPropertyChanged(nameof(HasBackgroundSkill));
|
||||
}
|
||||
}
|
||||
private SkillItem _SubBackgroundSkill = null;
|
||||
public SkillItem SubBackgroundSkill
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SubBackgroundSkill;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _SubBackgroundSkill, value);
|
||||
OnPropertyChanged(nameof(PreferedBackgroundSkill));
|
||||
OnPropertyChanged(nameof(HasBackgroundSkill));
|
||||
}
|
||||
}
|
||||
public SkillItem PreferedBackgroundSkill
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SubBackgroundSkill ?? _BackgroundSkill;
|
||||
}
|
||||
}
|
||||
public bool HasBackgroundSkill
|
||||
{
|
||||
get
|
||||
{
|
||||
return PreferedBackgroundSkill != null;
|
||||
}
|
||||
}
|
||||
public async Task<List<BackgroundItem>> LoadBackgroundsAsync()
|
||||
{
|
||||
using (var context = await StoreViewModel.GetLibraryContextAsync())
|
||||
|
|
|
|||
|
|
@ -50,22 +50,24 @@
|
|||
<ContentPage Title="Historique">
|
||||
<ScrollView Orientation="Vertical">
|
||||
<StackLayout>
|
||||
<views:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds.Result}" SelectedItem="{Binding SelectedBackground, Mode=TwoWay}" />
|
||||
<Label Text="{Binding NotifySelectedBackground.Status}" />
|
||||
|
||||
<!-- DEBUG -->
|
||||
<!--<Label Text="{Binding Backgrounds.Status, StringFormat='Backgrounds.Status = {0}'}" />
|
||||
<Label Text="{Binding NotifySelectedBackground.Status, StringFormat='NotifySelectedBackground.Status = {0}'}" />
|
||||
<Label Text="{Binding NotifySelectedSubBackground.Status, StringFormat='NotifySelectedSubBackground.Status = {0}'}" />-->
|
||||
|
||||
<views:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds.Result}" SelectedItem="{Binding SelectedBackground, Mode=TwoWay}" />
|
||||
<views:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedSubBackground, Mode=TwoWay}" />
|
||||
|
||||
<Frame BorderColor="Black" Padding="2">
|
||||
<Frame BorderColor="Black" Padding="2" IsVisible="{Binding HasBackgroundSkill}">
|
||||
<StackLayout Padding="0">
|
||||
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedBackgroundSkill.Name, StringFormat='# {0}'}" />
|
||||
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedBackgroundSkill.Description}" />
|
||||
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding PreferedBackgroundSkill.Name, StringFormat='# {0}'}" />
|
||||
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding PreferedBackgroundSkill.Description}" />
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
|
||||
<views:StringPickerView BindingContext="{Binding}" Title="{Binding SelectedBackgroundSpecialties.Name}" Description="{Binding SelectedBackgroundSpecialties.Description}" ItemsSource="{Binding SelectedBackgroundSpecialties.BindableTable}" SelectedItem="{Binding SelectedPlayerCharacter.PickedBackgroundSpecialty, Mode=TwoWay}" />
|
||||
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.PickedBackgroundSpecialty}" />
|
||||
<views:StringPickerView BindingContext="{Binding}" IsVisible="{Binding HasBackgroundSpecialties}" Title="{Binding PreferedBackgroundSpecialties.Name}" Description="{Binding PreferedBackgroundSpecialties.Description}" ItemsSource="{Binding PreferedBackgroundSpecialties.BindableTable}" SelectedItem="{Binding BackgroundSpecialty, Mode=TwoWay}" />
|
||||
|
||||
|
||||
<views:StringPickerView BindingContext="{Binding}" Title="Trait de personnalité" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}" ItemsSource="{Binding PersonalityTraits}" SelectedItem="{Binding SelectedPersonalityTrait, Mode=TwoWay}" />
|
||||
|
||||
<views:StringPickerView BindingContext="{Binding}" Title="Idéal" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}" ItemsSource="{Binding PersonalityIdeals}" SelectedItem="{Binding SelectedPersonalityIdeal, Mode=TwoWay}" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue