Drag and Drop fonctionnelle

master
cldupland 6 years ago
parent 31749dd382
commit 48b6039cb3

@ -10,7 +10,7 @@ namespace TheGameExtreme.model.gameActions.classic
{
protected List<GameAction> gameActions;
protected Piles piles;
public Piles Piles { get; protected set; }
public int NbCardAtBeginOfTurn { get; set; }
protected Deck deck;
protected int nbMaxCard;
@ -19,11 +19,11 @@ namespace TheGameExtreme.model.gameActions.classic
#region
public event EventHandler<TopRangeChangedEventArgs> TopRangeChanged;
public event EventHandler<EventArgs> EndGame;
public event EventHandler<PlayerChangedEventArgs> PlayerChanged;
protected internal void OnTopRangeChanged(TopRangeChangedEventArgs args)
protected internal void OnEndGame(EventArgs args)
{
TopRangeChanged?.Invoke(this, args);
EndGame?.Invoke(this, args);
}
protected internal void OnPlayerChanged(PlayerChangedEventArgs args)
{
@ -40,11 +40,11 @@ namespace TheGameExtreme.model.gameActions.classic
public void load(int nbPlayer, List<Player> players)
{
piles = new Piles();
Piles = new Piles();
gameActions.Add(new Piocher(piles));
gameActions.Add(new JouerUneCarte(piles));
gameActions.Add(new TerminerSonTour(piles));
gameActions.Add(new Piocher(Piles));
gameActions.Add(new JouerUneCarte(Piles));
gameActions.Add(new TerminerSonTour(Piles));
deck = new ClassicDeck();
defineNbMaxCard(nbPlayer);
@ -70,35 +70,66 @@ namespace TheGameExtreme.model.gameActions.classic
}
}
protected void quickSort(List<Card> ar, int start, int end)
{
if (start < end)
{
int pivot = ar[end].Value;
int pIndex = start;
int swap;
for (int i = start; i < end; i++)
{
if (ar[i].Value < pivot)
{
swap = ar[pIndex].Value;
ar[pIndex].Value = ar[i].Value;
ar[i].Value = swap;
pIndex++;
}
}
ar[end].Value = ar[pIndex].Value;
ar[pIndex].Value = pivot;
quickSort(ar, start, pIndex - 1);
quickSort(ar, pIndex + 1, end);
}
}
protected void distribueCard(List<Player> players)
{
for (int i = 0; i < nbMaxCard; i++)
players.ForEach(player =>
{
players.ForEach(player =>
for (int i = 0; i < nbMaxCard; i++)
{
int r = new Random().Next(0, deck.size() - 1);
player.pioche(deck.getCard(r));
deck.removeAt(r);
});
}
}
List<Card> cards = player.getCardList();
quickSort(cards, 0, cards.Count-1);
});
}
public void pioche(List<Card> currentHand, Player player)
{
Message = null;
((Piocher)gameActions[0]).pioche(currentHand, deck, player);
((Piocher)gameActions[0]).pioche(currentHand, deck, player, nbMaxCard);
quickSort(currentHand, 0, currentHand.Count - 1);
}
public void playCard(int valueCard, List<Card> currentHand, int orderedStackSelected, Player player, List<Card> CurrentCardPlayed)
public bool playCard(int valueCard, List<Card> currentHand, int orderedStackSelected, Player player, List<Card> CurrentCardPlayed)
{
Message = null;
if (((JouerUneCarte)gameActions[1]).play(valueCard, currentHand, orderedStackSelected, player, CurrentCardPlayed))
{
OnTopRangeChanged(new TopRangeChangedEventArgs(piles.getStack(orderedStackSelected).Peek(), ((JouerUneCarte)gameActions[1]).OldCard, orderedStackSelected));
return true;
}
else
{
Message = ((JouerUneCarte)gameActions[1]).ErrorMessage;
return false;
}
}
@ -137,7 +168,7 @@ namespace TheGameExtreme.model.gameActions.classic
{
currentHand.ForEach(card =>
{
if (card.Value > piles.getStack(0).Peek().Value || card.Value > piles.getStack(1).Peek().Value || card.Value < piles.getStack(2).Peek().Value || card.Value < piles.getStack(3).Peek().Value)
if (card.Value > Piles.getStack(0).Peek().Value || card.Value > Piles.getStack(1).Peek().Value || card.Value < Piles.getStack(2).Peek().Value || card.Value < Piles.getStack(3).Peek().Value)
{
playableCard.Add(card);
}

@ -52,7 +52,6 @@ namespace TheGameExtreme.model.gameActions.classic
stack.Push(card);
return true;
//OnTopRangeChanged(new TopRangeChangedEventArgs(card, oldCard, ListOrderedStacks.IndexOf(orderedStack)));
}
else
{

@ -7,8 +7,6 @@ namespace TheGameExtreme.model.gameActions.classic
public class Piocher : GameAction
{
protected int nbMaxCard = 7; // Changer
public Piocher(Piles ListOrderedStacks) : base(ListOrderedStacks)
{
}
@ -18,7 +16,7 @@ namespace TheGameExtreme.model.gameActions.classic
return true;
}
public void pioche(List<Card> CurrentHand, Deck deck, Player player)
public void pioche(List<Card> CurrentHand, Deck deck, Player player, int nbMaxCard)
{
int nbPickedCard = nbMaxCard - CurrentHand.Count;
for (int i = 0; i < nbPickedCard; i++)

@ -7,9 +7,9 @@ namespace TheGameExtreme.model.gameActions.extreme
{
public ExtremeMode()
{
gameActions.Add(new ExtremePiocher(piles));
gameActions.Add(new ExtremeJouerUneCarte(piles));
gameActions.Add(new ExtremeTerminerSonTour(piles));
gameActions.Add(new ExtremePiocher(Piles));
gameActions.Add(new ExtremeJouerUneCarte(Piles));
gameActions.Add(new ExtremeTerminerSonTour(Piles));
}
}
}

@ -13,12 +13,9 @@ namespace TheGameExtreme.model.manager
/* GameMaster implémente un mode de jeu (classe fille de gameMode qui connait les actions a effectué en fonction du mode de jeu */
protected Parametreur parametreur;
public Piles ListOrderedStacks { get; set; }
protected List<Card> CurrentCardPlayed = new List<Card>();
public String EndMessage { get; set; }
public string EndMessage { get; set; }
protected int currentIndexPlayer;
protected List<Card> currentHand;
public List<Card> CurrentHand
{
@ -32,16 +29,16 @@ namespace TheGameExtreme.model.manager
#region event
public event EventHandler<TopRangeChangedEventArgs> TopRangeChanged;
public event EventHandler<EventArgs> EndGame;
public event EventHandler<PlayerChangedEventArgs> PlayerChanged;
public event PropertyChangedEventHandler PropertyChanged;
public virtual void OnPropertyChanged(string info)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info));
}
public void OnTopRangeChanged(object source, TopRangeChangedEventArgs args)
public void OnEndGame(object source, EventArgs args)
{
TopRangeChanged?.Invoke(this, args);
EndGame?.Invoke(source, args);
}
protected internal void OnPlayerChanged(object source, PlayerChangedEventArgs args)
{
@ -51,7 +48,7 @@ namespace TheGameExtreme.model.manager
currentIndexPlayer = 0;
}
CurrentHand = parametreur.players[currentIndexPlayer].getCardList();
PlayerChanged?.Invoke(this, new PlayerChangedEventArgs(CurrentHand, parametreur.players[currentIndexPlayer].Pseudo));
PlayerChanged?.Invoke(source, new PlayerChangedEventArgs(CurrentHand, parametreur.players[currentIndexPlayer].Pseudo));
parametreur.GameMode.NbCardAtBeginOfTurn = CurrentHand.Count;
}
@ -65,7 +62,7 @@ namespace TheGameExtreme.model.manager
parametreur.Prepare();
parametreur.GameMode.TopRangeChanged += OnTopRangeChanged;
parametreur.GameMode.EndGame += OnEndGame;
parametreur.GameMode.PlayerChanged += OnPlayerChanged;
@ -74,10 +71,11 @@ namespace TheGameExtreme.model.manager
public void joue(int valueCard, int orderedStackSelected)
public bool joue(int valueCard, int orderedStackSelected)
{
parametreur.GameMode.playCard(valueCard, currentHand, orderedStackSelected, parametreur.players[currentIndexPlayer], CurrentCardPlayed); // Mettre le joueur actif
bool isPlayed = parametreur.GameMode.playCard(valueCard, currentHand, orderedStackSelected, parametreur.players[currentIndexPlayer], CurrentCardPlayed); // Mettre le joueur actif
EndMessage = parametreur.GameMode.Message;
return isPlayed;
}
public bool endTurn()
@ -106,6 +104,11 @@ namespace TheGameExtreme.model.manager
return parametreur.GameMode.isEndGame(currentHand);
}
public Piles getPiles()
{
return parametreur.GameMode.Piles;
}

