You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using TheGameExtreme.model;
|
|
using TheGameExtreme.model.card;
|
|
using TheGameExtreme.model.@event;
|
|
|
|
namespace TheGameExtreme.viewmodel
|
|
{
|
|
public class PlayerVM
|
|
{
|
|
|
|
public Player View { get; set; }
|
|
public string Pseudo { get; set; }
|
|
private List<CardVM> cardList = new List<CardVM>();
|
|
//public event EventHandler<HandCardChangedEventArgs> HandCardChanged;
|
|
|
|
public PlayerVM(Player view)
|
|
{
|
|
View = view;
|
|
|
|
Pseudo = view.Pseudo;
|
|
view.getCardList().ForEach(card => cardList.Add(new CardVM(card)));
|
|
|
|
View.HandCardChanged += OnHandCardChanged;
|
|
}
|
|
|
|
private void OnHandCardChanged(object sender, HandCardChangedEventArgs args)
|
|
{
|
|
if (args.NewCard == null)
|
|
{
|
|
cardList.RemoveAt(args.Position);
|
|
}
|
|
else
|
|
{
|
|
cardList.Insert(args.Position, new CardVM(args.NewCard));
|
|
}
|
|
}
|
|
|
|
public void pioche(CardVM card)
|
|
{
|
|
View.pioche(card.View);
|
|
}
|
|
|
|
public List<CardVM> getCardList()
|
|
{
|
|
return cardList;
|
|
}
|
|
}
|
|
}
|