Пример #1
0
void CTaxasRobotBrain::recivedCard( CCard& card )
{
	if ( m_tPeerCard.getAllCardCnt() < 7 )
	{
		m_tPeerCard.AddCardByCompsiteNum(card.GetCardCompositeNum()) ;
	}
	else
	{
		assert( 0 && "you forget reset state or add too more cards, logic error");
	}
}
Пример #2
0
SpriteFrame* CClientApp::getCardSpriteByCompsiteNum(uint16_t nNum )
{
	CCard tc ;
	tc.RsetCardByCompositeNum(nNum);
	std::string spriteValue  ;
	uint8_t nType = 0 ;
	switch ( tc.GetType() )
	{
	case CCard::eCard_Diamond:
		nType = 4 ;
		break;
	case CCard::eCard_Heart:
		nType = 2 ;
		break;
	case CCard::eCard_Sword:
		nType = 1 ;
		break;
	case CCard::eCard_Club:
		nType = 3 ;
		break;
	default:
		break;
	}

	if ( nType == 0 || tc.GetCardCompositeNum() == 0 )
	{
		return nullptr ;
	}

	if ( tc.GetCardFaceNum(true) <= 9 )
	{
		spriteValue = String::createWithFormat("card-%d0%d.png",nType,tc.GetCardFaceNum(true))->getCString();
	}
	else
	{
		spriteValue = String::createWithFormat("card-%d0%c.png",nType,'a'+ tc.GetCardFaceNum(true)%10)->getCString();
	}

	return SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteValue.c_str());
}