@ -19,17 +19,13 @@ namespace TheGameExtreme.view
[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 textPaint;
List<TouchManipulationBitmap> textCollection = new List<TouchManipulationBitmap>();
List<TouchManipulationBitmap> stackCollection = new List<TouchManipulationBitmap>();
Dictionary<long, TouchManipulationBitmap> textDictionary = new Dictionary<long, TouchManipulationBitmap>();
private SKCanvas canvas;
@ -40,19 +36,15 @@ namespace TheGameExtreme.view
InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
InflateStack();
//button.Text = "Retry";
//button.Clicked += retry;
viewmodel = new Main(playersNames);
//viewmodel.BindingChanged += OnBindingChanged;
viewmodel.EndGame += OnEndGame;
viewmodel.AlertChanged += OnAlertChanged;
pseudo.SetBinding(Label.TextProperty, new Binding("Pseudo", source: viewmodel));
InflateStack();
InflateHand();
}
@ -70,8 +62,7 @@ namespace TheGameExtreme.view
public void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args)
{
SKCanvas canvas = args.Surface.Canvas;
canvas = args.Surface.Canvas;
canvas.Clear();
foreach (TouchManipulationBitmap textPaint in stackCollection)
@ -87,7 +78,6 @@ namespace TheGameExtreme.view
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),
@ -108,7 +98,7 @@ namespace TheGameExtreme.view
// Do the touch processing
textDictionary.Add(args.Id, textPaint);
textPaint.ProcessTouchEvent(args.Id, args.Type, point, stackCollection);
textPaint.ProcessTouchEvent(args.Id, args.Type, point);
canvasView.InvalidateSurface();
break;
}
@ -119,26 +109,44 @@ namespace TheGameExtreme.view
if (textDictionary.ContainsKey(args.Id))
{
TouchManipulationBitmap bitmap = textDictionary[args.Id];
bitmap.ProcessTouchEvent(args.Id, args.Type, point, stackCollection);
bitmap.ProcessTouchEvent(args.Id, args.Type, point);
canvasView.InvalidateSurface();
}
break;
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:
if (textDictionary.ContainsKey(args.Id))
{
TouchManipulationBitmap bitmap = textDictionary[args.Id];
bitmap.ProcessTouchEvent(args.Id, args.Type, point, stackCollection);
bool find = false;
foreach (TouchManipulationBitmap stack in stackCollection)
{
if (stack.HitTest(point))
{
int indexPile = stackCollection.IndexOf(stack);
if (played(indexPile, int.Parse(bitmap.Value)))
{
point = stack.InitialPoint;
bitmap.ProcessTouchEvent(args.Id, TouchActionType.Moved, point);
canvasView.InvalidateSurface();
bitmap.InitialPoint = stackCollection[stackCollection.IndexOf(stack)].InitialPoint;
stackCollection[stackCollection.IndexOf(stack)] = bitmap;
textCollection.RemoveAt(textCollection.Count - 1);
find = true;
}
break;
}
}
if (!find)
{
point = bitmap.InitialPoint;
bitmap.ProcessTouchEvent(args.Id, TouchActionType.Moved, point);
canvasView.InvalidateSurface();
}
bitmap.ProcessTouchEvent(args.Id, args.Type, point);
textDictionary.Remove(args.Id);
canvasView.InvalidateSurface();
}
@ -164,32 +172,24 @@ namespace TheGameExtreme.view
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 < 4; i++)
for (int i = 0; i < viewmodel.getListOrderedStacks().Count; i++)
{
textPaint = new SKPaint();
textPaint.TextSize = textSize;
position.X += (float)(DeviceDisplay.MainDisplayInfo.Width * 0.2);
stackCollection.Add(new TouchManipulationBitmap(textPaint, 1)
stackCollection.Add(new TouchManipulationBitmap(textPaint, viewmodel.getListOrderedStacks()[i].Peek().Value)
{
Matrix = SKMatrix.MakeTranslation(position.X, position.Y),
InitialPoint = position
});
position.X += (float)(DeviceDisplay.MainDisplayInfo.Width * 0.2);
}
}
private void InflateHand()
{
textCollection.Clear();
SKPaint textPaint = new SKPaint();
float textWidth = textPaint.MeasureText("01");
float textSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth;
@ -211,74 +211,38 @@ namespace TheGameExtreme.view
}
}
private void OnBindingChanged(object sender, TopRangeChangedEventArgs args)
private void OnEndGame(object sender, EventArgs 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;
// }
//}
button = (Button)gameOption.Children[0];
gameOption.Children.Clear();
Button retryButton = new Button();
retryButton.Text = "Retry";
retryButton.Clicked += retry;
retryButton.BackgroundColor = (Color)Application.Current.Resources["SkyBlueColor"];
gameOption.Children.Add(retryButton);
}
private void played(object sender, EventArgs args)
private bool played(int numStack, int value)
{
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)
if (!viewmodel.played(numStack, value))
{
viewmodel.Alert = "Aucune pile selectionné! Veuillez séléctionner une pile.";
return;
return false;
}
return true;
}
private void retry(object sender, EventArgs args)
{
viewmodel = new Main(playersNames);
viewmodel.BindingChanged += OnBindingChanged;
viewmodel.EndGame += OnEndGame;
pseudo.SetBinding(Label.TextProperty, new Binding("Pseudo", source: viewmodel));
textCollection.Clear();
textDictionary.Clear();
canvasView.InvalidateSurface();
InflateStack();
InflateHand();
gameOption.Children.Clear();
@ -287,17 +251,13 @@ namespace TheGameExtreme.view
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
if (!viewmodel.endTurn())
{
textCollection.Clear();
textDictionary.Clear();
stackCollection.Clear();
canvasView.InvalidateSurface();
InflateStack();
InflateHand();
}
}

