1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

Page démo dés ok

This commit is contained in:
Yan Maniez 2019-07-28 02:25:53 +02:00
parent 6378717fe3
commit 2e965f088f
2 changed files with 24 additions and 2 deletions

View file

@ -4,7 +4,9 @@
xmlns:skviews="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms"
xmlns:pickers="clr-namespace:AideDeJeu.Views.Pickers"
xmlns:urho="clr-namespace:Urho.Forms;assembly=UrhoSharp.Forms"
x:Class="AideDeJeu.Views.DicesPage" Appearing="ContentPage_Appearing">
x:Class="AideDeJeu.Views.DicesPage"
Appearing="ContentPage_Appearing"
Disappearing="ContentPage_Disappearing" Title="Dés" Visual="Material">
<ContentPage.Content>
<StackLayout>
<StackLayout Orientation="Horizontal">

View file

@ -9,6 +9,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Urho;
using Xamarin.Essentials;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Xaml;
@ -88,14 +89,33 @@ namespace AideDeJeu.Views
Charts charts = null;
private async void ContentPage_Appearing(object sender, EventArgs e)
{
//await HelloWorldUrhoSurface.Show<HelloWorld>(new Urho.ApplicationOptions(assetsFolder: null));
charts = await HelloWorldUrhoSurface.Show<Charts>(new Urho.ApplicationOptions(assetsFolder: null));
if (!Accelerometer.IsMonitoring)
{
Accelerometer.ShakeDetected += Accelerometer_ShakeDetected;
Accelerometer.Start(SensorSpeed.Game);
}
}
private void Accelerometer_ShakeDetected(object sender, EventArgs e)
{
charts.Bars.ForEach(b => b.SetValueWithAnimation((new Dice()).Roll("3d6", new RandomDieRoller()).Value));
}
private void Button_Clicked(object sender, EventArgs e)
{
charts.Bars.ForEach(b => b.SetValueWithAnimation((new Dice()).Roll("3d6", new RandomDieRoller()).Value));
}
private void ContentPage_Disappearing(object sender, EventArgs e)
{
if (Accelerometer.IsMonitoring)
{
Accelerometer.Stop();
Accelerometer.ShakeDetected -= Accelerometer_ShakeDetected;
}
}
}
public class HelloWorld : Urho.Application
{