Example #1
0
void CardGeneral::drawCard()
{
	UInt8 _keyValue = 0;
	UInt8 gid = 0;
	if (cardValue >= 11 && cardValue <= 13)
	{
		_keyValue = cardValue-1;

		gid = cardValue-11;
	}
	else
	{
		//Logger
		LOGERROR<<"card Value error";
		return;

	}
	//draw card zi
	if (cardColor == 0 || cardColor == 2)
	{

		//draw card background
		pSpriteGrain = CCSprite::createWithSpriteFrameName(s_pNameListRedGGrain[gid].c_str());
		backGround->addChild(pSpriteGrain);
		setCardGrainP();

		pSpriteZi = CCSprite::createWithSpriteFrameName(s_pNameListNormalCardBlackZi[_keyValue].c_str());
		backGround->addChild(pSpriteZi);
		//set zi position
		setCardZiP();

		//draw hua
		pSpriteHua = CCSprite::createWithSpriteFrameName(s_pNameListHua[cardColor].c_str());
		backGround->addChild(pSpriteHua);
		setCardHuaP();
	}
	else if (cardColor == 1 || cardColor == 3)
	{
		//draw card background
		pSpriteGrain = CCSprite::createWithSpriteFrameName(s_pNameListBlueGGrain[gid].c_str());
		setCardGrainP();
		backGround->addChild(pSpriteGrain);

		pSpriteZi = CCSprite::createWithSpriteFrameName(s_pNameListNormalCardRedZi[_keyValue].c_str());
		//set zi position
		setCardZiP();
		backGround->addChild(pSpriteZi);

		//draw hua
		pSpriteHua = CCSprite::createWithSpriteFrameName(s_pNameListHua[cardColor].c_str());
		setCardHuaP();
		backGround->addChild(pSpriteHua);
	}
	else
	{
		LOGERROR<<"card Color error";
	}
}
Example #2
0
void CardKing::drawCard()
{
	UInt8 _keyValue = 0;

	if (cardValue >= 16 && cardValue <= 17)
	{
		_keyValue = cardValue - 16;
	}
	else
	{
		//Logger
		LOGERROR<<"card Value error";
		return;
	}

	if (cardColor >= 0 && cardColor <= 1)
	{
		//draw card background
		pSpriteGrain = Sprite::createWithSpriteFrameName(s_pNameListKingGrain[cardColor].c_str());
		backGround->addChild(pSpriteGrain);
		setCardGrainP();

		//draw hua
		pSpriteHua = Sprite::createWithSpriteFrameName(s_pNameListKingHua[cardColor].c_str());
		backGround->addChild(pSpriteHua);
		setCardHuaP();
	}
	else
	{
		//Logger
		LOGERROR<<"card Color error";
		return;
	}
}