public void ToggleFingerImage() { if (pbFinger.Image == null) { if (Game.OnTurn == Game.Player1) { pbFinger.Image = Resources.finger_left; } else { pbFinger.Image = Resources.finger_right; } } else { if (BitmapComparator.CompareBitmaps((Bitmap)pbFinger.Image, Resources.finger_left)) { pbFinger.Image = Resources.finger_right; } else { pbFinger.Image = Resources.finger_left; } } }
/// <summary> /// Toggles the card. /// If it is already paired (paired cards cannot be flipped), this method has no effect. /// </summary> public bool Toggle() { if (!Paired) { if (BitmapComparator.CompareBitmaps((Bitmap)ImageFrame.Image, Resources.question_mark)) { ImageFrame.Image = Image; ImageFrame.BackColor = PrimaryColor; } else { ImageFrame.Image = Resources.question_mark; ImageFrame.BackColor = CurrentColor; } IsOpen = !IsOpen; return(true); } return(false); }
/// <summary> /// Checks if two cards are equal by their images. /// </summary> /// <param name="c1">The first card.</param> /// <param name="c2">The second card.</param> /// <returns></returns> public bool CheckEqualCards(Card c1, Card c2) { return(BitmapComparator.CompareBitmaps(c1.Image, c2.Image)); }