Esempio n. 1
0
        private static string ApplyCardsToLine(SampleMatch match, bool isBorderLine, int row, string orgline, int cardrow)
        {
            int numCards = match.GetNumberOfCards(row);

            if (numCards == 0)
            {
                return(orgline);
            }

            int startX = GetFirstCardPositionX(match, row);

            string line      = "+";
            string emptyLine = "|";

            for (int j = 0; j < numCards; j++)
            {
                line += "=====+";

                SampleMinionCard card = match.Playfield[j, row] as SampleMinionCard;

                if (card != null)
                {
                    switch (cardrow)
                    {
                    case 1:
                        if (card.IsSleeping)
                        {
                            emptyLine += " Zzz |";
                        }
                        else
                        {
                            emptyLine += "   " + card.CurrentMovesPerRound + " |";
                        }
                        break;

                    case 2:
                        emptyLine += "A" + card.Attack.ToString("D3") + " |";
                        break;

                    case 3:
                        emptyLine += "L" + card.CurrentHealth.ToString("D3") + " |";
                        break;

                    default:
                        emptyLine += "     |";
                        break;
                    }
                }
                else
                {
                    emptyLine += "     |";
                }
            }

            string lineToUse = isBorderLine ? line : emptyLine;

            return(orgline.Remove(startX, lineToUse.Length).Insert(startX, lineToUse));
        }
Esempio n. 2
0
        private static int GetFirstCardPositionX(SampleMatch match, int row)
        {
            int numberOfCardsInRow = match.GetNumberOfCards(row);

            int widthOfCard = 6;
            int fullWidth   = widthOfCard * match.PlayfieldWidth;
            int xPos        = (fullWidth / 2) - (widthOfCard / 2) * numberOfCardsInRow;

            return(xPos);
        }