mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-30 15:06:06 +00:00
Skills & Specialties
This commit is contained in:
parent
5438c66ebb
commit
8300ca861e
4 changed files with 173 additions and 40 deletions
|
|
@ -24,6 +24,7 @@ namespace AideDeJeu.ViewModels
|
|||
PersonalityIdeals = new NotifyTaskCompletion<List<string>>(null);
|
||||
PersonalityLinks = new NotifyTaskCompletion<List<string>>(null);
|
||||
PersonalityDefects = new NotifyTaskCompletion<List<string>>(null);
|
||||
BackgroundSpecialties = new NotifyTaskCompletion<List<string>>(null);
|
||||
}
|
||||
|
||||
#region Selected PC
|
||||
|
|
@ -42,32 +43,6 @@ namespace AideDeJeu.ViewModels
|
|||
#endregion Selected PC
|
||||
|
||||
#region Alignment
|
||||
/*private List<string> _AllAllignments = new List<string>()
|
||||
{
|
||||
"Loyal Bon (LB)",
|
||||
"Neutre Bon (NB)",
|
||||
"Chaotique Bon (CB)",
|
||||
"Loyal Neutre (LN)",
|
||||
"Neutre (N)",
|
||||
"Chaotique Neutre (CN)",
|
||||
"Loyal Mauvais (LM)",
|
||||
"Neutre Mauvais (NM)",
|
||||
"Chaotique Mauvais (CM)"
|
||||
};
|
||||
|
||||
private List<string> _Alignments = null;
|
||||
public List<string> Alignments
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Alignments;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Alignments, value);
|
||||
}
|
||||
}*/
|
||||
|
||||
private NotifyTaskCompletion<List<AlignmentItem>> _Alignments = null;
|
||||
public NotifyTaskCompletion<List<AlignmentItem>> Alignments
|
||||
{
|
||||
|
|
@ -206,20 +181,28 @@ namespace AideDeJeu.ViewModels
|
|||
{
|
||||
SetProperty(ref _BackgroundSelectedIndex, value);
|
||||
SelectedPlayerCharacter.Background = Backgrounds.Result[_BackgroundSelectedIndex];
|
||||
SubBackgrounds = new NotifyTaskCompletion<List<SubBackgroundItem>>(Task.Run(() => LoadSubBackgroundsAsync(SelectedPlayerCharacter.Background)));
|
||||
PersonalityTraits = new NotifyTaskCompletion<List<string>>(Task.Run(() => LoadPersonalityTraitsAsync(SelectedPlayerCharacter.Background)));
|
||||
PersonalityIdeals = new NotifyTaskCompletion<List<string>>(Task.Run(() => LoadPersonalityIdealsAsync(SelectedPlayerCharacter.Background)));
|
||||
PersonalityLinks = new NotifyTaskCompletion<List<string>>(Task.Run(() => LoadPersonalityLinksAsync(SelectedPlayerCharacter.Background)));
|
||||
PersonalityDefects = new NotifyTaskCompletion<List<string>>(Task.Run(() => LoadPersonalityDefectsAsync(SelectedPlayerCharacter.Background)));
|
||||
SelectedPlayerCharacter.SubBackground = null;
|
||||
SelectedPlayerCharacter.PersonalityTrait = null;
|
||||
SelectedPlayerCharacter.PersonalityIdeal = null;
|
||||
SelectedPlayerCharacter.PersonalityLink = null;
|
||||
SelectedPlayerCharacter.PersonalityDefect = null;
|
||||
ResetAlignments();
|
||||
SelectedBackgroundChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectedBackgroundChanged()
|
||||
{
|
||||
SubBackgrounds = new NotifyTaskCompletion<List<SubBackgroundItem>>(Task.Run(() => LoadSubBackgroundsAsync(SelectedPlayerCharacter.Background)));
|
||||
PersonalityTraits = new NotifyTaskCompletion<List<string>>(Task.Run(() => LoadPersonalityTraitsAsync(SelectedPlayerCharacter.Background)));
|
||||
PersonalityIdeals = new NotifyTaskCompletion<List<string>>(Task.Run(() => LoadPersonalityIdealsAsync(SelectedPlayerCharacter.Background)));
|
||||
PersonalityLinks = new NotifyTaskCompletion<List<string>>(Task.Run(() => LoadPersonalityLinksAsync(SelectedPlayerCharacter.Background)));
|
||||
PersonalityDefects = new NotifyTaskCompletion<List<string>>(Task.Run(() => LoadPersonalityDefectsAsync(SelectedPlayerCharacter.Background)));
|
||||
BackgroundSpecialties = new NotifyTaskCompletion<List<string>>(Task.Run(() => LoadBackgroundsSpecialtiesAsync(SelectedPlayerCharacter.Background)));
|
||||
Task.Run(async () => SelectedPlayerCharacter.BackgroundSkill = await LoadSkillAsync(SelectedPlayerCharacter.Background));
|
||||
SelectedPlayerCharacter.SubBackground = null;
|
||||
SelectedPlayerCharacter.PersonalityTrait = null;
|
||||
SelectedPlayerCharacter.PersonalityIdeal = null;
|
||||
SelectedPlayerCharacter.PersonalityLink = null;
|
||||
SelectedPlayerCharacter.PersonalityDefect = null;
|
||||
SelectedPlayerCharacter.BackgroundSpecialty = null;
|
||||
ResetAlignments();
|
||||
}
|
||||
|
||||
private NotifyTaskCompletion<List<SubBackgroundItem>> _SubBackgrounds = null;
|
||||
public NotifyTaskCompletion<List<SubBackgroundItem>> SubBackgrounds
|
||||
{
|
||||
|
|
@ -252,9 +235,16 @@ namespace AideDeJeu.ViewModels
|
|||
{
|
||||
SelectedPlayerCharacter.SubBackground = SubBackgrounds.Result[_SubBackgroundSelectedIndex];
|
||||
}
|
||||
SelectedSubBackgroundChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectedSubBackgroundChanged()
|
||||
{
|
||||
SubBackgroundSpecialties = new NotifyTaskCompletion<List<string>>(Task.Run(() => LoadBackgroundsSpecialtiesAsync(SelectedPlayerCharacter.SubBackground)));
|
||||
Task.Run(async () => SelectedPlayerCharacter.SubBackgroundSkill = await LoadSkillAsync(SelectedPlayerCharacter.SubBackground));
|
||||
}
|
||||
|
||||
private NotifyTaskCompletion<List<string>> _PersonalityTraits = null;
|
||||
public NotifyTaskCompletion<List<string>> PersonalityTraits
|
||||
{
|
||||
|
|
@ -303,6 +293,30 @@ namespace AideDeJeu.ViewModels
|
|||
SetProperty(ref _PersonalityDefects, value);
|
||||
}
|
||||
}
|
||||
private NotifyTaskCompletion<List<string>> _BackgroundSpecialties = null;
|
||||
public NotifyTaskCompletion<List<string>> BackgroundSpecialties
|
||||
{
|
||||
get
|
||||
{
|
||||
return _BackgroundSpecialties;
|
||||
}
|
||||
private set
|
||||
{
|
||||
SetProperty(ref _BackgroundSpecialties, value);
|
||||
}
|
||||
}
|
||||
private NotifyTaskCompletion<List<string>> _SubBackgroundSpecialties = null;
|
||||
public NotifyTaskCompletion<List<string>> SubBackgroundSpecialties
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SubBackgroundSpecialties;
|
||||
}
|
||||
private set
|
||||
{
|
||||
SetProperty(ref _SubBackgroundSpecialties, value);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<BackgroundItem>> LoadBackgroundsAsync()
|
||||
{
|
||||
|
|
@ -393,6 +407,40 @@ namespace AideDeJeu.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<string>> LoadBackgroundsSpecialtiesAsync(BackgroundItem background)
|
||||
{
|
||||
if (background != null)
|
||||
{
|
||||
using (var context = await StoreViewModel.GetLibraryContextAsync())
|
||||
{
|
||||
var list = await context.BackgroundSpecialties.Where(it => it.ParentLink == background.Id).ToListAsync().ConfigureAwait(false);
|
||||
var item = list.FirstOrDefault();
|
||||
return item == null ? null : ExtractSimpleTable(item.Table);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<SkillItem> LoadSkillAsync(BackgroundItem background)
|
||||
{
|
||||
if (background != null)
|
||||
{
|
||||
using (var context = await StoreViewModel.GetLibraryContextAsync())
|
||||
{
|
||||
var list = await context.Skills.Where(it => it.ParentLink == background.Id).ToListAsync().ConfigureAwait(false);
|
||||
var item = list.FirstOrDefault();
|
||||
return item;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<SubBackgroundItem>> LoadSubBackgroundsAsync(BackgroundItem background)
|
||||
{
|
||||
if (background != null)
|
||||
|
|
@ -410,6 +458,20 @@ namespace AideDeJeu.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public ICommand BackgroundSpecialtyPickerCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Command<List<string>>(async (strings) => SelectedPlayerCharacter.BackgroundSpecialty = await ExecuteStringPickerCommandAsync(strings));
|
||||
}
|
||||
}
|
||||
public ICommand SubBackgroundSpecialtyPickerCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Command<List<string>>(async (strings) => SelectedPlayerCharacter.SubBackgroundSpecialty = await ExecuteStringPickerCommandAsync(strings));
|
||||
}
|
||||
}
|
||||
public ICommand PersonalityTraitPickerCommand
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -115,5 +115,53 @@ namespace AideDeJeu.ViewModels
|
|||
SetProperty(ref _PersonalityDefect, value);
|
||||
}
|
||||
}
|
||||
private string _BackgroundSpecialty = null;
|
||||
public string BackgroundSpecialty
|
||||
{
|
||||
get
|
||||
{
|
||||
return _BackgroundSpecialty;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _BackgroundSpecialty, value);
|
||||
}
|
||||
}
|
||||
private string _SubBackgroundSpecialty = null;
|
||||
public string SubBackgroundSpecialty
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SubBackgroundSpecialty;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _SubBackgroundSpecialty, value);
|
||||
}
|
||||
}
|
||||
private SkillItem _BackgroundSkill = null;
|
||||
public SkillItem BackgroundSkill
|
||||
{
|
||||
get
|
||||
{
|
||||
return _BackgroundSkill;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _BackgroundSkill, value);
|
||||
}
|
||||
}
|
||||
private SkillItem _SubBackgroundSkill = null;
|
||||
public SkillItem SubBackgroundSkill
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SubBackgroundSkill;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _SubBackgroundSkill, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -564,6 +564,8 @@ namespace AideDeJeu.ViewModels
|
|||
public DbSet<PersonalityIdealItem> PersonalityIdeals { get; set; }
|
||||
public DbSet<PersonalityLinkItem> PersonalityLinks { get; set; }
|
||||
public DbSet<PersonalityDefectItem> PersonalityDefects { get; set; }
|
||||
public DbSet<SkillItem> Skills { get; set; }
|
||||
public DbSet<BackgroundSpecialtyItem> BackgroundSpecialties { get; set; }
|
||||
public DbSet<AlignmentItem> Alignments { get; set; }
|
||||
|
||||
public AideDeJeuContext(string dbPath)
|
||||
|
|
|
|||
|
|
@ -48,11 +48,31 @@
|
|||
<ScrollView Orientation="Vertical">
|
||||
<StackLayout>
|
||||
<Picker Title="Historique" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Backgrounds.IsSuccessfullyCompleted}" ItemsSource="{Binding Backgrounds.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding BackgroundSelectedIndex, Mode=TwoWay}" />
|
||||
<Picker Title="Variante" HorizontalOptions="FillAndExpand" IsEnabled="{Binding SubBackgrounds.IsSuccessfullyCompleted}" ItemsSource="{Binding SubBackgrounds.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding SubBackgroundSelectedIndex, Mode=TwoWay}" />
|
||||
|
||||
<mdview:MarkdownView Markdown="{Binding SelectedPlayerCharacter.Background.Description}" />
|
||||
|
||||
<mdview:MarkdownView HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.BackgroundSkill.Name}" />
|
||||
<mdview:MarkdownView HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.BackgroundSkill.Description}" />
|
||||
|
||||
<Button Visual="Material" IsVisible="{Binding BackgroundSpecialties.IsSuccessfullyCompleted}" Text="Spécialité" Command="{Binding BackgroundSpecialtyPickerCommand}" CommandParameter="{Binding BackgroundSpecialties.Result}" />
|
||||
<mdview:MarkdownView HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.BackgroundSpecialty}" />
|
||||
|
||||
|
||||
|
||||
|
||||
<Picker Title="Variante" HorizontalOptions="FillAndExpand" IsEnabled="{Binding SubBackgrounds.IsSuccessfullyCompleted}" ItemsSource="{Binding SubBackgrounds.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding SubBackgroundSelectedIndex, Mode=TwoWay}" />
|
||||
|
||||
<mdview:MarkdownView Markdown="{Binding SelectedPlayerCharacter.SubBackground.Description}" />
|
||||
|
||||
<mdview:MarkdownView HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.SubBackgroundSkill.Name}" />
|
||||
<mdview:MarkdownView HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.SubBackgroundSkill.Description}" />
|
||||
|
||||
<Button Visual="Material" IsVisible="{Binding SubBackgroundSpecialties.IsSuccessfullyCompleted}" Text="Spécialité" Command="{Binding SubBackgroundSpecialtyPickerCommand}" CommandParameter="{Binding SubBackgroundSpecialties.Result}" />
|
||||
<mdview:MarkdownView HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.SubBackgroundSpecialty}" />
|
||||
|
||||
|
||||
|
||||
|
||||
<Button Visual="Material" IsVisible="{Binding PersonalityTraits.IsSuccessfullyCompleted}" Text="Trait de personnalité" Command="{Binding PersonalityTraitPickerCommand}" CommandParameter="{Binding PersonalityTraits.Result}" />
|
||||
<mdview:MarkdownView IsVisible="{Binding PersonalityTraits.IsSuccessfullyCompleted}" HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.PersonalityTrait}" />
|
||||
|
||||
|
|
@ -65,8 +85,9 @@
|
|||
<Button Visual="Material" IsVisible="{Binding PersonalityDefects.IsSuccessfullyCompleted}" Text="Défaut" Command="{Binding PersonalityDefectPickerCommand}" CommandParameter="{Binding PersonalityDefects.Result}" />
|
||||
<mdview:MarkdownView IsVisible="{Binding PersonalityDefects.IsSuccessfullyCompleted}" HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.PersonalityDefect}" />
|
||||
|
||||
<mdview:MarkdownView Markdown="{Binding SelectedPlayerCharacter.Background.Markdown}" />
|
||||
<mdview:MarkdownView Markdown="{Binding SelectedPlayerCharacter.SubBackground.Markdown}" />
|
||||
|
||||
<!--<mdview:MarkdownView Markdown="{Binding SelectedPlayerCharacter.Background.Markdown}" />
|
||||
<mdview:MarkdownView Markdown="{Binding SelectedPlayerCharacter.SubBackground.Markdown}" />-->
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue