73 lines
1.4 KiB
C++
73 lines
1.4 KiB
C++
|
|
|
|||
|
|
#include "ZJH_ChipNode.h"
|
|||
|
|
|
|||
|
|
#include "cocostudio/CocoStudio.h"
|
|||
|
|
using namespace cocostudio;
|
|||
|
|
|
|||
|
|
///////////////////////////////////////////////////////////////////////////
|
|||
|
|
ZJHChipNode::ZJHChipNode() : _panelRoot(NULL)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ZJHChipNode:: ~ZJHChipNode()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ZJHChipNode* ZJHChipNode::create(uint8 cbCardData)
|
|||
|
|
{
|
|||
|
|
ZJHChipNode *pRet = new ZJHChipNode();
|
|||
|
|
if (pRet && pRet->init(cbCardData))
|
|||
|
|
{
|
|||
|
|
pRet->autorelease();
|
|||
|
|
return pRet;
|
|||
|
|
}
|
|||
|
|
CC_SAFE_DELETE(pRet);
|
|||
|
|
return NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool ZJHChipNode::init(uint8 cbCardData)
|
|||
|
|
{
|
|||
|
|
if (!Node::init())
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
_panelRoot = CSLoader::createNode("Games/ZJH/ChipNode.csb");
|
|||
|
|
this->addChild(_panelRoot);
|
|||
|
|
|
|||
|
|
this->ignoreAnchorPointForPosition(false);
|
|||
|
|
this->setAnchorPoint(Vec2::ZERO);
|
|||
|
|
this->setContentSize(_panelRoot->getContentSize());
|
|||
|
|
|
|||
|
|
//<2F><EFBFBD><F3B6A8BD><EFBFBD>Ԫ<EFBFBD><D4AA>;
|
|||
|
|
_sprChipBg = static_cast<Sprite*>(_panelRoot->getChildByName("imgChipBg"));
|
|||
|
|
CC_ASSERT(_sprChipBg != nullptr);
|
|||
|
|
|
|||
|
|
//<2F><>ֵ;
|
|||
|
|
_txtNum = static_cast<Text*>(_panelRoot->getChildByName("txtNum"));
|
|||
|
|
CC_ASSERT(_txtNum != nullptr);
|
|||
|
|
|
|||
|
|
if (cbCardData > 1 && cbCardData <= 5)
|
|||
|
|
{
|
|||
|
|
_sprChipBg->setTexture(StringUtils::format("Games/ZJH/Table/imgChip%d.png", cbCardData));
|
|||
|
|
_txtNum->setString(StringUtils::format("%d", cbCardData));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void ZJHChipNode::onEnter()
|
|||
|
|
{
|
|||
|
|
Node::onEnter();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void ZJHChipNode::onExit()
|
|||
|
|
{
|
|||
|
|
Node::onExit();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void ZJHChipNode::onEnterTransitionDidFinish()
|
|||
|
|
{
|
|||
|
|
Node::onEnterTransitionDidFinish();
|
|||
|
|
}
|