mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-12-17 15:50:25 +00:00
Abilities
This commit is contained in:
parent
80e6ebad44
commit
42f3fa0604
6 changed files with 361 additions and 44 deletions
|
|
@ -61,6 +61,40 @@ namespace AideDeJeu.Tools
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ComparerToValueConverter<C, T> : IValueConverter where C : IComparable
|
||||||
|
{
|
||||||
|
public T GreaterThan { get; set; }
|
||||||
|
public T EqualsTo { get; set; }
|
||||||
|
public T SmallerThan { get; set; }
|
||||||
|
public T Default { get; set; }
|
||||||
|
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var valueC = (C)value;
|
||||||
|
var compare = valueC.CompareTo(parameter);
|
||||||
|
if(EqualsTo != null && compare == 0)
|
||||||
|
{
|
||||||
|
return EqualsTo;
|
||||||
|
}
|
||||||
|
if (GreaterThan != null && compare > 0)
|
||||||
|
{
|
||||||
|
return GreaterThan;
|
||||||
|
}
|
||||||
|
if (SmallerThan != null && compare < 0)
|
||||||
|
{
|
||||||
|
return SmallerThan;
|
||||||
|
}
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IntComparerToBooleanConverter : ComparerToValueConverter<int, bool> { }
|
||||||
|
|
||||||
public class IntToValueConverter<T> : IValueConverter
|
public class IntToValueConverter<T> : IValueConverter
|
||||||
{
|
{
|
||||||
public T NullOrZeroValue { get; set; }
|
public T NullOrZeroValue { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,163 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
{
|
{
|
||||||
public class AbilitiesViewModel : BaseViewModel
|
public class AbilitiesViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
|
public AbilitiesViewModel()
|
||||||
|
{
|
||||||
|
Listen();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool _Listening = false;
|
||||||
|
public void Listen()
|
||||||
|
{
|
||||||
|
if (!_Listening)
|
||||||
|
{
|
||||||
|
_Listening = true;
|
||||||
|
Strength.PropertyChanged += Strength_PropertyChanged;
|
||||||
|
Dexterity.PropertyChanged += Dexterity_PropertyChanged;
|
||||||
|
Constitution.PropertyChanged += Constitution_PropertyChanged;
|
||||||
|
Intelligence.PropertyChanged += Intelligence_PropertyChanged;
|
||||||
|
Wisdom.PropertyChanged += Wisdom_PropertyChanged;
|
||||||
|
Charisma.PropertyChanged += Charisma_PropertyChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Unlisten()
|
||||||
|
{
|
||||||
|
if (_Listening)
|
||||||
|
{
|
||||||
|
_Listening = false;
|
||||||
|
Strength.PropertyChanged -= Strength_PropertyChanged;
|
||||||
|
Dexterity.PropertyChanged -= Dexterity_PropertyChanged;
|
||||||
|
Constitution.PropertyChanged -= Constitution_PropertyChanged;
|
||||||
|
Intelligence.PropertyChanged -= Intelligence_PropertyChanged;
|
||||||
|
Wisdom.PropertyChanged -= Wisdom_PropertyChanged;
|
||||||
|
Charisma.PropertyChanged -= Charisma_PropertyChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Charisma_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
CheckRacialDispatchedBonus(e.PropertyName, Charisma, () =>
|
||||||
|
{
|
||||||
|
var list = new LinkedList<AbilityViewModel>();
|
||||||
|
list.AddLast(Strength);
|
||||||
|
list.AddLast(Dexterity);
|
||||||
|
list.AddLast(Constitution);
|
||||||
|
list.AddLast(Intelligence);
|
||||||
|
list.AddLast(Wisdom);
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Wisdom_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
CheckRacialDispatchedBonus(e.PropertyName, Wisdom, () =>
|
||||||
|
{
|
||||||
|
var list = new LinkedList<AbilityViewModel>();
|
||||||
|
list.AddLast(Charisma);
|
||||||
|
list.AddLast(Strength);
|
||||||
|
list.AddLast(Dexterity);
|
||||||
|
list.AddLast(Constitution);
|
||||||
|
list.AddLast(Intelligence);
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Intelligence_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
CheckRacialDispatchedBonus(e.PropertyName, Intelligence, () =>
|
||||||
|
{
|
||||||
|
var list = new LinkedList<AbilityViewModel>();
|
||||||
|
list.AddLast(Wisdom);
|
||||||
|
list.AddLast(Charisma);
|
||||||
|
list.AddLast(Strength);
|
||||||
|
list.AddLast(Dexterity);
|
||||||
|
list.AddLast(Constitution);
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Constitution_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
CheckRacialDispatchedBonus(e.PropertyName, Constitution, () =>
|
||||||
|
{
|
||||||
|
var list = new LinkedList<AbilityViewModel>();
|
||||||
|
list.AddLast(Intelligence);
|
||||||
|
list.AddLast(Wisdom);
|
||||||
|
list.AddLast(Charisma);
|
||||||
|
list.AddLast(Strength);
|
||||||
|
list.AddLast(Dexterity);
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Dexterity_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
CheckRacialDispatchedBonus(e.PropertyName, Dexterity, () =>
|
||||||
|
{
|
||||||
|
var list = new LinkedList<AbilityViewModel>();
|
||||||
|
list.AddLast(Constitution);
|
||||||
|
list.AddLast(Intelligence);
|
||||||
|
list.AddLast(Wisdom);
|
||||||
|
list.AddLast(Charisma);
|
||||||
|
list.AddLast(Strength);
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Strength_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
CheckRacialDispatchedBonus(e.PropertyName, Strength, () =>
|
||||||
|
{
|
||||||
|
var list = new LinkedList<AbilityViewModel>();
|
||||||
|
list.AddLast(Dexterity);
|
||||||
|
list.AddLast(Constitution);
|
||||||
|
list.AddLast(Intelligence);
|
||||||
|
list.AddLast(Wisdom);
|
||||||
|
list.AddLast(Charisma);
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckRacialDispatchedBonus(string propertyName, AbilityViewModel ability, Func<LinkedList<AbilityViewModel>> funcList)
|
||||||
|
{
|
||||||
|
if (propertyName == nameof(AbilityViewModel.RacialDispatchedBonus))
|
||||||
|
{
|
||||||
|
if (ability.RacialDispatchedBonus > 0 && SumRacialDispatchedBonus > MaxRacialDispatchedBonus)
|
||||||
|
{
|
||||||
|
DecrementNext(funcList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DecrementNext(LinkedList<AbilityViewModel> list)
|
||||||
|
{
|
||||||
|
var ability = list.First;
|
||||||
|
while (ability != null)
|
||||||
|
{
|
||||||
|
if (ability.Value.RacialDispatchedBonus > 0)
|
||||||
|
{
|
||||||
|
ability.Value.RacialDispatchedBonus--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ability = ability.Next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int SumRacialDispatchedBonus
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return
|
||||||
|
Strength.RacialDispatchedBonus +
|
||||||
|
Dexterity.RacialDispatchedBonus +
|
||||||
|
Constitution.RacialDispatchedBonus +
|
||||||
|
Intelligence.RacialDispatchedBonus +
|
||||||
|
Wisdom.RacialDispatchedBonus +
|
||||||
|
Charisma.RacialDispatchedBonus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private AbilityViewModel _Strength = new AbilityViewModel();
|
private AbilityViewModel _Strength = new AbilityViewModel();
|
||||||
public AbilityViewModel Strength { get { return _Strength; } set { SetProperty(ref _Strength, value); } }
|
public AbilityViewModel Strength { get { return _Strength; } set { SetProperty(ref _Strength, value); } }
|
||||||
|
|
||||||
|
|
@ -23,6 +180,10 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
|
|
||||||
private AbilityViewModel _Charisma = new AbilityViewModel();
|
private AbilityViewModel _Charisma = new AbilityViewModel();
|
||||||
public AbilityViewModel Charisma { get { return _Charisma; } set { SetProperty(ref _Charisma, value); } }
|
public AbilityViewModel Charisma { get { return _Charisma; } set { SetProperty(ref _Charisma, value); } }
|
||||||
|
|
||||||
|
private int _MaxRacialDispatchedBonus = 0;
|
||||||
|
public int MaxRacialDispatchedBonus { get { return _MaxRacialDispatchedBonus; } set { SetProperty(ref _MaxRacialDispatchedBonus, value); OnPropertyChanged(nameof(HasRacialDispatchedBonus)); } }
|
||||||
|
public bool HasRacialDispatchedBonus { get { return _MaxRacialDispatchedBonus > 0; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AbilityViewModel : BaseViewModel
|
public class AbilityViewModel : BaseViewModel
|
||||||
|
|
@ -66,6 +227,26 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
OnPropertyChanged(nameof(ModString));
|
OnPropertyChanged(nameof(ModString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private int _MaxRacialDispatchedBonus = 0;
|
||||||
|
public int MaxRacialDispatchedBonus
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _MaxRacialDispatchedBonus;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _MaxRacialDispatchedBonus, value);
|
||||||
|
OnPropertyChanged(nameof(HasRacialDispatchedBonus));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool HasRacialDispatchedBonus
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _MaxRacialDispatchedBonus > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int? Value { get { return BaseValue != null ? BaseValue + RacialBonus + RacialDispatchedBonus : null; } }
|
public int? Value { get { return BaseValue != null ? BaseValue + RacialBonus + RacialDispatchedBonus : null; } }
|
||||||
public string ValueString { get { return Value != null ? Value.ToString() : null; } }
|
public string ValueString { get { return Value != null ? Value.ToString() : null; } }
|
||||||
|
|
|
||||||
|
|
@ -56,12 +56,36 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
switch(e.PropertyName)
|
switch(e.PropertyName)
|
||||||
{
|
{
|
||||||
case nameof(SelectedPlayerCharacter.Race):
|
case nameof(SelectedPlayerCharacter.Race):
|
||||||
SelectedPlayerCharacter.Abilities.Strength.RacialBonus = int.Parse(SelectedPlayerCharacter.Race.Race.StrengthBonus ?? "0");
|
SelectedPlayerCharacter.Abilities.Unlisten();
|
||||||
SelectedPlayerCharacter.Abilities.Dexterity.RacialBonus = int.Parse(SelectedPlayerCharacter.Race.Race.DexterityBonus ?? "0");
|
|
||||||
SelectedPlayerCharacter.Abilities.Constitution.RacialBonus = int.Parse(SelectedPlayerCharacter.Race.Race.ConstitutionBonus ?? "0");
|
SelectedPlayerCharacter.Abilities.MaxRacialDispatchedBonus = int.Parse(SelectedPlayerCharacter.Race.Race.DispatchedBonus ?? "0");
|
||||||
SelectedPlayerCharacter.Abilities.Intelligence.RacialBonus = int.Parse(SelectedPlayerCharacter.Race.Race.IntelligenceBonus ?? "0");
|
SelectedPlayerCharacter.Abilities.Strength.MaxRacialDispatchedBonus = int.Parse(SelectedPlayerCharacter.Race.Race.MaxDispatchedStrengthBonus ?? "0");
|
||||||
SelectedPlayerCharacter.Abilities.Wisdom.RacialBonus = int.Parse(SelectedPlayerCharacter.Race.Race.WisdomBonus ?? "0");
|
SelectedPlayerCharacter.Abilities.Dexterity.MaxRacialDispatchedBonus = int.Parse(SelectedPlayerCharacter.Race.Race.MaxDispatchedDexterityBonus ?? "0");
|
||||||
SelectedPlayerCharacter.Abilities.Charisma.RacialBonus = int.Parse(SelectedPlayerCharacter.Race.Race.CharismaBonus ?? "0");
|
SelectedPlayerCharacter.Abilities.Constitution.MaxRacialDispatchedBonus = int.Parse(SelectedPlayerCharacter.Race.Race.MaxDispatchedConstitutionBonus ?? "0");
|
||||||
|
SelectedPlayerCharacter.Abilities.Intelligence.MaxRacialDispatchedBonus = int.Parse(SelectedPlayerCharacter.Race.Race.MaxDispatchedIntelligenceBonus ?? "0");
|
||||||
|
SelectedPlayerCharacter.Abilities.Wisdom.MaxRacialDispatchedBonus = int.Parse(SelectedPlayerCharacter.Race.Race.MaxDispatchedWisdomBonus ?? "0");
|
||||||
|
SelectedPlayerCharacter.Abilities.Charisma.MaxRacialDispatchedBonus = int.Parse(SelectedPlayerCharacter.Race.Race.MaxDispatchedCharismaBonus ?? "0");
|
||||||
|
|
||||||
|
SelectedPlayerCharacter.Abilities.Strength.RacialBonus =
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.Race?.StrengthBonus ?? "0") +
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.SubRace?.StrengthBonus ?? "0");
|
||||||
|
SelectedPlayerCharacter.Abilities.Dexterity.RacialBonus =
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.Race?.DexterityBonus ?? "0") +
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.SubRace?.DexterityBonus ?? "0");
|
||||||
|
SelectedPlayerCharacter.Abilities.Constitution.RacialBonus =
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.Race?.ConstitutionBonus ?? "0") +
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.SubRace?.ConstitutionBonus ?? "0");
|
||||||
|
SelectedPlayerCharacter.Abilities.Intelligence.RacialBonus =
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.Race?.IntelligenceBonus ?? "0") +
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.SubRace?.IntelligenceBonus ?? "0");
|
||||||
|
SelectedPlayerCharacter.Abilities.Wisdom.RacialBonus =
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.Race?.WisdomBonus ?? "0") +
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.SubRace?.WisdomBonus ?? "0");
|
||||||
|
SelectedPlayerCharacter.Abilities.Charisma.RacialBonus =
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.Race?.CharismaBonus ?? "0") +
|
||||||
|
int.Parse(SelectedPlayerCharacter.Race.SubRace?.CharismaBonus ?? "0");
|
||||||
|
|
||||||
|
SelectedPlayerCharacter.Abilities.Listen();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -917,13 +941,14 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
||||||
maxs = null;
|
maxs = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SelectedPlayerCharacter.Abilities.Unlisten();
|
||||||
SelectedPlayerCharacter.Abilities.Strength.BaseValue = PickAbility(random, ref mins, ref maxs, "Force");
|
SelectedPlayerCharacter.Abilities.Strength.BaseValue = PickAbility(random, ref mins, ref maxs, "Force");
|
||||||
SelectedPlayerCharacter.Abilities.Dexterity.BaseValue = PickAbility(random, ref mins, ref maxs, "Dextérité");
|
SelectedPlayerCharacter.Abilities.Dexterity.BaseValue = PickAbility(random, ref mins, ref maxs, "Dextérité");
|
||||||
SelectedPlayerCharacter.Abilities.Constitution.BaseValue = PickAbility(random, ref mins, ref maxs, "Constitution");
|
SelectedPlayerCharacter.Abilities.Constitution.BaseValue = PickAbility(random, ref mins, ref maxs, "Constitution");
|
||||||
SelectedPlayerCharacter.Abilities.Intelligence.BaseValue = PickAbility(random, ref mins, ref maxs, "Intelligence");
|
SelectedPlayerCharacter.Abilities.Intelligence.BaseValue = PickAbility(random, ref mins, ref maxs, "Intelligence");
|
||||||
SelectedPlayerCharacter.Abilities.Wisdom.BaseValue = PickAbility(random, ref mins, ref maxs, "Sagesse");
|
SelectedPlayerCharacter.Abilities.Wisdom.BaseValue = PickAbility(random, ref mins, ref maxs, "Sagesse");
|
||||||
SelectedPlayerCharacter.Abilities.Charisma.BaseValue = PickAbility(random, ref mins, ref maxs, "Charisme");
|
SelectedPlayerCharacter.Abilities.Charisma.BaseValue = PickAbility(random, ref mins, ref maxs, "Charisme");
|
||||||
|
SelectedPlayerCharacter.Abilities.Listen();
|
||||||
|
|
||||||
//await GeneratePdfAsync();
|
//await GeneratePdfAsync();
|
||||||
//await OpenPdfAsync();
|
//await OpenPdfAsync();
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,24 @@
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" />
|
<tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" />
|
||||||
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
|
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
|
||||||
|
<tools:IntComparerToBooleanConverter
|
||||||
|
x:Key="GreaterToTrueConverter"
|
||||||
|
GreaterThan="True"
|
||||||
|
Default="False"
|
||||||
|
/>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentView.Resources>
|
</ContentView.Resources>
|
||||||
<ContentView.Content>
|
<ContentView.Content>
|
||||||
<StackLayout Orientation="Horizontal">
|
<Grid>
|
||||||
<Picker Title="{Binding Title, Source={x:Reference this}}" SelectedItem="{Binding Ability.BaseValue, Source={x:Reference this}, Mode=TwoWay}">
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="100" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Grid.Column="0" Text="{Binding Title, Source={x:Reference this}}" />
|
||||||
|
<Picker Grid.Column="1" SelectedItem="{Binding Ability.BaseValue, Source={x:Reference this}, Mode=TwoWay}">
|
||||||
<Picker.ItemsSource>
|
<Picker.ItemsSource>
|
||||||
<x:Array Type="{x:Type x:Int32}">
|
<x:Array Type="{x:Type x:Int32}">
|
||||||
<x:Int32>3</x:Int32>
|
<x:Int32>3</x:Int32>
|
||||||
|
|
@ -34,11 +47,55 @@
|
||||||
</x:Array>
|
</x:Array>
|
||||||
</Picker.ItemsSource>
|
</Picker.ItemsSource>
|
||||||
</Picker>
|
</Picker>
|
||||||
<Label Text="{Binding Ability.RacialBonus, Source={x:Reference this}, StringFormat='Bonus : {0}', FallbackValue=''}" />
|
<Label Grid.Column="2" Text="{Binding Ability.RacialBonus, Source={x:Reference this}, StringFormat='{}{0:+0;-#}', FallbackValue=''}">
|
||||||
<Label Text="{Binding Ability.DispatchedRacialBonus, Source={x:Reference this}, StringFormat='Bonus : {0}', FallbackValue=''}" />
|
<Label.IsVisible>
|
||||||
<Stepper Minimum="0" Maximum="1" Value="{Binding Ability.DispatchedRacialBonus, Source={x:Reference this}, Mode=TwoWay}" />
|
<Binding Source="{x:Reference this}" Path="Ability.RacialBonus">
|
||||||
<Label Text="{Binding Ability.Value, Source={x:Reference this}, StringFormat='Value : {0}', FallbackValue=''}" />
|
<Binding.Converter>
|
||||||
<Label Text="{Binding Ability.Mod, Source={x:Reference this}, StringFormat='Mod : {0}', FallbackValue=''}" />
|
<tools:IntComparerToBooleanConverter
|
||||||
</StackLayout>
|
GreaterThan="True"
|
||||||
|
Default="False"
|
||||||
|
/>
|
||||||
|
</Binding.Converter>
|
||||||
|
<Binding.ConverterParameter>
|
||||||
|
<x:Int32>0</x:Int32>
|
||||||
|
</Binding.ConverterParameter>
|
||||||
|
</Binding>
|
||||||
|
</Label.IsVisible>
|
||||||
|
</Label>
|
||||||
|
<Grid Grid.Column="2" IsVisible="{Binding Ability.HasRacialDispatchedBonus, Source={x:Reference this}}">
|
||||||
|
<Label Grid.Column="0" Text="{Binding Ability.RacialDispatchedBonus, Source={x:Reference this}, StringFormat='{}{0:+0;-#}', FallbackValue=''}">
|
||||||
|
<Label.IsVisible>
|
||||||
|
<Binding Source="{x:Reference this}" Path="Ability.RacialBonus">
|
||||||
|
<Binding.Converter>
|
||||||
|
<tools:IntComparerToBooleanConverter
|
||||||
|
EqualsTo="True"
|
||||||
|
Default="False"
|
||||||
|
/>
|
||||||
|
</Binding.Converter>
|
||||||
|
<Binding.ConverterParameter>
|
||||||
|
<x:Int32>0</x:Int32>
|
||||||
|
</Binding.ConverterParameter>
|
||||||
|
</Binding>
|
||||||
|
</Label.IsVisible>
|
||||||
|
</Label>
|
||||||
|
<Stepper Grid.Column="1" Minimum="0" Maximum="1" Value="{Binding Ability.RacialDispatchedBonus, Source={x:Reference this}, Mode=TwoWay}">
|
||||||
|
<Stepper.IsVisible>
|
||||||
|
<Binding Source="{x:Reference this}" Path="Ability.RacialBonus">
|
||||||
|
<Binding.Converter>
|
||||||
|
<tools:IntComparerToBooleanConverter
|
||||||
|
EqualsTo="True"
|
||||||
|
Default="False"
|
||||||
|
/>
|
||||||
|
</Binding.Converter>
|
||||||
|
<Binding.ConverterParameter>
|
||||||
|
<x:Int32>0</x:Int32>
|
||||||
|
</Binding.ConverterParameter>
|
||||||
|
</Binding>
|
||||||
|
</Stepper.IsVisible>
|
||||||
|
</Stepper>
|
||||||
|
</Grid>
|
||||||
|
<Label Grid.Column="3" Text="{Binding Ability.Value, Source={x:Reference this}, FallbackValue=''}" />
|
||||||
|
<Label Grid.Column="4" Text="{Binding Ability.Mod, Source={x:Reference this}, StringFormat='{}{0:+0;-#}', FallbackValue=''}" />
|
||||||
|
</Grid>
|
||||||
</ContentView.Content>
|
</ContentView.Content>
|
||||||
</ContentView>
|
</ContentView>
|
||||||
|
|
@ -39,26 +39,6 @@ namespace AideDeJeu.Views.Pickers
|
||||||
typeof(AbilityViewModel),
|
typeof(AbilityViewModel),
|
||||||
typeof(AbilityPickerView),
|
typeof(AbilityPickerView),
|
||||||
defaultValue: default(AbilityViewModel));
|
defaultValue: default(AbilityViewModel));
|
||||||
/*public int RacialBonus
|
|
||||||
{
|
|
||||||
get { return (int)GetValue(RacialBonusProperty); }
|
|
||||||
set { SetValue(RacialBonusProperty, value); }
|
|
||||||
}
|
|
||||||
public static readonly BindableProperty RacialBonusProperty = BindableProperty.Create(
|
|
||||||
nameof(RacialBonus),
|
|
||||||
typeof(int),
|
|
||||||
typeof(AbilityPickerView),
|
|
||||||
defaultValue: default(int));
|
|
||||||
public int DispatchedRacialBonus
|
|
||||||
{
|
|
||||||
get { return (int)GetValue(DispatchedRacialBonusProperty); }
|
|
||||||
set { SetValue(DispatchedRacialBonusProperty, value); }
|
|
||||||
}
|
|
||||||
public static readonly BindableProperty DispatchedRacialBonusProperty = BindableProperty.Create(
|
|
||||||
nameof(DispatchedRacialBonus),
|
|
||||||
typeof(int),
|
|
||||||
typeof(AbilityPickerView),
|
|
||||||
defaultValue: default(int));*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -206,20 +206,60 @@
|
||||||
<Frame BorderColor="Black" Padding="2" Margin="10">
|
<Frame BorderColor="Black" Padding="2" Margin="10">
|
||||||
<ImageButton Source="rolling_dice_cup.png" Command="{Binding RollDicesCommand}" />
|
<ImageButton Source="rolling_dice_cup.png" Command="{Binding RollDicesCommand}" />
|
||||||
</Frame>
|
</Frame>
|
||||||
<pickers:AbilityPickerView
|
<Frame BorderColor="Black" Padding="2" Margin="10">
|
||||||
BindingContext="{Binding}"
|
<StackLayout>
|
||||||
Title="Force"
|
<Grid>
|
||||||
Ability="{Binding SelectedPlayerCharacter.Abilities.Strength}"
|
<Grid.ColumnDefinitions>
|
||||||
/>
|
<ColumnDefinition Width="100" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
<pickers:StringPickerView BindingContext="{Binding}" Title="Force" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Strength.BaseValue, Mode=TwoWay}" />
|
<ColumnDefinition Width="80" />
|
||||||
<Stepper></Stepper>
|
<ColumnDefinition Width="80" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Grid.Column="1" Text="Base" />
|
||||||
|
<Label Grid.Column="2" Text="Bonus" />
|
||||||
|
<Label Grid.Column="3" Text="Valeur" />
|
||||||
|
<Label Grid.Column="4" Text="Mod" />
|
||||||
|
</Grid>
|
||||||
|
<pickers:AbilityPickerView
|
||||||
|
BindingContext="{Binding}"
|
||||||
|
Title="Force"
|
||||||
|
Ability="{Binding SelectedPlayerCharacter.Abilities.Strength}"
|
||||||
|
/>
|
||||||
|
<pickers:AbilityPickerView
|
||||||
|
BindingContext="{Binding}"
|
||||||
|
Title="Dextérité"
|
||||||
|
Ability="{Binding SelectedPlayerCharacter.Abilities.Dexterity}"
|
||||||
|
/>
|
||||||
|
<pickers:AbilityPickerView
|
||||||
|
BindingContext="{Binding}"
|
||||||
|
Title="Constitution"
|
||||||
|
Ability="{Binding SelectedPlayerCharacter.Abilities.Constitution}"
|
||||||
|
/>
|
||||||
|
<pickers:AbilityPickerView
|
||||||
|
BindingContext="{Binding}"
|
||||||
|
Title="Intelligence"
|
||||||
|
Ability="{Binding SelectedPlayerCharacter.Abilities.Intelligence}"
|
||||||
|
/>
|
||||||
|
<pickers:AbilityPickerView
|
||||||
|
BindingContext="{Binding}"
|
||||||
|
Title="Sagesse"
|
||||||
|
Ability="{Binding SelectedPlayerCharacter.Abilities.Wisdom}"
|
||||||
|
/>
|
||||||
|
<pickers:AbilityPickerView
|
||||||
|
BindingContext="{Binding}"
|
||||||
|
Title="Charisme"
|
||||||
|
Ability="{Binding SelectedPlayerCharacter.Abilities.Charisma}"
|
||||||
|
/>
|
||||||
|
</StackLayout>
|
||||||
|
</Frame>
|
||||||
|
|
||||||
|
<!--<pickers:StringPickerView BindingContext="{Binding}" Title="Force" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Strength.BaseValue, Mode=TwoWay}" />
|
||||||
<pickers:StringPickerView BindingContext="{Binding}" Title="Dextérité" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Dexterity.BaseValue, Mode=TwoWay}" />
|
<pickers:StringPickerView BindingContext="{Binding}" Title="Dextérité" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Dexterity.BaseValue, Mode=TwoWay}" />
|
||||||
<pickers:StringPickerView BindingContext="{Binding}" Title="Constitution" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Constitution.BaseValue, Mode=TwoWay}" />
|
<pickers:StringPickerView BindingContext="{Binding}" Title="Constitution" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Constitution.BaseValue, Mode=TwoWay}" />
|
||||||
<pickers:StringPickerView BindingContext="{Binding}" Title="Intelligence" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Intelligence.BaseValue, Mode=TwoWay}" />
|
<pickers:StringPickerView BindingContext="{Binding}" Title="Intelligence" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Intelligence.BaseValue, Mode=TwoWay}" />
|
||||||
<pickers:StringPickerView BindingContext="{Binding}" Title="Sagesse" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Wisdom.BaseValue, Mode=TwoWay}" />
|
<pickers:StringPickerView BindingContext="{Binding}" Title="Sagesse" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Wisdom.BaseValue, Mode=TwoWay}" />
|
||||||
<pickers:StringPickerView BindingContext="{Binding}" Title="Charisme" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Charisma.BaseValue, Mode=TwoWay}" />
|
<pickers:StringPickerView BindingContext="{Binding}" Title="Charisme" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Charisma.BaseValue, Mode=TwoWay}" />-->
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue