1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 06:56:10 +00:00

Refonte Background suite

This commit is contained in:
Yan Maniez 2019-05-11 12:00:46 +02:00
parent 712d449f46
commit e8fe98b227
3 changed files with 96 additions and 93 deletions

View file

@ -8,10 +8,33 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
public class BackgroundViewModel : BaseViewModel
{
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;
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
{
@ -78,43 +101,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
set
{
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;
public SkillItem BackgroundSkill
{
@ -125,7 +113,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
set
{
SetProperty(ref _BackgroundSkill, value);
OnPropertyChanged(nameof(SelectedBackgroundSkill));
OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill));
}
}
private SkillItem _SubBackgroundSkill = null;
@ -138,10 +126,10 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
set
{
SetProperty(ref _SubBackgroundSkill, value);
OnPropertyChanged(nameof(SelectedBackgroundSkill));
OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill));
}
}
public SkillItem SelectedBackgroundSkill
public SkillItem BackgroundOrSubBackgroundSkill
{
get
{

View file

@ -60,8 +60,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
BackgroundSpecialties = null;
SubBackgroundSpecialties = null;
//BackgroundSpecialty = null;
BackgroundSkill = null;
SubBackgroundSkill = null;
SelectedPlayerCharacter.Background.BackgroundSkill = null;
SelectedPlayerCharacter.Background.SubBackgroundSkill = null;
}
private async void Background_PropertyChanged(object sender, PropertyChangedEventArgs e)
@ -72,6 +72,10 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
await LoadBackgroundAsync(SelectedPlayerCharacter.Background.Background);
//SubBackgrounds = await LoadSubBackgroundsAsync(SelectedPlayerCharacter.Background.Background);
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);
//BackgroundSpecialty = null;
//SubBackgroundSpecialties = null;
BackgroundSkill = await LoadSkillAsync(background);
SelectedPlayerCharacter.Background.BackgroundSkill = await LoadSkillAsync(background);
//SubBackgroundSkill = null;
ResetAlignments();
}
@ -429,13 +433,13 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
if (subbackground == null)
{
SubBackgroundSpecialties = null;
SubBackgroundSkill = null;
SelectedPlayerCharacter.Background.SubBackgroundSkill = null;
//SubBackgroundSpecialty = null;
}
else
{
SubBackgroundSpecialties = await LoadBackgroundsSpecialtiesAsync(subbackground);
SubBackgroundSkill = await LoadSkillAsync(subbackground);
SelectedPlayerCharacter.Background.SubBackgroundSkill = await LoadSkillAsync(subbackground);
}
return subbackground;
}
@ -622,41 +626,41 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
// }
//}
private SkillItem _BackgroundSkill = null;
public SkillItem BackgroundSkill
{
get
{
return _BackgroundSkill;
}
set
{
SetProperty(ref _BackgroundSkill, value);
OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill));
//OnPropertyChanged(nameof(HasBackgroundSkill));
}
}
private SkillItem _SubBackgroundSkill = null;
public SkillItem SubBackgroundSkill
{
get
{
return _SubBackgroundSkill;
}
set
{
SetProperty(ref _SubBackgroundSkill, value);
OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill));
//OnPropertyChanged(nameof(HasBackgroundSkill));
}
}
public SkillItem BackgroundOrSubBackgroundSkill
{
get
{
return _SubBackgroundSkill ?? _BackgroundSkill;
}
}
//private SkillItem _BackgroundSkill = null;
//public SkillItem BackgroundSkill
//{
// get
// {
// return _BackgroundSkill;
// }
// set
// {
// SetProperty(ref _BackgroundSkill, value);
// OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill));
// //OnPropertyChanged(nameof(HasBackgroundSkill));
// }
//}
//private SkillItem _SubBackgroundSkill = null;
//public SkillItem SubBackgroundSkill
//{
// get
// {
// return _SubBackgroundSkill;
// }
// set
// {
// SetProperty(ref _SubBackgroundSkill, value);
// OnPropertyChanged(nameof(BackgroundOrSubBackgroundSkill));
// //OnPropertyChanged(nameof(HasBackgroundSkill));
// }
//}
//public SkillItem BackgroundOrSubBackgroundSkill
//{
// get
// {
// return _SubBackgroundSkill ?? _BackgroundSkill;
// }
//}
//public bool HasBackgroundSkill
//{
// get

View file

@ -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="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 -->
<!--<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}" />
</StackLayout>
</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">
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding 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.Name, StringFormat='# {0}'}" />
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding SelectedPlayerCharacter.Background.BackgroundOrSubBackgroundSkill.Description}" />
</StackLayout>
</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>
</ScrollView>
</ContentView.Content>