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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -21,6 +22,19 @@ namespace AideDeJeu.ViewModels
|
|||
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>();
|
||||
public List<ClassItem> Classes
|
||||
{
|
||||
|
|
@ -33,6 +47,19 @@ namespace AideDeJeu.ViewModels
|
|||
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>();
|
||||
public List<BackgroundItem> Backgrounds
|
||||
{
|
||||
|
|
@ -45,15 +72,39 @@ namespace AideDeJeu.ViewModels
|
|||
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()
|
||||
{
|
||||
using (var context = await StoreViewModel.GetLibraryContextAsync())
|
||||
{
|
||||
Races = await context.Races.ToListAsync();
|
||||
Classes = await context.Classes.ToListAsync();
|
||||
Backgrounds = await context.Backgrounds.ToListAsync();
|
||||
Races = await context.Races.Where(r => r.GetType() == typeof(RaceItem)).OrderBy(r => r.Name).ToListAsync();
|
||||
Classes = await context.Classes.OrderBy(c => c.Name).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
|
||||
{
|
||||
public class PlayerCharacterViewModel
|
||||
public class PlayerCharacterViewModel : BaseViewModel
|
||||
{
|
||||
public RaceItem Race { get; set; }
|
||||
public ClassItem Class { get; set; }
|
||||
public BackgroundItem Background { get; set; }
|
||||
private RaceItem _Race = null;
|
||||
public RaceItem Race
|
||||
{
|
||||
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" ?>
|
||||
<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"
|
||||
x:Class="AideDeJeu.Views.PlayerCharacterEditorPage">
|
||||
<!--Pages can be added as references or inline-->
|
||||
<ContentPage Title="Race">
|
||||
<ListView ItemsSource="{Binding Races}">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextCell Text="{Binding Name}" />
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</ContentPage>
|
||||
<ContentPage Title="Classe">
|
||||
<ListView ItemsSource="{Binding Classes}">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextCell Text="{Binding Name}" />
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</ContentPage>
|
||||
<ContentPage Title="Historique">
|
||||
<ListView ItemsSource="{Binding Backgrounds}">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextCell Text="{Binding Name}" />
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</ContentPage>
|
||||
</TabbedPage>
|
||||
x:Class="AideDeJeu.Views.PlayerCharacterEditorPage"
|
||||
xmlns:tools="clr-namespace:AideDeJeu.Tools"
|
||||
xmlns:mdview="clr-namespace:Xam.Forms.Markdown"
|
||||
x:Name="This"
|
||||
>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" />
|
||||
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label Text="Race" />
|
||||
<Picker ItemsSource="{Binding Races}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding RaceSelectedIndex, Mode=TwoWay}">
|
||||
</Picker>
|
||||
<!--<mdview:MarkdownView
|
||||
Theme="{StaticResource MonsterMarkdownTheme}"
|
||||
Markdown="{Binding SelectedPlayerCharacter.Race.Markdown}"
|
||||
NavigateToLinkCommand="{Binding BindingContext.Main.Navigator.NavigateToLinkCommand, Source={x:Reference This}}"
|
||||
/>-->
|
||||
<Label Text="Classe" />
|
||||
<Picker ItemsSource="{Binding Classes}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding ClassSelectedIndex, Mode=TwoWay}">
|
||||
</Picker>
|
||||
<!--<mdview:MarkdownView
|
||||
Theme="{StaticResource MonsterMarkdownTheme}"
|
||||
Markdown="{Binding SelectedPlayerCharacter.Class.Markdown}"
|
||||
NavigateToLinkCommand="{Binding BindingContext.Main.Navigator.NavigateToLinkCommand, Source={x:Reference This}}"
|
||||
/>-->
|
||||
<Label Text="Historique" />
|
||||
<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
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class PlayerCharacterEditorPage : TabbedPage
|
||||
public partial class PlayerCharacterEditorPage : ContentPage
|
||||
{
|
||||
public PlayerCharacterEditorPage()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue