mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-29 14:35:45 +00:00
TabbedPage => pas bonne idée
This commit is contained in:
parent
7d23cd2039
commit
f8daf71f27
5 changed files with 134 additions and 42 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
@ -21,6 +22,19 @@ namespace AideDeJeu.ViewModels
|
||||||
SetProperty(ref _Races, value);
|
SetProperty(ref _Races, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private int _RaceSelectedIndex = 0;
|
||||||
|
public int RaceSelectedIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _RaceSelectedIndex;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _RaceSelectedIndex, value);
|
||||||
|
SelectedPlayerCharacter.Race = Races[_RaceSelectedIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
private List<ClassItem> _Classes = new List<ClassItem>();
|
private List<ClassItem> _Classes = new List<ClassItem>();
|
||||||
public List<ClassItem> Classes
|
public List<ClassItem> Classes
|
||||||
{
|
{
|
||||||
|
|
@ -33,6 +47,19 @@ namespace AideDeJeu.ViewModels
|
||||||
SetProperty(ref _Classes, value);
|
SetProperty(ref _Classes, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private int _ClassSelectedIndex = 0;
|
||||||
|
public int ClassSelectedIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _ClassSelectedIndex;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _ClassSelectedIndex, value);
|
||||||
|
SelectedPlayerCharacter.Class = Classes[_ClassSelectedIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
private List<BackgroundItem> _Backgrounds = new List<BackgroundItem>();
|
private List<BackgroundItem> _Backgrounds = new List<BackgroundItem>();
|
||||||
public List<BackgroundItem> Backgrounds
|
public List<BackgroundItem> Backgrounds
|
||||||
{
|
{
|
||||||
|
|
@ -45,15 +72,39 @@ namespace AideDeJeu.ViewModels
|
||||||
SetProperty(ref _Backgrounds, value);
|
SetProperty(ref _Backgrounds, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public PlayerCharacterViewModel SelectedPlayerCharacter { get; set; }
|
private int _BackgroundSelectedIndex = 0;
|
||||||
|
public int BackgroundSelectedIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _BackgroundSelectedIndex;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _BackgroundSelectedIndex, value);
|
||||||
|
SelectedPlayerCharacter.Background = Backgrounds[_BackgroundSelectedIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private PlayerCharacterViewModel _SelectedPlayerCharacter = new PlayerCharacterViewModel();
|
||||||
|
public PlayerCharacterViewModel SelectedPlayerCharacter
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _SelectedPlayerCharacter;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _SelectedPlayerCharacter, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task InitAsync()
|
public async Task InitAsync()
|
||||||
{
|
{
|
||||||
using (var context = await StoreViewModel.GetLibraryContextAsync())
|
using (var context = await StoreViewModel.GetLibraryContextAsync())
|
||||||
{
|
{
|
||||||
Races = await context.Races.ToListAsync();
|
Races = await context.Races.Where(r => r.GetType() == typeof(RaceItem)).OrderBy(r => r.Name).ToListAsync();
|
||||||
Classes = await context.Classes.ToListAsync();
|
Classes = await context.Classes.OrderBy(c => c.Name).ToListAsync();
|
||||||
Backgrounds = await context.Backgrounds.ToListAsync();
|
Backgrounds = await context.Backgrounds.Where(b => b.GetType() == typeof(BackgroundItem)).OrderBy(b => b.Name).ToListAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,43 @@ using System.Text;
|
||||||
|
|
||||||
namespace AideDeJeu.ViewModels
|
namespace AideDeJeu.ViewModels
|
||||||
{
|
{
|
||||||
public class PlayerCharacterViewModel
|
public class PlayerCharacterViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
public RaceItem Race { get; set; }
|
private RaceItem _Race = null;
|
||||||
public ClassItem Class { get; set; }
|
public RaceItem Race
|
||||||
public BackgroundItem Background { get; set; }
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _Race;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _Race, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private ClassItem _Class = null;
|
||||||
|
public ClassItem Class
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _Class;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _Class, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private BackgroundItem _Background = null;
|
||||||
|
public BackgroundItem Background
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _Background;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _Background, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,41 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="AideDeJeu.Views.PlayerCharacterEditorPage">
|
x:Class="AideDeJeu.Views.PlayerCharacterEditorPage"
|
||||||
<!--Pages can be added as references or inline-->
|
xmlns:tools="clr-namespace:AideDeJeu.Tools"
|
||||||
<ContentPage Title="Race">
|
xmlns:mdview="clr-namespace:Xam.Forms.Markdown"
|
||||||
<ListView ItemsSource="{Binding Races}">
|
x:Name="This"
|
||||||
<ListView.ItemTemplate>
|
>
|
||||||
<DataTemplate>
|
<ContentPage.Resources>
|
||||||
<TextCell Text="{Binding Name}" />
|
<ResourceDictionary>
|
||||||
</DataTemplate>
|
<tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" />
|
||||||
</ListView.ItemTemplate>
|
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
|
||||||
</ListView>
|
</ResourceDictionary>
|
||||||
</ContentPage>
|
</ContentPage.Resources>
|
||||||
<ContentPage Title="Classe">
|
<StackLayout Orientation="Vertical">
|
||||||
<ListView ItemsSource="{Binding Classes}">
|
<Label Text="Race" />
|
||||||
<ListView.ItemTemplate>
|
<Picker ItemsSource="{Binding Races}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding RaceSelectedIndex, Mode=TwoWay}">
|
||||||
<DataTemplate>
|
</Picker>
|
||||||
<TextCell Text="{Binding Name}" />
|
<!--<mdview:MarkdownView
|
||||||
</DataTemplate>
|
Theme="{StaticResource MonsterMarkdownTheme}"
|
||||||
</ListView.ItemTemplate>
|
Markdown="{Binding SelectedPlayerCharacter.Race.Markdown}"
|
||||||
</ListView>
|
NavigateToLinkCommand="{Binding BindingContext.Main.Navigator.NavigateToLinkCommand, Source={x:Reference This}}"
|
||||||
</ContentPage>
|
/>-->
|
||||||
<ContentPage Title="Historique">
|
<Label Text="Classe" />
|
||||||
<ListView ItemsSource="{Binding Backgrounds}">
|
<Picker ItemsSource="{Binding Classes}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding ClassSelectedIndex, Mode=TwoWay}">
|
||||||
<ListView.ItemTemplate>
|
</Picker>
|
||||||
<DataTemplate>
|
<!--<mdview:MarkdownView
|
||||||
<TextCell Text="{Binding Name}" />
|
Theme="{StaticResource MonsterMarkdownTheme}"
|
||||||
</DataTemplate>
|
Markdown="{Binding SelectedPlayerCharacter.Class.Markdown}"
|
||||||
</ListView.ItemTemplate>
|
NavigateToLinkCommand="{Binding BindingContext.Main.Navigator.NavigateToLinkCommand, Source={x:Reference This}}"
|
||||||
</ListView>
|
/>-->
|
||||||
</ContentPage>
|
<Label Text="Historique" />
|
||||||
</TabbedPage>
|
<Picker ItemsSource="{Binding Backgrounds}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding BackgroundSelectedIndex, Mode=TwoWay}">
|
||||||
|
</Picker>
|
||||||
|
<!--<mdview:MarkdownView
|
||||||
|
Theme="{StaticResource MonsterMarkdownTheme}"
|
||||||
|
Markdown="{Binding SelectedPlayerCharacter.Background.Markdown}"
|
||||||
|
NavigateToLinkCommand="{Binding BindingContext.Main.Navigator.NavigateToLinkCommand, Source={x:Reference This}}"
|
||||||
|
/>-->
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
||||||
|
|
@ -11,7 +11,7 @@ using Xamarin.Forms.Xaml;
|
||||||
namespace AideDeJeu.Views
|
namespace AideDeJeu.Views
|
||||||
{
|
{
|
||||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||||
public partial class PlayerCharacterEditorPage : TabbedPage
|
public partial class PlayerCharacterEditorPage : ContentPage
|
||||||
{
|
{
|
||||||
public PlayerCharacterEditorPage()
|
public PlayerCharacterEditorPage()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
Votre parenté céleste vous a octroyé certains pouvoirs innés.
|
Votre parenté céleste vous a octroyé certains pouvoirs innés.
|
||||||
|
|
||||||
**Augmentation de caractéristiques.** Votre valeur de [Charisme] augmente de <!--CharismaBonus-->2<!--/CharismaBonus--> et votre valeur de [Sagesse] de <!--WisdomBonus-->1<!--/WisdomBonus---->.
|
**Augmentation de caractéristiques.** Votre valeur de [Charisme] augmente de <!--CharismaBonus-->2<!--/CharismaBonus--> et votre valeur de [Sagesse] de <!--WisdomBonus-->1<!--/WisdomBonus-->.
|
||||||
|
|
||||||
**Âge.** Les aasimars vieillissent à un rythme comparable à celui des humains. Leur espérance de vie est cependant supérieure, et ils peuvent dépasser les 120 ans.
|
**Âge.** Les aasimars vieillissent à un rythme comparable à celui des humains. Leur espérance de vie est cependant supérieure, et ils peuvent dépasser les 120 ans.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue