Fix Conflict

master
cldupland 6 years ago
commit 5d8aec3ade

@ -1,11 +1,11 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------

@ -1,44 +1,57 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TheGameExtreme {
using System;
using System.Reflection;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
/// <summary>
/// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
/// </summary>
// Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder
// à l'aide d'un outil, tel que ResGen ou Visual Studio.
// Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen
// avec l'option /str ou régénérez votre projet VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class AppRessource {
private static System.Resources.ResourceManager resourceMan;
private static global::System.Resources.ResourceManager resourceMan;
private static System.Globalization.CultureInfo resourceCulture;
private static global::System.Globalization.CultureInfo resourceCulture;
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal AppRessource() {
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static System.Resources.ResourceManager ResourceManager {
/// <summary>
/// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.Equals(null, resourceMan)) {
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("TheGameExtreme.AppRessource", typeof(AppRessource).Assembly);
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TheGameExtreme.AppRessource", typeof(AppRessource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static System.Globalization.CultureInfo Culture {
/// <summary>
/// Remplace la propriété CurrentUICulture du thread actuel pour toutes
/// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@ -47,66 +60,99 @@ namespace TheGameExtreme {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Pile ascendante.
/// </summary>
internal static string StrAcendingStack {
get {
return ResourceManager.GetString("StrAcendingStack", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à La pile choisie n&apos;existe pas!.
/// </summary>
internal static string StrCantGetStack {
get {
return ResourceManager.GetString("StrCantGetStack", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Vous n&apos;avez pas joué assez de carte! essaye encore.
/// </summary>
internal static string StrCardPlayedLessThanTwo {
get {
return ResourceManager.GetString("StrCardPlayedLessThanTwo", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Veuillez selectionner une carte à placer sur une pile.
/// </summary>
internal static string StrChooseCardToPlay {
get {
return ResourceManager.GetString("StrChooseCardToPlay", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Selectionner la pile sur laquelle vous souhaitez poser la carte.
/// </summary>
internal static string StrChooseStack {
get {
return ResourceManager.GetString("StrChooseStack", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Pile Descendante.
/// </summary>
internal static string StrDownStack {
get {
return ResourceManager.GetString("StrDownStack", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Le jeu est fini! Veuillez lancer une nouvelle partie!.
/// </summary>
internal static string StrEndOfGame {
get {
return ResourceManager.GetString("StrEndOfGame", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Fin de tour.
/// </summary>
internal static string StrEndTurn {
get {
return ResourceManager.GetString("StrEndTurn", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Le jeu est terminé! Désolé, vous avez perdu... Essayez encore!.
/// </summary>
internal static string StrLose {
get {
return ResourceManager.GetString("StrLose", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Le jeu est terminé! Désolé, vous avez perdu... Vous deviez jouer trois cartes à cause de l&apos;effet \&quot;Trois cartes joué\&quot; hors votre jeu ne permet pas d&apos;en jouer autant! Essayez encore!.
/// </summary>
internal static string StrLose3CardEffect {
get {
return ResourceManager.GetString("StrLose3CardEffect", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Le joueur n&apos;a plus de carte dans sa main.
/// </summary>
internal static string StrNoMoreCardOnHand {
get {
return ResourceManager.GetString("StrNoMoreCardOnHand", resourceCulture);
@ -114,17 +160,28 @@ namespace TheGameExtreme {
}
/// <summary>
/// Recherche une chaîne localisée semblable à -L&apos;objectif est de battre le jeu !
/// Recherche une chaîne localisée semblable à Veuillez choisir un nombre de joueur et leur(s) nom(s).
/// </summary>
internal static string StrPlayerSelection {
get {
return ResourceManager.GetString("StrPlayerSelection", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à -L&apos;objectif est de battre le jeu ! Seul ou à plusieurs !
///
///-99 cartes numérotés de 2 à 99.
///-98 cartes numérotés de 2 à 99.
///
///-4 piles sont à votre disposition, deux ascendantes et deux descendantes.
///
///-L&apos;objectif est de pourvoir poser toute les cartes de la pioches sur les différentes piles à votre disposition.
///
///-Si vous arrivé a vider toute la pioche et de poser tout les cartes sur les piles, vous gagné, sinon vous perdez.
///-Si vous arrivez à vider toute la pioche et de poser tout les cartes sur les piles, vous gagnez, sinon vous perdez.
///
///-Quelques suprise pourrait aussi vous surprendre..
///-Chaque joueur doit jouer au minimum deux cartes par tour.
///
///-Sur une pile ascendante, il est possible de [le reste de la chaîne a été tronqué]&quot;;.
/// </summary>
internal static string StrRules {
get {
@ -141,22 +198,22 @@ namespace TheGameExtreme {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Le jeu est terminé!\n Bravo vous avez gagné!.
/// </summary>
internal static string StrWin {
get {
return ResourceManager.GetString("StrWin", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à La carte ne rentre pas dans la pile sectionnée!.
/// </summary>
internal static string StrWrongStack {
get {
return ResourceManager.GetString("StrWrongStack", resourceCulture);
}
}
internal static string StrPlayerSelection {
get {
return ResourceManager.GetString("StrPlayerSelection", resourceCulture);
}
}
}
}

@ -156,17 +156,23 @@
<value>Le joueur n'a plus de carte dans sa main</value>
</data>
<data name="StrRules" xml:space="preserve">
<value>-L'objectif est de battre le jeu !
<value>-L'objectif est de battre le jeu ! Seul ou à plusieurs !
-99 cartes numérotés de 2 à 99.
-98 cartes numérotés de 2 à 99.
-4 piles sont à votre disposition, deux ascendantes et deux descendantes.
-L'objectif est de pourvoir poser toute les cartes de la pioches sur les différentes piles à votre disposition.
-Si vous arrivé a vider toute la pioche et de poser tout les cartes sur les piles, vous gagné, sinon vous perdez.
-Si vous arrivez à vider toute la pioche et de poser tout les cartes sur les piles, vous gagnez, sinon vous perdez.
-Quelques suprise pourrait aussi vous surprendre.</value>
-Chaque joueur doit jouer au minimum deux cartes par tour.
-Sur une pile ascendante, il est possible de reculer de 10 (ex : 73 est joué -&gt; possibilité de jouer au dessus de 73 ou bien 63).
-Sur une pile descendante, il est possible de reculer de 10 (ex : 73 est joué -&gt; possibilité de jouer en dessous de 73 ou bien 83).
-La cohésion et la stratégie seront deux amis important pour venir à bout de The Game.</value>
</data>
<data name="StrSkullEffect" xml:space="preserve">
<value>Désolé, vous n'avez pas recouvert la tête de mort... Réessayez ;)</value>

@ -6,6 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="4.6.0" />
<PackageReference Include="Xamarin.Forms" Version="4.3.0.947036" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="SkiaSharp.Views.Forms" Version="1.68.0" />

@ -5,7 +5,7 @@
<Color x:Key="BlackColor">black</Color>
<Color x:Key="WhiteColor">white</Color>
<Color x:Key="SkyBlueColor">SkyBlue</Color>
<Color x:Key="SkyBlueColor">SkyBlue</Color>
</ResourceDictionary>

@ -45,7 +45,7 @@ namespace TheGameExtreme.view
playersNames.Add(((Entry)NameList.Children[i]).Text);
if (string.IsNullOrWhiteSpace(playersNames[playersNames.Count - 1]))
{
DisplayAlert("Erreur Pseudo", "Veuillez remplir tous les pseudos", "OK");
await DisplayAlert("Erreur Pseudo", "Veuillez remplir tous les pseudos", "OK");
return;
}
}

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Xamarin.Forms;
@ -77,7 +77,7 @@ namespace TheGameExtreme.view
pseudo.SetBinding(Label.TextProperty, new Binding("Pseudo", source: viewmodel));
inflateHand();
InflateHand();
}
@ -101,6 +101,8 @@ namespace TheGameExtreme.view
foreach (TouchManipulationBitmap bitmap in bitmapCollection)
{
bitmap.Paint(canvas);
}
}
@ -162,6 +164,7 @@ namespace TheGameExtreme.view
{
Picker picker = (Picker)sender;
bitmap.TouchManager.Mode = (TouchManipulationMode)picker.SelectedItem;
}
}
@ -178,7 +181,7 @@ namespace TheGameExtreme.view
// inflateHand();
//}
private void inflateHand()
private void InflateHand()
{
//Hand.Children.Clear();
//for (int i = 0; i < viewmodel.CurrentHand.Count; i++)

@ -0,0 +1,343 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Xamarin.Forms;
using TheGameExtreme.model.@event;
using TheGameExtreme.viewmodel;
using SkiaSharp;
using System.IO;
using System.Reflection;
using SkiaSharp.Views.Forms;
using TouchTracking;
using Xamarin.Essentials;
namespace TheGameExtreme.view
{
// Learn more about making custom code visible in the Xamarin.Forms previewer
// by visiting https://aka.ms/xamarinforms-previewer
[DesignTimeVisible(false)]
public partial class MainPage : ContentPage
{
private bool isFirst = true;
private Main viewmodel;
private List<SKRect> stacks = new List<SKRect>();
Button button;
List<string> playersNames;
TouchManipulationBitmap bitmap;
List<TouchManipulationBitmap> bitmapCollection = new List<TouchManipulationBitmap>();
Dictionary<long, TouchManipulationBitmap> bitmapDictionary = new Dictionary<long, TouchManipulationBitmap>();
public MainPage(List<string> playersNames)
{
this.playersNames = playersNames;
InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
//Assembly assembly = GetType().GetTypeInfo().Assembly;
////string[] resourceIDs = assembly.GetManifestResourceNames();
//string resourceID = "TheGameExtreme.Media.thegame.jpg";
//SKPoint position = new SKPoint(100, (float)(DeviceDisplay.MainDisplayInfo.Height - 0.2 * DeviceDisplay.MainDisplayInfo.Height));
//for (int i = 0; i < 8; i++)
//{
// using (Stream stream = assembly.GetManifestResourceStream(resourceID))
// {
// SKBitmap bitmap = SKBitmap.Decode(stream).Resize(new SKImageInfo(225, 225), SKFilterQuality.High);
// bitmapCollection.Add(new TouchManipulationBitmap(bitmap)
// {
// Matrix = SKMatrix.MakeTranslation(position.X, position.Y - bitmap.Height),
// });
// position.X += bitmap.Width + 50;
// }
//}
//stacks.Add(checkbox0);
//stacks.Add(checkbox1);
//stacks.Add(checkbox2);
//stacks.Add(checkbox3);
//button.Text = "Retry";
//button.Clicked += retry;
viewmodel = new Main(playersNames);
//viewmodel.BindingChanged += OnBindingChanged;
//viewmodel.PlayerChanged += OnPlayerChanged;
viewmodel.AlertChanged += OnAlertChanged;
pseudo.SetBinding(Label.TextProperty, new Binding("Pseudo", source: viewmodel));
InflateHand();
}
private void OnAlertChanged(object sender, EventArgs args)
{
if (viewmodel.Alert != null)
{
DisplayAlert("", viewmodel.Alert, "OK");
viewmodel.Alert = null;
}
}
public void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args) // Faire plusieurs canvas
{
SKCanvas canvas = args.Surface.Canvas;
canvas.Clear();
foreach (TouchManipulationBitmap bitmap in bitmapCollection)
{
bitmap.Paint(canvas);
}
}
public void OnTouchEffectAction(object sender, TouchActionEventArgs args)
{
// Convert Xamarin.Forms point to pixels
TouchTrackingPoint pt = args.Location;
SKPoint point =
new SKPoint((float)(canvasView.CanvasSize.Width * pt.X / canvasView.Width),
(float)(canvasView.CanvasSize.Height * pt.Y / canvasView.Height));
switch (args.Type)
{
case TouchActionType.Pressed:
for (int i = bitmapCollection.Count - 1; i >= 0; i--)
{
TouchManipulationBitmap bitmap = bitmapCollection[i];
if (bitmap.HitTest(point))
{
// Move bitmap to end of collection
bitmapCollection.Remove(bitmap);
bitmapCollection.Add(bitmap);
// Do the touch processing
bitmapDictionary.Add(args.Id, bitmap);
bitmap.ProcessTouchEvent(args.Id, args.Type, point);
canvasView.InvalidateSurface();
break;
}
}
break;
case TouchActionType.Moved:
if (bitmapDictionary.ContainsKey(args.Id))
{
TouchManipulationBitmap bitmap = bitmapDictionary[args.Id];
bitmap.ProcessTouchEvent(args.Id, args.Type, point);
canvasView.InvalidateSurface();
}
break;
case TouchActionType.Released:
case TouchActionType.Cancelled:
if (bitmapDictionary.ContainsKey(args.Id))
{
TouchManipulationBitmap bitmap = bitmapDictionary[args.Id];
bitmap.ProcessTouchEvent(args.Id, args.Type, point);
bitmapDictionary.Remove(args.Id);
canvasView.InvalidateSurface();
}
break;
}
}
public void OnTouchModePickerSelectedIndexChanged(object sender, EventArgs args)
{
if (bitmap != null)
{
Picker picker = (Picker)sender;
bitmap.TouchManager.Mode = (TouchManipulationMode)picker.SelectedItem;
}
}
<<<<<<< HEAD
//private void OnPlayerChanged(object sender, PlayerChangedEventArgs args)
//{
// inflateHand();
//}
=======
private void OnPlayerChanged(object sender, PlayerChangedEventArgs args)
{
InflateHand();
}
>>>>>>> 63f000719bc49139482f85661607797f88afe093
private void InflateHand()
{
//Hand.Children.Clear();
//for (int i = 0; i < viewmodel.CurrentHand.Count; i++)
//{
// Button card = new Button();
// card.Text = viewmodel.CurrentHand[i].Value.ToString();
// card.Clicked += played;
// Hand.Children.Add(card);
//}
bitmapCollection.Clear();
Assembly assembly = GetType().GetTypeInfo().Assembly;
string resourceID = "TheGameExtreme.Media.thegame.jpg";
SKPoint position = new SKPoint(100, (float)(DeviceDisplay.MainDisplayInfo.Height - 0.2 * DeviceDisplay.MainDisplayInfo.Height));
for (int i = 0; i < viewmodel.CurrentHand.Count; i++)
{
using (Stream stream = assembly.GetManifestResourceStream(resourceID))
{
SKBitmap bitmap = SKBitmap.Decode(stream).Resize(new SKImageInfo(225, 225), SKFilterQuality.High);
bitmapCollection.Add(new TouchManipulationBitmap(bitmap)
{
Matrix = SKMatrix.MakeTranslation(position.X, position.Y - bitmap.Height),
});
position.X += bitmap.Width + 50;
}
}
}
private void OnBindingChanged(object sender, TopRangeChangedEventArgs args)
{
//switch (args.NumStackChanged)
//{
// case 0:
// pile0.Text = args.NewTopRangeCard.Value.ToString();
// break;
// case 1:
// pile1.Text = args.NewTopRangeCard.Value.ToString();
// break;
// case 2:
// pile2.Text = args.NewTopRangeCard.Value.ToString();
// break;
// case 3:
// pile3.Text = args.NewTopRangeCard.Value.ToString();
// break;
//}
//for (int i = 0; i < Hand.Children.Count; i++)
//{
// Button b = Hand.Children[i] as Button;
// if (String.Equals(b.Text,args.NewTopRangeCard.Value.ToString()))
// {
// Hand.Children.RemoveAt(i);
// break;
// }
//}
}
private void played(object sender, EventArgs args)
{
int numStack = 0;
bool hasFind = false;
stacks.ForEach(checkbox =>
{
//if (checkbox.IsChecked)
//{
// hasFind = true;
// if (viewmodel.played(numStack, Convert.ToInt32((sender as Button).Text)))
// {
// botPanel.Children.Add(button);
// }
//}
numStack += 1;
});
if (!hasFind)
{
viewmodel.Alert = "Aucune pile selectionné! Veuillez séléctionner une pile.";
return;
}
}
//private void radioButton(object sender, EventArgs args)
//{
// if (isFirst)
// {
// isFirst = false;
// stacks.ForEach(checkbox =>
// {
// if (!checkbox.Equals(sender))
// {
// checkbox.IsChecked = false;
// }
// });
// isFirst = true;
// }
//}
private void retry(object sender, EventArgs args)
{
viewmodel = new Main(playersNames);
viewmodel.BindingChanged += OnBindingChanged;
pseudo.SetBinding(Label.TextProperty, new Binding("Pseudo", source: viewmodel));
inflateHand();
//pile0.Text = "1";
//pile1.Text = "1";
//pile2.Text = "100";
//pile3.Text = "100";
gameOption.Children.Clear();
gameOption.Children.Add(button);
}
private void EndTurn(object sender, EventArgs args)
{
if (viewmodel.endTurn())
{
button = (Button)gameOption.Children[0];
gameOption.Children.Clear();
Button retryButton = new Button();
retryButton.Text = "Retry";
retryButton.Clicked += retry;
gameOption.Children.Add(retryButton);
}
else
{
inflateHand();
}
}
private async void PlayToHome(object sender, EventArgs args)
{
await Navigation.PopToRootAsync();
}
}
}

@ -1,6 +1,9 @@
using System;
using System.ComponentModel;
using TheGameExtreme.model.card;
using SkiaSharp;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace TheGameExtreme.viewmodel
{
@ -10,6 +13,7 @@ namespace TheGameExtreme.viewmodel
public event PropertyChangedEventHandler PropertyChanged;
public Card View { get; set; }
protected string image;
public string Image
{
get { return image; }
@ -20,6 +24,8 @@ namespace TheGameExtreme.viewmodel
}
}
protected int value;
private Image bmp;
public int Value {
get { return value; }
set
@ -33,11 +39,30 @@ namespace TheGameExtreme.viewmodel
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info));
}
public CardVM(Card view)
{
View = view;
Value = view.Value;
/*SKBitmap bit = new SKBitmap();
RectangleF rectangle = new RectangleF(50, 90, 90, 50);
Graphics g = Graphics.FromImage(bmp);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.DrawString("yourText", new Font("Tahoma", 8), Brushes.Black, rectangle);
g.Flush();*/
}
}
}

Loading…
Cancel
Save