mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	Ajustements
This commit is contained in:
		
							parent
							
								
									6a144873ed
								
							
						
					
					
						commit
						b981bdd4bc
					
				
					 2 changed files with 16 additions and 9 deletions
				
			
		|  | @ -2,13 +2,19 @@ | |||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:skviews="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms" | ||||
|              xmlns:views="clr-namespace:AideDeJeu.Views" | ||||
|              x:Class="AideDeJeu.Views.DicesPage"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout> | ||||
|             <!--<Label Text="Welcome to Xamarin.Forms!" | ||||
|                 VerticalOptions="CenterAndExpand"  | ||||
|                 HorizontalOptions="CenterAndExpand" />--> | ||||
|             <StackLayout Orientation="Horizontal"> | ||||
|                 <views:StringPickerView BindingContext="{Binding}" Title="{Binding PreferedBackgroundSpecialties.Name}" Description="{Binding PreferedBackgroundSpecialties.Description}" ItemsSource="{Binding PreferedBackgroundSpecialties.BindableTable}" SelectedItem="{Binding BackgroundSpecialty, Mode=TwoWay}" /> | ||||
|                 <views:StringPickerView BindingContext="{Binding}" Title="{Binding PreferedBackgroundSpecialties.Name}" Description="{Binding PreferedBackgroundSpecialties.Description}" ItemsSource="{Binding PreferedBackgroundSpecialties.BindableTable}" SelectedItem="{Binding BackgroundSpecialty, Mode=TwoWay}" /> | ||||
|                 <views:StringPickerView BindingContext="{Binding}" Title="{Binding PreferedBackgroundSpecialties.Name}" Description="{Binding PreferedBackgroundSpecialties.Description}" ItemsSource="{Binding PreferedBackgroundSpecialties.BindableTable}" SelectedItem="{Binding BackgroundSpecialty, Mode=TwoWay}" /> | ||||
| 
 | ||||
|             </StackLayout> | ||||
|             <skviews:SKCanvasView Margin="15" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" PaintSurface="SKCanvasView_PaintSurface"> | ||||
|                  | ||||
|             </skviews:SKCanvasView> | ||||
|  |  | |||
|  | @ -33,14 +33,6 @@ namespace AideDeJeu.Views | |||
|             SKImageInfo info = args.Info; | ||||
|             SKSurface surface = args.Surface; | ||||
|             SKCanvas canvas = surface.Canvas; | ||||
|             SKPaint strokePaint = new SKPaint() | ||||
|             { | ||||
|                 Color = new SKColor(0x9B, 0x1C, 0x47), | ||||
|                 Style = SKPaintStyle.Stroke, | ||||
|                 StrokeWidth = 1, | ||||
|                 TextSize = 12, | ||||
|             }; | ||||
|             canvas.Clear(); | ||||
| 
 | ||||
|             float minx = diceRolls.Min(kv => kv.Value); | ||||
|             float miny = diceRolls.Min(kv => kv.Key); | ||||
|  | @ -48,12 +40,21 @@ namespace AideDeJeu.Views | |||
|             float maxy = diceRolls.Max(kv => kv.Key); | ||||
|             float sumx = diceRolls.Sum(kv => kv.Value); | ||||
|             float sizey = info.Height / (maxy - miny + 1); | ||||
| 
 | ||||
|             SKPaint strokePaint = new SKPaint() | ||||
|             { | ||||
|                 Color = new SKColor(0x9B, 0x1C, 0x47), | ||||
|                 Style = SKPaintStyle.Stroke, | ||||
|                 StrokeWidth = 1, | ||||
|                 TextSize = sizey * 0.8f, | ||||
|             }; | ||||
|             canvas.Clear(); | ||||
|             foreach (var diceRoll in diceRolls) | ||||
|             { | ||||
|                 float x = diceRoll.Value; | ||||
|                 float y = diceRoll.Key; | ||||
|                 canvas.DrawRect(new SKRect(0, ((y - miny) * sizey), x * info.Width / maxx, ((y - miny) * sizey) + sizey - 5), strokePaint); | ||||
|                 canvas.DrawText($"{y} => {x / sumx * 100}", 10, ((y - miny) * sizey) + 15, strokePaint); | ||||
|                 canvas.DrawText($"{y} => {x / sumx * 100:0.00}%", 10, ((y - miny) * sizey) + sizey * 0.8f, strokePaint); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez