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

Suite picker ability

This commit is contained in:
Yan Maniez 2019-05-05 23:48:58 +02:00
parent 31874b007d
commit 9358f70e47
4 changed files with 96 additions and 0 deletions

View file

@ -155,6 +155,9 @@
<EmbeddedResource Update="Views\Library\MainTabbedPage.xaml"> <EmbeddedResource Update="Views\Library\MainTabbedPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="Views\Pickers\AbilityPickerView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Views\PlayerCharacter\PlayerCharacterEditorPage.xaml"> <EmbeddedResource Update="Views\PlayerCharacter\PlayerCharacterEditorPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:tools="clr-namespace:AideDeJeu.Tools"
x:Class="AideDeJeu.Views.Pickers.AbilityPickerView"
x:Name="this">
<ContentView.Resources>
<ResourceDictionary>
<tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" />
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
</ResourceDictionary>
</ContentView.Resources>
<ContentView.Content>
<StackLayout>
<Picker Title="{Binding Title, Source={x:Reference this}}" SelectedItem="{Binding Ability.BaseValue, Source={x:Reference this}, Mode=TwoWay}" />
<Label Text="{Binding Ability.RacialBonus, Source={x:Reference this}, StringFormat='Bonus : {0}', FallbackValue=''}" />
<Label Text="{Binding Ability.DispatchedRacialBonus, Source={x:Reference this}, StringFormat='Bonus : {0}', FallbackValue=''}" />
<Stepper Minimum="0" Maximum="1" Value="{Binding Ability.DispatchedRacialBonus, Source={x:Reference this}, Mode=TwoWay}" />
<Label Text="{Binding Ability.Value, Source={x:Reference this}, StringFormat='Value : {0}', FallbackValue=''}" />
<Label Text="{Binding Ability.Mod, Source={x:Reference this}, StringFormat='Mod : {0}', FallbackValue=''}" />
</StackLayout>
</ContentView.Content>
</ContentView>

View file

@ -0,0 +1,64 @@
using AideDeJeu.ViewModels.PlayerCharacter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AideDeJeu.Views.Pickers
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AbilityPickerView : ContentView
{
public AbilityPickerView()
{
InitializeComponent();
}
public string Title
{
get { return (string)GetValue(TitleProperty); }
set { SetValue(TitleProperty, value); }
}
public static readonly BindableProperty TitleProperty = BindableProperty.Create(
nameof(Title),
typeof(string),
typeof(ItemPickerView),
defaultValue: default(string));
public AbilityViewModel Ability
{
get { return (AbilityViewModel)GetValue(AbilityProperty); }
set { SetValue(AbilityProperty, value); }
}
public static readonly BindableProperty AbilityProperty = BindableProperty.Create(
nameof(Ability),
typeof(AbilityViewModel),
typeof(AbilityPickerView),
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));*/
}
}

View file

@ -206,6 +206,12 @@
<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
BindingContext="{Binding}"
Title="Force"
Ability="{Binding SelectedPlayerCharacter.Abilities.Strength}"
/>
<pickers:StringPickerView BindingContext="{Binding}" Title="Force" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Strength.BaseValue, Mode=TwoWay}" /> <pickers:StringPickerView BindingContext="{Binding}" Title="Force" ItemsSource="{Binding Abilities}" SelectedItem="{Binding SelectedPlayerCharacter.Abilities.Strength.BaseValue, Mode=TwoWay}" />
<Stepper></Stepper> <Stepper></Stepper>