@ -9,19 +9,18 @@ namespace TheGameExtreme.view
public SKPoint InitialPoint { get; set; }
SKPaint textPaint;
Dictionary<long, TouchManipulationInfo> touchDictionary = new Dictionary<long, TouchManipulationInfo>();
string value;
SKCanvas canvas;
public string Value;
public TouchManipulationBitmap(SKPaint textPaint, int value)
{
this.textPaint = textPaint;
if (value > 0 && value < 10)
{
this.value = "0" + value.ToString();
Value = "0" + value.ToString();
}
else
{
this.value = value.ToString();
Value = value.ToString();
}
Matrix = SKMatrix.MakeIdentity();
@ -38,25 +37,24 @@ namespace TheGameExtreme.view
public void Paint(SKCanvas canvas)
{
this.canvas = canvas;
canvas.Save();
SKMatrix matrix = Matrix;
canvas.Concat(ref matrix);
textPaint.Color = SKColors.DarkRed;
textPaint.Color = SKColors.SkyBlue;
textPaint.StrokeWidth = 5;
textPaint.Style = SKPaintStyle.Stroke;
SKRect textBounds = new SKRect();
textPaint.MeasureText(value, ref textBounds);
textPaint.MeasureText(Value, ref textBounds);
SKRoundRect card = new SKRoundRect(textBounds);
card.Inflate(35, 35);
card.Inflate(35, 55);
canvas.DrawRoundRect(card, textPaint);
canvas.DrawText(value, 0, 0, textPaint);
canvas.DrawText(Value, 0, 0, textPaint);
canvas.Restore();
}
@ -72,13 +70,13 @@ namespace TheGameExtreme.view
SKPoint transformedPoint = inverseMatrix.MapPoint(location);
// Check if it's in the untransformed bitmap rectangle
SKRect rect = new SKRect(0, 0, textPaint.MeasureText(value), textPaint.TextSize);
SKRect rect = new SKRect(0, 0, textPaint.MeasureText(Value), textPaint.TextSize);
return rect.Contains(transformedPoint);
}
return false;
}
public void ProcessTouchEvent(long id, TouchActionType type, SKPoint location, List<TouchManipulationBitmap> stackCollection)
public void ProcessTouchEvent(long id, TouchActionType type, SKPoint location)
{
switch (type)
{
@ -98,27 +96,6 @@ namespace TheGameExtreme.view
break;
case TouchActionType.Released:
bool find = false;
foreach (TouchManipulationBitmap stack in stackCollection)
{
if (stack.HitTest(location))
{
touchDictionary[id].NewPoint = stack.InitialPoint;
Manipulate();
touchDictionary[id].PreviousPoint = touchDictionary[id].NewPoint;
stackCollection[stackCollection.IndexOf(stack)] = this;
//canvas.Flush();
find = true;
break;
}
}
if (!find)
{
touchDictionary[id].NewPoint = InitialPoint;
Manipulate();
touchDictionary[id].PreviousPoint = touchDictionary[id].NewPoint;
}
break;
case TouchActionType.Cancelled:
touchDictionary.Remove(id);
@ -136,7 +113,7 @@ namespace TheGameExtreme.view
{
SKPoint prevPoint = infos[0].PreviousPoint;
SKPoint newPoint = infos[0].NewPoint;
SKPoint pivotPoint = Matrix.MapPoint(textPaint.MeasureText(value) / 2, textPaint.TextSize / 2);
SKPoint pivotPoint = Matrix.MapPoint(textPaint.MeasureText(Value) / 2, textPaint.TextSize / 2);
touchMatrix = TouchManager.OneFingerManipulate(prevPoint, newPoint, pivotPoint);
}

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using TheGameExtreme.model;
using TheGameExtreme.model.card;
@ -12,9 +11,7 @@ namespace TheGameExtreme.viewmodel
{
public class Main : INotifyPropertyChanged
{
//public event EventHandler<PlayerChangedEventArgs> PlayerChanged;
public event EventHandler<TopRangeChangedEventArgs> BindingChanged;
public event EventHandler<EventArgs> EndGame;
public event EventHandler<EventArgs> AlertChanged;
public event PropertyChangedEventHandler PropertyChanged;
private List<PlayerVM> players = new List<PlayerVM>();
@ -49,7 +46,7 @@ namespace TheGameExtreme.viewmodel
private GameManager gameManager;
public List<CardVM> CurrentHand { get; set; } = new List<CardVM>();
//private ObservableCollection<Stack<Card>> ListOrderedStacks;
public List<Stack<CardVM>> listOrderedStacks = new List<Stack<CardVM>>();
public Main(List<string> playersNames)
@ -59,7 +56,7 @@ namespace TheGameExtreme.viewmodel
players.ForEach(player => parametreur.AddPlayer(player.View));
gameManager = new SoloGameManager(parametreur) ; // Donner le nom des joueurs
gameManager.TopRangeChanged += OnBindingChanged;
gameManager.EndGame += OnEndGame;
gameManager.PlayerChanged += OnPlayerChanged;
@ -70,31 +67,40 @@ namespace TheGameExtreme.viewmodel
Pseudo = players[0].Pseudo;
//ListOrderedStacks = new ObservableCollection<Stack<Card>>(gameManager.ListOrderedStacks);
for (int i = 0; i < 4; i++)
{
Stack<Card> pileView = gameManager.getPiles().getStack(i);
Stack<CardVM> pile = new Stack<CardVM>();
Card[] cards = pileView.ToArray();
for (int j = 0; j < cards.Length; j++)
{
pile.Push(new CardVM(cards[j]));
}
listOrderedStacks.Add(pile);
}
}
public IReadOnlyList<Stack<CardVM>> getListOrderedStacks()
{
return listOrderedStacks.AsReadOnly();
}
protected internal void OnPlayerChanged(object source, PlayerChangedEventArgs args)
{
CurrentHand.Clear();
args.NewCurrentHand.ForEach( card =>
{
CurrentHand.Add(new CardVM(card));
});
Pseudo = args.Pseudo;
//PlayerChanged?.Invoke(this, args);
}
public void OnBindingChanged(object source, TopRangeChangedEventArgs args)
public void OnEndGame(object source, EventArgs args)
{
BindingChanged?.Invoke(this, args);
EndGame?.Invoke(source, args);
}
/**
*
*
@ -102,89 +108,25 @@ namespace TheGameExtreme.viewmodel
*/
public bool played(int numStack, int valueCard)
{
//try
//{
gameManager.joue(valueCard, numStack);
if (!gameManager.joue(valueCard, numStack))
{
Alert = gameManager.EndMessage;
//if (gameManager.EndMessage != null)
//{
// Alert = gameManager.EndMessage;
// return true;
//}
return false;
//}
//catch (Exception e)
//{
// // Faire un toast
// Alert = e.Message;
//}
//return false;
//if (gameManager.isCanPlay())
//{
// return playOneCard(numStack, valueCard);
//}
//else
//{
// Alert = "Le joueur n'a plus de carte dans sa main!";
// // Faire un toast
// return false;
//}
}
listOrderedStacks[numStack].Push(new CardVM(gameManager.getPiles().getStack(numStack).Peek()));
return true;
}
public bool endTurn()
{
bool isEnd = gameManager.endTurn();
Alert = gameManager.EndMessage;
if (isEnd)
{
OnEndGame(this, new EventArgs());
}
return isEnd;
}
///**
// *
// *
// * @return booléen de fin de jeu
// */
//private bool playOneCard(int numStack, int valueCard)
//{
// try
// {
// gameManager.joue(valueCard, numStack);
// if (gameManager.EndMessage != null)
// {
// Alert = gameManager.EndMessage;
// return true;
// }
// }
// catch(Exception e)
// {
// // Faire un toast
// Alert = e.Message;
// }
// return false;
//}
//public bool endTurn()
//{
// try
// {
// bool isEnd = gameManager.endTurn();
// Alert = gameManager.EndMessage;
// return isEnd;
// }
// catch(Exception e)
// {
// Alert = e.Message;
// return false;
// }
//}
}
}

Loading…
Cancel
Save