mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-30 15:06:06 +00:00
Début refonte pc
This commit is contained in:
parent
c46212b76e
commit
020ed61657
5 changed files with 129 additions and 128 deletions
|
|
@ -26,44 +26,41 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
{
|
||||
get
|
||||
{
|
||||
return new Command(async() => await ExecuteResetPlayerCharacterCommandAsync());
|
||||
return new Command(async () => await ExecuteResetPlayerCharacterCommandAsync());
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ExecuteResetPlayerCharacterCommandAsync()
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
_Random = new Random(DateTime.Now.Millisecond);
|
||||
_Random = new Random(DateTime.Now.Millisecond);
|
||||
|
||||
SelectedPlayerCharacter = new PlayerCharacterViewModel() { Background = new BackgroundViewModel(), Abilities = new AbilitiesViewModel() };
|
||||
SelectedPlayerCharacter.PropertyChanged += SelectedPlayerCharacter_PropertyChanged;
|
||||
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()));
|
||||
ResetAlignments();
|
||||
Races = await Task.Run(async () => await LoadRacesAsync());
|
||||
Classes = await Task.Run(async () => await 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;
|
||||
});
|
||||
Backgrounds = await Task.Run(async () => await 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()
|
||||
|
|
@ -71,9 +68,9 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
ExecuteResetPlayerCharacterCommandAsync();
|
||||
}
|
||||
|
||||
private void SelectedPlayerCharacter_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
private async void SelectedPlayerCharacter_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
switch(e.PropertyName)
|
||||
switch (e.PropertyName)
|
||||
{
|
||||
case nameof(SelectedPlayerCharacter.Race):
|
||||
SelectedPlayerCharacter.Abilities.Unlisten();
|
||||
|
|
@ -107,6 +104,9 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
|
||||
SelectedPlayerCharacter.Abilities.Listen();
|
||||
break;
|
||||
case nameof(SelectedPlayerCharacter.Background):
|
||||
SubBackgrounds = await LoadSubBackgroundsAsync(SelectedPlayerCharacter.Background.Background);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
}
|
||||
set
|
||||
{
|
||||
if(_SelectedPlayerCharacter != null)
|
||||
if (_SelectedPlayerCharacter != null)
|
||||
{
|
||||
_SelectedPlayerCharacter.PropertyChanged -= _SelectedPlayerCharacter_PropertyChanged;
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
|
||||
private void _SelectedPlayerCharacter_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
if(string.IsNullOrEmpty(e.PropertyName) || e.PropertyName == "Race")
|
||||
if (string.IsNullOrEmpty(e.PropertyName) || e.PropertyName == "Race")
|
||||
{
|
||||
OnSelectedPlayerCharacterRaceChanged();
|
||||
}
|
||||
|
|
@ -228,7 +228,9 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
#endregion Alignment
|
||||
|
||||
#region Race
|
||||
public NotifyTaskCompletion<List<RaceViewModel>> Races { get; private set; }
|
||||
|
||||
private List<RaceViewModel> _Races = null;
|
||||
public List<RaceViewModel> Races { get { return _Races; } private set { SetProperty(ref _Races, value); } }
|
||||
|
||||
public async Task<List<RaceViewModel>> LoadRacesAsync()
|
||||
{
|
||||
|
|
@ -258,7 +260,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
#endregion Race
|
||||
|
||||
#region Class
|
||||
public NotifyTaskCompletion<List<ClassViewModel>> Classes { get; private set; }
|
||||
private List<ClassViewModel> _Classes = null;
|
||||
public List<ClassViewModel> Classes { get { return _Classes; } private set { SetProperty(ref _Classes, value); } }
|
||||
|
||||
public async Task<List<ClassViewModel>> LoadClassesAsync()
|
||||
{
|
||||
|
|
@ -270,7 +273,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
#endregion Class
|
||||
|
||||
#region Background
|
||||
public NotifyTaskCompletion<List<BackgroundItem>> Backgrounds { get; private set; }
|
||||
private List<BackgroundItem> _Backgrounds = null;
|
||||
public List<BackgroundItem> Backgrounds { get { return _Backgrounds; } private set { SetProperty(ref _Backgrounds, value); } }
|
||||
|
||||
//private int _BackgroundSelectedIndex = -1;
|
||||
//public int BackgroundSelectedIndex
|
||||
|
|
@ -858,84 +862,84 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
"2 (-4)", "3 (-4)", "4 (-3)", "5 (-3)", "6 (-2)", "7 (-2)", "8 (-1)", "9 (-1)", "10 (+0)", "11 (+0)", "12 (+1)", "13 (+1)", "14 (+2)", "15 (+2)", "16 (+3)", "17 (+3)", "18 (+4)", "19 (+4)", "20 (+5)", "21 (+5)"
|
||||
};
|
||||
|
||||
/* private int? _Strength = null;
|
||||
public int? Strength
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Strength;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Strength, value);
|
||||
}
|
||||
}
|
||||
/* private int? _Strength = null;
|
||||
public int? Strength
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Strength;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Strength, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int? _Dexterity = null;
|
||||
public int? Dexterity
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Dexterity;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Dexterity, value);
|
||||
}
|
||||
}
|
||||
private int? _Dexterity = null;
|
||||
public int? Dexterity
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Dexterity;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Dexterity, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int? _Constitution = null;
|
||||
public int? Constitution
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Constitution;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Constitution, value);
|
||||
}
|
||||
}
|
||||
private int? _Constitution = null;
|
||||
public int? Constitution
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Constitution;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Constitution, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int? _Intelligence = null;
|
||||
public int? Intelligence
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Intelligence;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Intelligence, value);
|
||||
}
|
||||
}
|
||||
private int? _Intelligence = null;
|
||||
public int? Intelligence
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Intelligence;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Intelligence, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int? _Wisdom = null;
|
||||
public int? Wisdom
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Wisdom;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Wisdom, value);
|
||||
}
|
||||
}
|
||||
private int? _Wisdom = null;
|
||||
public int? Wisdom
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Wisdom;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Wisdom, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int? _Charisma = null;
|
||||
public int? Charisma
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Charisma;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Charisma, value);
|
||||
}
|
||||
}
|
||||
*/
|
||||
private int? _Charisma = null;
|
||||
public int? Charisma
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Charisma;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _Charisma, value);
|
||||
}
|
||||
}
|
||||
*/
|
||||
public ICommand RollDicesMRickCommand
|
||||
{
|
||||
get
|
||||
|
|
@ -1072,7 +1076,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
{
|
||||
if (resources != null)
|
||||
{
|
||||
foreach(DictionaryEntry res in resources)
|
||||
foreach (DictionaryEntry res in resources)
|
||||
{
|
||||
Debug.WriteLine(res.Key);
|
||||
}
|
||||
|
|
@ -1147,7 +1151,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
processResource(set, resources);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
||||
public static void processResource(Dictionary<String, PRIndirectReference> set, PdfDictionary resource)
|
||||
{
|
||||
|
|
@ -1198,7 +1202,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
//cb.Rectangle(x, y, width, height);
|
||||
//cb.Stroke();
|
||||
ColumnText ct = new ColumnText(cb);
|
||||
ct.SetSimpleColumn(x, y , x + width, y + height);
|
||||
ct.SetSimpleColumn(x, y, x + width, y + height);
|
||||
var p = new Paragraph(text, font);
|
||||
p.Alignment = alignment;
|
||||
ct.AddElement(p);
|
||||
|
|
@ -1468,7 +1472,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
|
|||
private List<int> Roll6x2d6plus6()
|
||||
{
|
||||
var dices = new List<int>();
|
||||
for(int i = 0; i < 6; i++)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
dices.Add(Roll2d6() + 6);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<Label Text="{Binding NotifySelectedBackground.Status, StringFormat='NotifySelectedBackground.Status = {0}'}" />
|
||||
<Label Text="{Binding NotifySelectedSubBackground.Status, StringFormat='NotifySelectedSubBackground.Status = {0}'}" />-->
|
||||
|
||||
<pickers:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds.Result}" SelectedItem="{Binding SelectedBackground, Mode=TwoWay}" />
|
||||
<pickers:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds}" SelectedItem="{Binding SelectedBackground, Mode=TwoWay}" />
|
||||
<pickers:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedSubBackground, Mode=TwoWay}" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" />
|
||||
|
||||
<!-- test -->
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<ContentView.Content>
|
||||
<ScrollView Grid.ColumnSpan="2" Orientation="Vertical">
|
||||
<StackLayout>
|
||||
<pickers:ItemPickerView BindingContext="{Binding}" Title="Classe" ItemsSource="{Binding Classes.Result}" SelectedItem="{Binding SelectedPlayerCharacter.Class, Mode=TwoWay}" />
|
||||
<pickers:ItemPickerView BindingContext="{Binding}" Title="Classe" ItemsSource="{Binding Classes}" SelectedItem="{Binding SelectedPlayerCharacter.Class, Mode=TwoWay}" />
|
||||
<!--<Picker Title="Classe" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Classes.IsSuccessfullyCompleted}" ItemsSource="{Binding Classes.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding ClassSelectedIndex, Mode=TwoWay}" />-->
|
||||
|
||||
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Class, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" >
|
||||
|
|
|
|||
|
|
@ -52,9 +52,6 @@
|
|||
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
|
||||
</ResourceDictionary>
|
||||
</CarouselPage.Resources>
|
||||
<!--<CarouselPage.ToolbarItems>
|
||||
<ToolbarItem Text="Ouvrir en PDF avec..." Command="{Binding GenerateAndOpenPdfCommand}" Order="Secondary" />
|
||||
</CarouselPage.ToolbarItems>-->
|
||||
<ContentPage x:Name="Race" Title="Race">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<ContentView.Content>
|
||||
<ScrollView Grid.ColumnSpan="2" Orientation="Vertical">
|
||||
<StackLayout>
|
||||
<pickers:ItemPickerView BindingContext="{Binding}" Title="Race" ItemsSource="{Binding Races.Result}" SelectedItem="{Binding SelectedPlayerCharacter.Race, Mode=TwoWay}" IsEnabled="{Binding Races.IsSuccessfullyCompleted}" />
|
||||
<pickers:ItemPickerView BindingContext="{Binding}" Title="Race" ItemsSource="{Binding Races}" SelectedItem="{Binding SelectedPlayerCharacter.Race, Mode=TwoWay}" IsEnabled="{Binding Races, Converter={StaticResource NullToFalseConverter}}}" />
|
||||
<!--<Picker Title="Race" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Races.IsSuccessfullyCompleted}" ItemsSource="{Binding Races.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding RaceSelectedIndex, Mode=TwoWay}" />-->
|
||||
|
||||
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Race, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" >
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue