|
|
@ -10,6 +10,7 @@ using System.Reflection;
|
|
|
|
using SkiaSharp.Views.Forms;
|
|
|
|
using SkiaSharp.Views.Forms;
|
|
|
|
using TouchTracking;
|
|
|
|
using TouchTracking;
|
|
|
|
using Xamarin.Essentials;
|
|
|
|
using Xamarin.Essentials;
|
|
|
|
|
|
|
|
using TheGameExtreme.model.card;
|
|
|
|
|
|
|
|
|
|
|
|
namespace TheGameExtreme.view
|
|
|
|
namespace TheGameExtreme.view
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -124,6 +125,15 @@ namespace TheGameExtreme.view
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case TouchActionType.Released:
|
|
|
|
case TouchActionType.Released:
|
|
|
|
|
|
|
|
if (textDictionary.ContainsKey(args.Id))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TouchManipulationBitmap bitmap = textDictionary[args.Id];
|
|
|
|
|
|
|
|
bitmap.ProcessTouchEvent(args.Id, args.Type, point, stackCollection);
|
|
|
|
|
|
|
|
canvasView.InvalidateSurface();
|
|
|
|
|
|
|
|
viewmodel.CurrentHand.RemoveAt((int)args.Id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case TouchActionType.Cancelled:
|
|
|
|
case TouchActionType.Cancelled:
|
|
|
|
if (textDictionary.ContainsKey(args.Id))
|
|
|
|
if (textDictionary.ContainsKey(args.Id))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -150,21 +160,29 @@ namespace TheGameExtreme.view
|
|
|
|
{
|
|
|
|
{
|
|
|
|
stackCollection.Clear();
|
|
|
|
stackCollection.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
SKPoint position = new SKPoint(150, (float)((DeviceDisplay.MainDisplayInfo.Height * 0.1) + (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.01));
|
|
|
|
SKPaint textPaint = new SKPaint();
|
|
|
|
|
|
|
|
float textWidth = textPaint.MeasureText("01");
|
|
|
|
|
|
|
|
float textSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth;
|
|
|
|
|
|
|
|
SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width * 0.05) - (textWidth * 0.5)), (float)((DeviceDisplay.MainDisplayInfo.Height * 0.1) + (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.01 + 2 * textSize));
|
|
|
|
|
|
|
|
textPaint.TextSize = textSize;
|
|
|
|
|
|
|
|
stackCollection.Add(new TouchManipulationBitmap(textPaint, 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Matrix = SKMatrix.MakeTranslation(position.X, position.Y),
|
|
|
|
|
|
|
|
InitialPoint = position
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SKPaint textPaint = new SKPaint();
|
|
|
|
textPaint = new SKPaint();
|
|
|
|
float textWidth = textPaint.MeasureText("1");
|
|
|
|
textPaint.TextSize = textSize;
|
|
|
|
textPaint.TextSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stackCollection.Add(new TouchManipulationBitmap(textPaint, "1")
|
|
|
|
position.X += (float)(DeviceDisplay.MainDisplayInfo.Width * 0.2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stackCollection.Add(new TouchManipulationBitmap(textPaint, 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Matrix = SKMatrix.MakeTranslation(position.X, position.Y + textPaint.TextSize),
|
|
|
|
Matrix = SKMatrix.MakeTranslation(position.X, position.Y),
|
|
|
|
InitialPoint = position
|
|
|
|
InitialPoint = position
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
position.X += textPaint.MeasureText("1") + (float)(DeviceDisplay.MainDisplayInfo.Width * 0.15);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -172,21 +190,24 @@ namespace TheGameExtreme.view
|
|
|
|
{
|
|
|
|
{
|
|
|
|
textCollection.Clear();
|
|
|
|
textCollection.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
SKPoint position = new SKPoint(100, (float)((DeviceDisplay.MainDisplayInfo.Height * 0.9) - (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.2));
|
|
|
|
SKPaint textPaint = new SKPaint();
|
|
|
|
|
|
|
|
float textWidth = textPaint.MeasureText("01");
|
|
|
|
|
|
|
|
float textSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth;
|
|
|
|
|
|
|
|
SKPoint position = new SKPoint((float)(DeviceDisplay.MainDisplayInfo.Width * 0.05), (float)((DeviceDisplay.MainDisplayInfo.Height * 0.9) - (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.2 - textSize));
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < viewmodel.CurrentHand.Count; i++)
|
|
|
|
for (int i = 0; i < viewmodel.CurrentHand.Count; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SKPaint textPaint = new SKPaint();
|
|
|
|
textPaint = new SKPaint();
|
|
|
|
float textWidth = textPaint.MeasureText(viewmodel.CurrentHand[i].Value.ToString());
|
|
|
|
textPaint.TextSize = textSize;
|
|
|
|
textPaint.TextSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth;
|
|
|
|
position.X -= (float)(textWidth * 0.5);
|
|
|
|
|
|
|
|
|
|
|
|
textCollection.Add(new TouchManipulationBitmap(textPaint, viewmodel.CurrentHand[i].Value.ToString())
|
|
|
|
textCollection.Add(new TouchManipulationBitmap(textPaint, viewmodel.CurrentHand[i].Value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Matrix = SKMatrix.MakeTranslation(position.X, position.Y - textPaint.TextSize),
|
|
|
|
Matrix = SKMatrix.MakeTranslation(position.X, position.Y),
|
|
|
|
InitialPoint = position
|
|
|
|
InitialPoint = position
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
position.X += textPaint.MeasureText(viewmodel.CurrentHand[i].Value.ToString()) + 50;
|
|
|
|
position.X += (float)((DeviceDisplay.MainDisplayInfo.Width * 0.9) / viewmodel.CurrentHand.Count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|