This commit is contained in:
cyw
2026-02-13 14:34:15 +08:00
parent 6ed1953e24
commit f36e3f9df2
5206 changed files with 573757 additions and 16 deletions

View File

@@ -0,0 +1,73 @@
#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;
}
//加载界面数据;
_panelRoot = CSLoader::createNode("Games/ZJH/ChipNode.csb");
this->addChild(_panelRoot);
this->ignoreAnchorPointForPosition(false);
this->setAnchorPoint(Vec2::ZERO);
this->setContentSize(_panelRoot->getContentSize());
//绑定界面元素;
_sprChipBg = static_cast<Sprite*>(_panelRoot->getChildByName("imgChipBg"));
CC_ASSERT(_sprChipBg != nullptr);
//数值;
_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();
}