diff --git a/AideDeJeu/AideDeJeu/ViewModels/DiceRollerViewModel.cs b/AideDeJeu/AideDeJeu/ViewModels/DiceRollerViewModel.cs index 57c1e6d1..07552f04 100644 --- a/AideDeJeu/AideDeJeu/ViewModels/DiceRollerViewModel.cs +++ b/AideDeJeu/AideDeJeu/ViewModels/DiceRollerViewModel.cs @@ -14,6 +14,26 @@ namespace AideDeJeu.ViewModels _Random = new Random(Environment.TickCount); } + + private int _Quantity = 3; + public int Quantity + { + get + { + return _Quantity; + } + set + { + SetProperty(ref _Quantity, value); + } + } + public int _Type = 6; + public int Type { get { return _Type; } set { SetProperty(ref _Type, value); } } + public int _Mod = 0; + public int Mod { get { return _Mod; } set { SetProperty(ref _Mod, value); } } + + + public List RollMRick() { var dices = new List(); diff --git a/AideDeJeu/AideDeJeu/Views/DicesPage.xaml b/AideDeJeu/AideDeJeu/Views/DicesPage.xaml index 7d8a973f..7c7ae8b6 100644 --- a/AideDeJeu/AideDeJeu/Views/DicesPage.xaml +++ b/AideDeJeu/AideDeJeu/Views/DicesPage.xaml @@ -6,17 +6,65 @@ x:Class="AideDeJeu.Views.DicesPage"> - + + + + 6 + 5 + 4 + 3 + 2 + 1 + + + + + + + 20 + 12 + 10 + 8 + 6 + 4 + + + + + + + 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + -1 + -2 + -3 + -4 + -5 + -6 + -7 + -8 + -9 + -10 + + + + - - + + diff --git a/AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs b/AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs index 86c73d66..5735eba8 100644 --- a/AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs +++ b/AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs @@ -18,15 +18,24 @@ namespace AideDeJeu.Views public DicesPage() { InitializeComponent(); + var vm = new DiceRollerViewModel(); + vm.PropertyChanged += Vm_PropertyChanged; + BindingContext = vm; + } + + private void Vm_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + CanvasDices.InvalidateSurface(); } private void SKCanvasView_PaintSurface(object sender, SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs args) { + var vm = BindingContext as DiceRollerViewModel; var diceRoller = new DiceRollerViewModel(); - var diceRolls = diceRoller.DicesValues(6, 3); + var diceRolls = diceRoller.DicesValues(vm.Type, vm.Quantity); foreach (var diceRoll in diceRolls) { - Debug.WriteLine($"{diceRoll.Key} => {diceRoll.Value / 3}"); + Debug.WriteLine($"{diceRoll.Key} => {diceRoll.Value / vm.Quantity}"); }