当前位置: 首页>>代码示例>>C++>>正文


C++ CCDictElement类代码示例

本文整理汇总了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.");
		}
	}
开发者ID:digitalassetgroup,项目名称:-BIBS-Game,代码行数:27,代码来源:GAFAsset.cpp

示例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);
开发者ID:frankiefanstar,项目名称:cocotd,代码行数:60,代码来源:BattleMap.cpp

示例3: addTexts

void YHLanguageManager::addTexts(cocos2d::CCDictionary * dict)
{
    CCDictElement * e = nullptr;
    CCDICT_FOREACH(dict, e)
    {
        m_dict->setObject(e->getObject(), e->getStrKey());
    }
开发者ID:JackKa325,项目名称:cocos2d-x-tools,代码行数:7,代码来源:YHLanguageManager.cpp

示例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>";
}
开发者ID:weimingtom,项目名称:guichan_cocos2dx,代码行数:28,代码来源:CCDataVisitor.cpp

示例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);
开发者ID:raymondma,项目名称:EliminationPlane,代码行数:32,代码来源:CCDictionarySaver.cpp

示例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();

        }
开发者ID:ourgames,项目名称:dc208,代码行数:60,代码来源:ShowStatusItemCommand.cpp

示例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);
    }
开发者ID:digitalassetgroup,项目名称:-BIBS-Game,代码行数:8,代码来源:CCJSONConverter.cpp

示例8:

CCBAnimationManager::~CCBAnimationManager()
{
    CCDictElement *pElement = NULL;
    CCDICT_FOREACH(mNodeSequences, pElement)
    {
        CCNode *node = (CCNode*)pElement->getIntKey();
        node->release();
    }
开发者ID:louis2001,项目名称:FMTeamTest,代码行数:8,代码来源:CCBAnimationManager.cpp

示例9: releaseMembers

void CCBProxy::releaseMembers(){
	CCDictElement *e;
	CCNode *n;
	CCDICT_FOREACH(_memVars, e){
		n = (CCNode *)e->getObject();
		n->removeFromParentAndCleanup(true);
		n->autorelease();
	}
开发者ID:Zhangzhiyi,项目名称:cocos2dx-LuaProxy,代码行数:8,代码来源:CCBProxy.cpp

示例10: displayTimers

void CCProfiler::displayTimers()
{
    CCDictElement* pElement = NULL;
    CCDICT_FOREACH(m_pActiveTimers, pElement)
    {
        CCProfilingTimer* timer = (CCProfilingTimer*)pElement->getObject();
        CCLog("%s", timer->description());
    }
开发者ID:1085075003,项目名称:quick-cocos2d-x,代码行数:8,代码来源:CCProfiling.cpp

示例11: CCDictionary

CCDictionary* CCTextureCache::snapshotTextures()
{ 
    CCDictionary* pRet = new CCDictionary();
    CCDictElement* pElement = NULL;
    CCDICT_FOREACH(m_pTextures, pElement)
    {
        pRet->setObject(pElement->getObject(), pElement->getStrKey());
    }
开发者ID:walklook,项目名称:ThreadTile,代码行数:8,代码来源:CCTextureCache.cpp

示例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);
	}
开发者ID:bontey,项目名称:cocos2d-x-tools,代码行数:9,代码来源:YHEffectGenerator.cpp

示例13: onUpdate

void BZGameMenu::onUpdate()
{
	CCDictElement* pElement = NULL;
	CCDICT_FOREACH(_bars, pElement)
	{
		BZGameMenuBar* pbar = (BZGameMenuBar*)pElement->getObject();
		_Assert(pbar);
		pbar->onUpdate();
	}
开发者ID:sparkma,项目名称:Buzzle,代码行数:9,代码来源:BZGameMenu.cpp

示例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());
	}
开发者ID:newcl,项目名称:boom,代码行数:10,代码来源:BBTouchManager.cpp

示例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());
    }
开发者ID:LEAAYang,项目名称:Nextpeer-Cocos2dx-Sample,代码行数:10,代码来源:MultiplayerGameState.cpp


注:本文中的CCDictElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。