Busfahrer Spiel fertig
This commit is contained in:
@@ -81,6 +81,59 @@ namespace Casino
|
||||
return imageBytes;
|
||||
}
|
||||
|
||||
public List<Busfahrer.Card> GetAllCards()
|
||||
{
|
||||
var cards = new List<Busfahrer.Card>();
|
||||
|
||||
using (MySqlConnection conn = new MySqlConnection(myConnectionString))
|
||||
{
|
||||
conn.Open();
|
||||
// Lädt alle echten Karten aus der Tabelle (schließt Rückseite 'Back' aus)
|
||||
string query = "SELECT kartenid, wert, farbe, bild FROM Karten WHERE wert != 'Back' AND deckid != 'Slots'";
|
||||
using (MySqlCommand cmd = new MySqlCommand(query, conn))
|
||||
{
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
int id = reader.GetInt32("kartenid");
|
||||
string wert = reader.GetString("wert");
|
||||
string farbe = reader.GetString("farbe");
|
||||
byte[] img = (byte[])reader["bild"];
|
||||
|
||||
cards.Add(new Busfahrer.Card(id, wert, farbe, img));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cards;
|
||||
}
|
||||
|
||||
// NEU: Holt das Bild der Kartenrückseite
|
||||
public byte[] GetCardBackImage()
|
||||
{
|
||||
byte[] imageBytes = null;
|
||||
|
||||
using (MySqlConnection conn = new MySqlConnection(myConnectionString))
|
||||
{
|
||||
conn.Open();
|
||||
string query = "SELECT bild FROM Karten WHERE wert = 'Back' OR deckid = 'Back' LIMIT 1";
|
||||
using (MySqlCommand cmd = new MySqlCommand(query, conn))
|
||||
{
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
imageBytes = (byte[])reader["bild"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return imageBytes;
|
||||
}
|
||||
|
||||
public byte[] GetSound(int id)
|
||||
{
|
||||
byte[] soundBytes = null;
|
||||
|
||||
Reference in New Issue
Block a user