1st json over websocket test

This commit is contained in:
2023-03-16 15:20:28 +01:00
parent 405a14ad28
commit 4f85f6f793
7 changed files with 181 additions and 5 deletions

51
Mau/Card.cs Normal file
View 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
}