本文整理汇总了C++中CCDictElement::getIntKey方法的典型用法代码示例。如果您正苦于以下问题:C++ CCDictElement::getIntKey方法的具体用法?C++ CCDictElement::getIntKey怎么用?C++ CCDictElement::getIntKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCDictElement
的用法示例。
在下文中一共展示了CCDictElement::getIntKey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CCBAnimationManager::~CCBAnimationManager()
{
CCDictElement *pElement = NULL;
CCDICT_FOREACH(mNodeSequences, pElement)
{
CCNode *node = (CCNode*)pElement->getIntKey();
node->release();
}
示例2: clean
void Animal::clean(){
this->finishCurAction();
this->stopAllActions();
this->getObserver()->finish();
CCDictElement* pElement = NULL;
CCDICT_FOREACH(moves, pElement)
{
int key = pElement->getIntKey();
BaseMove* move = (BaseMove*)pElement->getObject();
this->removeChild(move,true);
}
示例3: readNodeGraphFromData
CCNode* CCBReader::readNodeGraphFromData(CCData *pData, CCObject *pOwner, const CCSize &parentSize)
{
mData = pData;
CC_SAFE_RETAIN(mData);
mBytes = mData->getBytes();
mCurrentByte = 0;
mCurrentBit = 0;
mOwner = pOwner;
CC_SAFE_RETAIN(mOwner);
mActionManager->setRootContainerSize(parentSize);
mActionManager->mOwner = mOwner;
CCDictionary* animationManagers = CCDictionary::create();
CCNode *pNodeGraph = readFileWithCleanUp(true, animationManagers);
if (pNodeGraph && mActionManager->getAutoPlaySequenceId() != -1 && !jsControlled)
{
// Auto play animations
mActionManager->runAnimationsForSequenceIdTweenDuration(mActionManager->getAutoPlaySequenceId(), 0);
}
// Assign actionManagers to userObject
if(jsControlled) {
mNodesWithAnimationManagers = new CCArray();
mAnimationManagersForNodes = new CCArray();
}
CCDictElement* pElement = NULL;
CCDICT_FOREACH(animationManagers, pElement)
{
CCNode* pNode = (CCNode*)pElement->getIntKey();
CCBAnimationManager* manager = (CCBAnimationManager*)animationManagers->objectForKey((intptr_t)pNode);
// (jason_shi): 将未命名的JSController命名为路径名
if (manager->getDocumentControllerName().compare("") == 0)
{
CCString* pStr = dynamic_cast<CCString*>(pNode->getCustObject());
if (pStr)
{
manager->setDocumentControllerName(pStr->getCString());
pNode->setCustObject(nullptr);
}
}
pNode->setUserObject(manager);
if (jsControlled)
{
mNodesWithAnimationManagers->addObject(pNode);
mAnimationManagersForNodes->addObject(manager);
}
}
示例4: readNodeGraphFromData
CCNode* CCBReader::readNodeGraphFromData(CCData *pData, CCObject *pOwner, const CCSize &parentSize)
{
mData = pData;
CC_SAFE_RETAIN(mData);
mBytes = mData->getBytes();
mCurrentByte = 0;
mCurrentBit = 0;
mOwner = pOwner;
CC_SAFE_RETAIN(mOwner);
mActionManager->setRootContainerSize(parentSize);
mActionManager->mOwner = mOwner;
mOwnerOutletNodes = new CCArray();
mOwnerCallbackNodes = new CCArray();
CCDictionary* animationManagers = CCDictionary::create();
CCNode *pNodeGraph = readFileWithCleanUp(true, animationManagers);
if (pNodeGraph && mActionManager->getAutoPlaySequenceId() != -1 && !jsControlled)
{
// Auto play animations
mActionManager->runAnimationsForSequenceIdTweenDuration(mActionManager->getAutoPlaySequenceId(), 0);
}
// Assign actionManagers to userObject
if(jsControlled) {
mNodesWithAnimationManagers = new CCArray();
mAnimationManagersForNodes = new CCArray();
}
CCDictElement* pElement = NULL;
CCDICT_FOREACH(animationManagers, pElement)
{
CCNode* pNode = (CCNode*)pElement->getIntKey();
CCBAnimationManager* manager = (CCBAnimationManager*)animationManagers->objectForKey((intptr_t)pNode);
pNode->setUserObject(manager);
if (jsControlled)
{
mNodesWithAnimationManagers->addObject(pNode);
mAnimationManagersForNodes->addObject(manager);
}
}
示例5: refresh_itemlist
bool ItemPicker::refresh_itemlist(){
do
{
m_iCurItem = -1;
m_iSum = 0;
m_viItemList.clear();
m_cdItemList = StateCenter::sharedStateCenter()->f_get_itemlist(2); //group = 2 || WalkMap Item | Usecase = 0b010
CC_BREAK_IF(m_cdItemList->count() < 1);
//int i = 0;
string t_sMask;
CCDictElement* pCe = NULL;
CCDICT_FOREACH(m_cdItemList,pCe){
t_sMask += CCString::createWithFormat("%d,",pCe->getIntKey())->getCString();
//m_viItemList.push_back((ItemCellData*) pCe->getObject());
}
t_sMask.erase(t_sMask.length()-1);
CCString* t_csSql = CCString::createWithFormat("select * from item_list where itemid IN (%s) and groupid = 2",t_sMask.c_str());
DBUtil::initDB("save.db");
vdata = DBUtil::getDataInfo(t_csSql->getCString(),NULL);
DBUtil::closeDB();
m_iSum = vdata.size();
CC_BREAK_IF(vdata.size() < 1);
for(int i = 0;i<m_iSum;i++){
map<string,string> t_ssm = (map<string,string>) vdata.at(i);
int item_id = stoi(t_ssm.at("itemid")); //PrimaryKey:ItemID
ItemCellData* t_icd = (ItemCellData*) m_cdItemList->objectForKey(item_id);
t_icd->name = t_ssm.at("name");
t_icd->icon_mask = t_ssm.at("icon");
if(item_id == m_iCItemID) m_iCurItem = i;
CCLOG(">Read for group 2 with itemid:%d.", item_id);
m_viItemList.push_back(t_icd);
}
if(m_iCurItem<0) m_iCurItem = 0;
return true;
} while (0);
示例6: doCallback
bool CallbackExplode::doCallback(GameObject * aGameObject,CCDictionary * dic,float dt) {
if (dic && aGameObject) {
//获得效果本身影响的范围
CCDictionary * property = (CCDictionary *)aGameObject->getValue(KStrProperty);
CCString * atkStr = (CCString *)property->objectForKey(KStrATK);
CCString * atkRangeStr = (CCString *)property->objectForKey(KStrATK_RANGE);
float atk_range_org = (atkRangeStr?atkRangeStr->floatValue():0) * 0.5;
float atk = atkStr? atkStr->floatValue() : 0;
//获得对应的效果播放的中心点
CCDictionary * pDict=(CCDictionary *)dic->objectForKey(KStrPosition);
CCString * paramStr=(CCString *)dic->objectForKey(KStrParam);
float scale = !paramStr ? 1.0 : paramStr->floatValue();
float atk_range = scale * atk_range_org;
CCPoint p = GameObject::dict2Point(pDict);
GameModle * _sharedInstance = GameModle::sharedInstance();
CCDictionary * objects = _sharedInstance->gameObjectsDict();
CCDictElement * pDictElement = NULL;
CCDICT_FOREACH(objects, pDictElement){
int32_t classid=pDictElement->getIntKey();
if(KNPCTypeId == GameObject::typeIdOfClassId(classid)){
CCSet * set=(CCSet*)pDictElement->getObject();
CCSetIterator iter;
for (iter = set->begin(); iter != set->end(); ++iter)
{
GameObject * tmp=(GameObject *)(*iter);
if (tmp->isActive()) {
float r = tmp->getContentSize().width * 0.5;
//检测可以攻击到泡泡
if(GameObject::isCircleContact(p,atk_range,tmp->getPosition(),r)){
//处理进入到攻击范围的泡泡
handleExplode(tmp,NULL,atk,aGameObject);
}
}
}
}
}
示例7: f_save_file
//////////////////////////////////////////////////////////////////////////
// XML读写
bool StateCenter::f_save_file(const char* psz){
do
{
GameManager::sharedLogicCenter()->PrepareSave();
TiXmlDocument *myDocument = new TiXmlDocument();
TiXmlDeclaration Declaration( "1.0","UTF-8", "yes" );
myDocument->InsertEndChild( Declaration );
TiXmlElement *RootElement = new TiXmlElement("Save");
myDocument->LinkEndChild(RootElement);
//////////////////////////////////////////////////////////////////////////
TiXmlElement *PackElement = new TiXmlElement("pack");
RootElement->LinkEndChild(PackElement);
PackElement->SetAttribute("type", "0");
TiXmlElement *PngElement = new TiXmlElement("png");
PackElement->LinkEndChild(PngElement);
PngElement->SetAttribute("type",m_iState);
PngElement->SetAttribute("content",m_sName.c_str());
PngElement->SetAttribute("jump",m_iJump);
PngElement->SetAttribute("olds",m_oldstate);
PngElement->SetAttribute("bgi",m_sBgi.c_str());
//[Error]CCLOG(">>Save to file.%s",m_sBgi.c_str());
PngElement->SetAttribute("tjump",m_iTJump);
for(map<string,int>::iterator it = TagMap.begin(); it != TagMap.end(); ++it){
if(it->second == 0) continue;
TiXmlElement *LockElement = new TiXmlElement("lock");
PngElement->LinkEndChild(LockElement);
LockElement->SetAttribute("name",it->first.c_str());
LockElement->SetAttribute("tag",it->second);
LockElement->SetAttribute("content",PathMap[it->first].c_str());
//[Error]CCLOG(">save for png by tag:%d",it->second);
CCSprite* t_ccs = (CCSprite*) GameManager::sharedLogicCenter()->te->getChildByTag(it->second);
LockElement->SetAttribute("x",((CCString*) CCString::createWithFormat("f%f",t_ccs->getPositionX()))->getCString());
LockElement->SetAttribute("y",((CCString*) CCString::createWithFormat("f%f",t_ccs->getPositionY()))->getCString());
LockElement->SetAttribute("angel",((CCString*) CCString::createWithFormat("f%f",t_ccs->getRotation()))->getCString());
}
//////////////////////////////////////////////////////////////////////////
PackElement = new TiXmlElement("pack");
RootElement->LinkEndChild(PackElement);
PackElement->SetAttribute("type",3);
CCDictElement* tCe;
CCDICT_FOREACH(m_cdItemList,tCe){
CCDictionary* t_caI = (CCDictionary*) tCe->getObject();
PngElement = new TiXmlElement("png");
PackElement->LinkEndChild(PngElement);
PngElement->SetAttribute("group",tCe->getIntKey());
CCDictElement* pElement = NULL;
CCDICT_FOREACH(t_caI,pElement)
{
ItemCellData* t_icad = (ItemCellData*) pElement->getObject();
TiXmlElement *LockElement = new TiXmlElement("lock");
PngElement->LinkEndChild(LockElement);
LockElement->SetAttribute("item",t_icad->type_id);
LockElement->SetAttribute("sum",t_icad->sum);
LockElement->SetAttribute("lock",t_icad->lock);
CCLOG(">Dic Each...");
}
}