本文整理汇总了C++中CCDictElement类的典型用法代码示例。如果您正苦于以下问题:C++ CCDictElement类的具体用法?C++ CCDictElement怎么用?C++ CCDictElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCDictElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CCArray * GAFAsset::objectStatesFromConfigFrame(CCDictionary * configFrame)
{
if (!configFrame)
{
return NULL;
}
CCDictionary * stateNodes = (CCDictionary *) configFrame->objectForKey(kFrameStateKey);
if (!stateNodes)
{
return NULL;
}
CCArray *states = CCArray::createWithCapacity(stateNodes->count());
CCDictElement* pElement = NULL;
CCDICT_FOREACH(stateNodes, pElement)
{
CCDictionary * stateDictionary = (CCDictionary *)pElement->getObject();
GAFSubobjectState * state = GAFSubobjectState::createWithStateDictionary(stateDictionary, pElement->getStrKey());
if (state)
{
states->addObject(state);
}
else
{
CCLOGINFO("GAFSubobjectState cannot be created. Ignoring.");
}
}
示例2: f_load_entile
bool BattleMap::f_load_entile()
{
do
{
b2CircleShape circle;
b2BodyDef ballBodyDef;
ballBodyDef.type = b2_dynamicBody;
circle.m_radius = 16.0/PTM_RATIO;
b2FixtureDef ballShapeDef;
ballShapeDef.shape = &circle;
ballShapeDef.density = 1.0f;
ballShapeDef.friction = 1.0f;
ballShapeDef.restitution = 0.0f;
ballShapeDef.isSensor = true; // 将碰撞形状改为sensor不会提高多少效率却会破坏map原本事件机制。
//// b2body准备工作
//////////////////////////////////////////////////////////////////////////
CCSize ts = m_tilemap->getTileSize();
b2PolygonShape boxShape;
float hbw = (ts.width-1)/( PTM_RATIO * 4);
float hbh = (ts.height-1)/( PTM_RATIO);
hbh *= 1.2;
boxShape.SetAsBox(hbw,hbh,b2Vec2(0,hbh),0);
CCDictElement* cde = NULL;
CCDICT_FOREACH(m_itemlist,cde){
EChesses* t_ec = (EChesses*) cde->getObject();
t_ec->initFiles("grossinis_sister2.png");
CCPoint d = m_getViewc(t_ec->pos);
t_ec->m_sprite->setAnchorPoint(ccp(0,0));
t_ec->b_Re = true;
addChild(t_ec->m_sprite);
ballBodyDef.position.Set((dtx+d.x)/PTM_RATIO, (d.y+dty)/PTM_RATIO);
_body = _world->CreateBody(&ballBodyDef);
_body->SetFixedRotation(true);
_body->CreateFixture(&ballShapeDef);
t_ec->m_body = _body;
_body->SetUserData(t_ec);
b2FixtureDef boxFixtureDef;
boxFixtureDef.shape = &boxShape;
boxFixtureDef.density = 1;
boxFixtureDef.filter.categoryBits = 0x0002;
boxFixtureDef.filter.maskBits = 0x0001;
boxFixtureDef.isSensor = true;
_body->CreateFixture(&boxFixtureDef);
}
// EChesses in BattleMap has its own logic, so a logic based on sensor is no longer needed.
return true;
} while (0);
示例3: addTexts
void YHLanguageManager::addTexts(cocos2d::CCDictionary * dict)
{
CCDictElement * e = nullptr;
CCDICT_FOREACH(dict, e)
{
m_dict->setObject(e->getObject(), e->getStrKey());
}
示例4: setIndentLevel
void CCPrettyPrinter::visit(const CCDictionary *p)
{
_result += "\n";
_result += _indentStr;
_result += "<dict>\n";
setIndentLevel(_indentLevel+1);
CCDictElement* element;
bool bFirstElement = true;
char buf[1000] = {0};
CCDICT_FOREACH(p, element)
{
if (!bFirstElement) {
_result += "\n";
}
sprintf(buf, "%s%s: ", _indentStr.c_str(),element->getStrKey());
_result += buf;
CCPrettyPrinter v(_indentLevel);
element->getObject()->acceptVisitor(v);
_result += v.getResult();
bFirstElement = false;
}
setIndentLevel(_indentLevel-1);
_result += "\n";
_result += _indentStr;
_result += "</dict>";
}
示例5: xmlNewNode
bool CCDictionarySaver::saveDictionary(CCDictionary* pDict, xmlNodePtr node)
{
do
{
xmlNodePtr dict_node = xmlNewNode(NULL, DICT_NODE_DICT);
CC_BREAK_IF(!dict_node);
CC_BREAK_IF(!xmlAddChild(node, dict_node));
CCDictElement* pElem;
CCDICT_FOREACH(pDict, pElem)
{
saveKey(pElem->getStrKey(), dict_node);
CCObject* obj = pElem->getObject();
if (dynamic_cast<CCString*>(obj))
{
CCString* s = dynamic_cast<CCString*>(obj);
CC_BREAK_IF(!saveString(s->getCString(), dict_node));
}
else if (dynamic_cast<CCDictionary*>(obj))
{
CC_BREAK_IF(!saveDictionary(dynamic_cast<CCDictionary*>(obj), dict_node));
}
else if (dynamic_cast<CCArray*>(obj))
{
CC_BREAK_IF(!saveArray(dynamic_cast<CCArray*>(obj), dict_node));
}
}
return true;
} while (false);
示例6: _dict
void StatusPush::handleResponse(__Dictionary* dict)
{
if (!dict)
{
return;
}
__Dictionary* params = _dict(dict->objectForKey("params"));
if (params->objectForKey("oldStatus")) {//删除该状态的作用
int reStatusId = params->valueForKey("oldStatus")->intValue();
if (GlobalData::shared()->statusMap.find(reStatusId) != GlobalData::shared()->statusMap.end()) {
GlobalData::shared()->statusMap[reStatusId] = 0;
}
}
// int tempTime = 0;
if (params->objectForKey("effectState")) {
auto stateDict = _dict(params->objectForKey("effectState"));
CCDictElement* element;
CCDICT_FOREACH(stateDict, element)
{
string key = element->getStrKey();
// int effectId = atoi(key.c_str());
double time = stateDict->valueForKey(key)->doubleValue()/1000;
if (time>0) {
time = GlobalData::shared()->changeTime(time);
}
if (key!="startTime") {
GlobalData::shared()->statusMap[atoi(key.c_str())] = -1;//time;
// tempTime = time;
}
map<int, CCDictionary* >::iterator it = ToolController::getInstance()->m_statusItems.find(100);
CCObject* obj = element->getObject();
CCString* str = (CCString*)obj;
if(it!=ToolController::getInstance()->m_statusItems.end()){
auto dic = it->second;
if(!dic->objectForKey("startTime")){
dic->setObject(CCString::create(CC_ITOA(WorldController::getInstance()->getTime())), "startTime");
}else if(key!="" && key!="startTime"){
dic->setObject(CCString::create(str->getCString()), "endTime");
}else if(key=="startTime"){
dic->setObject(CCString::create(str->getCString()), "startTime");
}
ToolController::getInstance()->m_statusItems[100] = dic;
}else{
auto infoDic = CCDictionary::create();
infoDic->retain();
if(key!="" && key!="startTime"){
infoDic->setObject(CCString::create(str->getCString()), "endTime");
}else if(key=="startTime"){
infoDic->setObject(CCString::create(str->getCString()), "startTime");
}
ToolController::getInstance()->m_statusItems[100] = infoDic;
}
ToolController::getInstance()->checkMaincityCustom();
}
示例7: convertDictionaryToJson
void CCJSONConverter::convertDictionaryToJson(CCDictionary *dictionary, cJSON *json)
{
CCDictElement * pElement = NULL;
CCDICT_FOREACH(dictionary, pElement){
CCObject * obj = pElement->getObject();
cJSON * jsonItem = getObjJson(obj);
cJSON_AddItemToObject(json, pElement->getStrKey(), jsonItem);
}
示例8:
CCBAnimationManager::~CCBAnimationManager()
{
CCDictElement *pElement = NULL;
CCDICT_FOREACH(mNodeSequences, pElement)
{
CCNode *node = (CCNode*)pElement->getIntKey();
node->release();
}
示例9: releaseMembers
void CCBProxy::releaseMembers(){
CCDictElement *e;
CCNode *n;
CCDICT_FOREACH(_memVars, e){
n = (CCNode *)e->getObject();
n->removeFromParentAndCleanup(true);
n->autorelease();
}
示例10: displayTimers
void CCProfiler::displayTimers()
{
CCDictElement* pElement = NULL;
CCDICT_FOREACH(m_pActiveTimers, pElement)
{
CCProfilingTimer* timer = (CCProfilingTimer*)pElement->getObject();
CCLog("%s", timer->description());
}
示例11: CCDictionary
CCDictionary* CCTextureCache::snapshotTextures()
{
CCDictionary* pRet = new CCDictionary();
CCDictElement* pElement = NULL;
CCDICT_FOREACH(m_pTextures, pElement)
{
pRet->setObject(pElement->getObject(), pElement->getStrKey());
}
示例12: addEffectDefiner
void YHEffectFactory::addEffectDefiner(CCDictionary * dict)
{
CCDictElement * e = NULL;
CCDICT_FOREACH(dict, e)
{
YHEffectDefiner * definer = new YHEffectDefiner((CCDictionary *)e->getObject());
definer->autorelease();
addEffectDefiner(e->getStrKey(), definer);
}
示例13: onUpdate
void BZGameMenu::onUpdate()
{
CCDictElement* pElement = NULL;
CCDICT_FOREACH(_bars, pElement)
{
BZGameMenuBar* pbar = (BZGameMenuBar*)pElement->getObject();
_Assert(pbar);
pbar->onUpdate();
}
示例14: saveTouches
void BBTouchManager::saveTouches()
{
CCDictElement* pElement;
BBTouchInfo* touchInfo = BBTouchInfo::create();
CCDICT_FOREACH(m_pTouches, pElement)
{
CCTouch* v = (CCTouch*)pElement->getObject();
touchInfo->touches.push_back(v->getLocation());
}
示例15: getAllOpponents
CCArray* MultiplayerGameState::getAllOpponents()
{
if (_opponentsSprite == NULL || _opponentsSprite->count() <= 0) return NULL;
CCArray* opponents = CCArray::createWithCapacity(_opponentsSprite->count());
CCDictElement* dictElement = NULL;
CCDICT_FOREACH(_opponentsSprite, dictElement)
{
opponents->addObject((Opponent*)dictElement->getObject());
}