//private void PictureBoxUpdated(object sender, DoWorkEventArgs e) //{ // string text = (string)e.Argument; // this.pictureBox1.Load(text); //} private string GetImageName(UNOCard card) { int color = card.GetColor(); int power = card.GetPower(); int number = card.GetNumber(); string resource = "./images/"; if (color != -1) { resource += Enum.GetName(typeof(Constants.Colors), color); resource += "_"; if (power != -1) { resource += Enum.GetName(typeof(Constants.Powers), power); } else { resource += number; } } else { resource += Enum.GetName(typeof(Constants.Powers), power); } resource += "_large.png"; return(resource); }
public static UNOCard[] GetValidCards(UNOCard currentCard, UNOCard[] playerCards) { int currentCardColor = currentCard.GetColor(); int currentCardNumber = currentCard.GetNumber(); List <UNOCard> validCards = playerCards.ToList(); foreach (UNOCard card in validCards) { int number = card.GetNumber(); int power = card.GetPower(); int color = card.GetColor(); if (number != -1) { if (number != currentCardNumber || color != currentCardColor) { validCards.Remove(card); } } else { if (power != 3 || power != 4) //Plus 4 or wild { if (color != currentCardColor) { validCards.Remove(card); } } } } return(validCards.ToArray()); }