restructure
This commit is contained in:
51
Mau/Card.cs
Normal file
51
Mau/Card.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
namespace MauMau_Server.Mau;
|
||||
|
||||
public class Card
|
||||
{
|
||||
public readonly CardType CardType;
|
||||
public readonly CardValue CardValue;
|
||||
|
||||
public Card(CardType cardType, CardValue cardValue)
|
||||
{
|
||||
CardType = cardType;
|
||||
CardValue = cardValue;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{CardType} {CardValue}";
|
||||
}
|
||||
|
||||
public Card parseCard(string card)
|
||||
{
|
||||
var cardType = card.Split(" ")[0];
|
||||
var cardValue = card.Split(" ")[1];
|
||||
return new Card((CardType)Enum.Parse(typeof(CardType), cardType),
|
||||
(CardValue)Enum.Parse(typeof(CardValue), cardValue));
|
||||
}
|
||||
}
|
||||
|
||||
public enum CardType
|
||||
{
|
||||
SPADES,
|
||||
HEARTS,
|
||||
DIAMONDS,
|
||||
CLUBS
|
||||
}
|
||||
|
||||
public enum CardValue
|
||||
{
|
||||
TWO,
|
||||
THREE,
|
||||
FOUR,
|
||||
FIVE,
|
||||
SIX,
|
||||
SEVEN,
|
||||
EIGHT,
|
||||
NINE,
|
||||
TEN,
|
||||
JACK,
|
||||
QUEEN,
|
||||
KING,
|
||||
ACE
|
||||
}
|
||||
Reference in New Issue
Block a user