private static void ConvertInt2Enum(Clue.CardDeckEventEventArgs e) { if (e.CardType == CardType.Suspect) { Suspect[] array = e.AnswerCardDeck.Select(x => (Suspect)x).ToArray(); } if (e.CardType == CardType.Place) { Place[] array = e.AnswerCardDeck.Select(x => (Place)x).ToArray(); } if (e.CardType == CardType.Weapon) { Weapon[] array = e.AnswerCardDeck.Select(x => (Weapon)x).ToArray(); } }
private static void Card_CardDeckEvent(object sender, Clue.CardDeckEventEventArgs e) { Random random = new Random(); ConvertInt2Enum(e); int index = random.Next(array.Length); for (int i = 0; i < array.Length; i++) { if (i != index) { e.CardDeck.Add(i); } } }