Оценить:
 Рейтинг: 4

Справочник Жаркова по проектированию и программированию искусственного интеллекта. Том 8: Программирование на Visual C# искусственного интеллекта. Издание 2. Продолжение 1

Год написания книги
2023
Теги
<< 1 ... 24 25 26 27 28 29 30 31 32 ... 38 >>
На страницу:
28 из 38
Настройки чтения
Размер шрифта
Высота строк
Поля

: this(cardNo, true)

{

}

/// <summary>

/// String description of the card

/// </summary>

/// <returns>the name and suit of the card</returns>

public override string ToString()

{

return ValueName + " of " + Suit;

}

}

/// <summary>

/// Provides a container for a number of cards.

/// May be used to draw the cards and compute their score.

/// </summary>

public class CardHand : ArrayList

{

/// <summary>

/// Used as a destination of teh draw action

/// </summary>

private static Rectangle drawRect;

/// <summary>

/// Draws the hand on the graphics.

/// </summary>

/// <param name="g">graphics to draw with</param>

/// <param name="startx">left edge of first card</param>

/// <param name="starty">top of first card</param>

/// <param name="gapx">x gap between each card</param>

/// <param name="gapy">y gap between each card</param>

public void DrawHand(Graphics g, int startx, int starty,

int gapx, int gapy)

{

drawRect.X = startx;

drawRect.Y = starty;

foreach (Card card in this)

{

drawRect.Width = card.CardImage.Width;

drawRect.Height = card.CardImage.Height;

g.DrawImage(

card.CardImage,                  // Image

drawRect,                  // destination rectange

0,                                    // srcX

0,                                    // srcY

card.CardImage.Width, // srcWidth

card.CardImage.Height,      // srcHeight

GraphicsUnit.Pixel,            // srcUnit

Card.cardAttributes); // ImageAttributes

drawRect.X += gapx;

drawRect.Y += gapy;
<< 1 ... 24 25 26 27 28 29 30 31 32 ... 38 >>
На страницу:
28 из 38

Другие электронные книги автора Валерий Алексеевич Жарков