void HelloWorld::update(float delta)
{
	if(m_bStart)
	{
		CCArmature *pHero = (CCArmature*)(m_pGameScene->getChildByTag(10005)->getComponent("CCArmature")->getNode());
		pHero->getParent()->setPositionX(pHero->getParent()->getPositionX() + m_fSpeed);
		CCArmature *pEnemy = (CCArmature*)(m_pGameScene->getChildByTag(10006)->getComponent("CCArmature")->getNode());

		if(ccpDistance(ccp(pHero->getParent()->getPositionX(), 0), ccp(pEnemy->getParent()->getPositionX(), 0)) < m_fAttackDis)
		{	
			pHero->getAnimation()->play("attack");
			pHero->getAnimation()->setMovementEventCallFunc(this,
                                                        movementEvent_selector(HelloWorld::animationEvent));
			m_bStart = false;
		}
	}

	if(m_bDead)
	{
		CCComRender *pUIRender = static_cast<CCComRender*>(m_pGameScene->getChildByTag(10007)->getComponent("GUIComponent"));
		UILayer *pUILayer = static_cast<UILayer*>(pUIRender->getNode());
		UILoadingBar *pHPLoadingBar = static_cast<UILoadingBar*>(pUILayer->getWidgetByName("hp02_LoadingBar"));
		UILoadingBar *pMPLoadingBar = static_cast<UILoadingBar*>(pUILayer->getWidgetByName("mp02_LoadingBar"));

		pHPLoadingBar->setPercent(m_fPercentage);
		pMPLoadingBar->setPercent(m_fPercentage);

		m_fPercentage -= 2.0f;
        if (m_fPercentage < 0.0f) {
            unscheduleUpdate();
        }
	}
	
}
Esempio n. 2
0
void ParticleComponentTest::defaultPlay()
{
	CCComRender* Particle = static_cast<CCComRender*>(m_rootNode->getChildByTag(10020)->getComponent("CCParticleSystemQuad"));
	CCActionInterval*  jump = CCJumpBy::create(5, ccp(-500,0), 50, 4);
	CCFiniteTimeAction*  action = CCSequence::create( jump, jump->reverse(), NULL);
	Particle->getNode()->runAction(action);
}
Esempio n. 3
0
/// 这里实现的是动画移动过程;
/// 重点:CCArmature *pButterFlyFish= (CCArmature *)(pFishRender->getNode()); 
void HelloWorld::update( float delta )
{
	 
	/// 获取节点信息 只有节点信息才是我们设置的信息
	CCNode* pFishNode = m_pLoginScene->getChildByTag(10009);
	CCPoint p1 = pFishNode->getPosition();	
	//获取comrender组件 
	CCComRender *pFishRender = (CCComRender*)(m_pLoginScene->getChildByTag(10009)->getComponent("CCArmature"));  
	//转换为armature  这里的armature是我们在动画中制作的相关数据了,因此下面我们要获得信息将会是我们在动画制作的数据
	/// 而不是在场景制作中的数据;
	CCArmature *pButterFlyFish= (CCArmature *)(pFishRender->getNode()); 
	/// 这里获得动画中的坐标
	CCPoint pt = pButterFlyFish->getPosition();

	if (!m_bDirection)
	{
		p1.x -= 2.0f;
		if (10 > p1.x)
		{
			m_bDirection = true;
		}
	}
	else
	{
		p1.x += 2.0f;
		if (900 < p1.x)
		{
			m_bDirection = false;
		}
	}
	pFishNode->setPosition(p1);
}
Esempio n. 4
0
void ArmatureComponentTest::defaultPlay()
{
	CCComRender *pBlowFish = static_cast<CCComRender*>(m_rootNode->getChildByTag(10007)->getComponent("CCArmature"));
	pBlowFish->getNode()->runAction(CCMoveBy::create(10.0f, ccp(-1000.0f, 0)));

	CCComRender *pButterflyfish = static_cast<CCComRender*>(m_rootNode->getChildByTag(10008)->getComponent("CCArmature"));
	pButterflyfish->getNode()->runAction(CCMoveBy::create(10.0f, ccp(-1000.0f, 0)));

}
CCArmature* SceneEditorTestLayer::getFish(int nTag, const char *pszName)
{
	if (m_pCurNode == NULL)
	{
		return NULL;
	}
	CCComRender *pFishRender = (CCComRender*)(m_pCurNode->getChildByTag(nTag)->getComponent(pszName));
	return (CCArmature *)(pFishRender->getRender());
}
Esempio n. 6
0
void UIComponentTest::defaultPlay()
{

	CCComRender *render = static_cast<CCComRender*>(m_rootNode->getChildByTag(10025)->getComponent("GUIComponent"));
	cocos2d::ui::TouchGroup* touchGroup = static_cast<cocos2d::ui::TouchGroup*>(render->getNode());
	UIWidget* widget = static_cast<UIWidget*>(touchGroup->getWidgetByName("Panel_154"));
	UIButton* button = static_cast<UIButton*>(widget->getChildByName("Button_156"));
	button->addTouchEventListener(this, toucheventselector(UIComponentTest::touchEvent));

}
Esempio n. 7
0
void ArmaturePlayAction::done()
{
	do 
	{
		CCNode *pNode = SceneReader::sharedSceneReader()->getNodeByTag(_nTag);
		CC_BREAK_IF(pNode == NULL);
		CCComRender *pRender = (CCComRender*)(pNode->getComponent(_comName.c_str()));
		CC_BREAK_IF(pRender == NULL);
		CCArmature *pAr = (CCArmature *)(pRender->getNode());
		CC_BREAK_IF(pAr == NULL);
		pAr->getAnimation()->play(_aniname.c_str());
	} while (0);
}
Esempio n. 8
0
void ArmatureActionState::removeAll()
{
	do 
	{
		CCNode *pNode = SceneReader::sharedSceneReader()->getNodeByTag(_nTag);
		CC_BREAK_IF(pNode == NULL);
		CCComRender *pRender = (CCComRender*)(pNode->getComponent(_ComName.c_str()));
		CC_BREAK_IF(pRender == NULL);
		CCArmature *pAr = (CCArmature *)(pRender->getNode());
		CC_BREAK_IF(pAr == NULL);
		TriggerMng::sharedTriggerMng()->removeArmatureMovementCallBack(pAr, this, movementEvent_selector(ArmatureActionState::animationEvent));
	} while (0);
}
Esempio n. 9
0
CCComRender* CCComRender::create(cocos2d::CCNode *pNode, const char *comName)
{
    CCComRender * pRet = new CCComRender(pNode, comName);
    if (pRet != NULL && pRet->init())
    {
        pRet->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(pRet);
    }
        return pRet;
}
Esempio n. 10
0
CCComRender* CCComRender::create(void)
{
    CCComRender * pRet = new CCComRender();
    if (pRet != NULL && pRet->init())
    {
        pRet->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(pRet);
    }
    return pRet;
}
void HelloWorld::animationEvent(CCArmature *pArmature,
					MovementEventType movementType, const char *movementID)
{
    CCComRender *render = (CCComRender*)(m_pGameScene->getChildByTag(10006)->getComponent("CCArmature"));
	CCArmature *pEnemy = (CCArmature*)(render->getNode());

	if (movementType == COMPLETE)
	{
		pEnemy->getAnimation()->play("death");
		pArmature->getAnimation()->setMovementEventCallFunc(NULL, NULL);
		m_bDead = true;
	}
	
}
Esempio n. 12
0
bool ArmatureActionState::init()
{
	do 
	{
		CCNode *pNode = SceneReader::sharedSceneReader()->getNodeByTag(_nTag);
		CC_BREAK_IF(pNode == NULL);
		CCComRender *pRender = (CCComRender*)(pNode->getComponent(_comName.c_str()));
		CC_BREAK_IF(pRender == NULL);
		CCArmature *pAr = (CCArmature *)(pRender->getNode());
		CC_BREAK_IF(pAr == NULL);
		TriggerMng::getInstance()->addArmatureMovementCallBack(pAr, this, movementEvent_selector(ArmatureActionState::animationEvent));
	} while (0);
	
	return true;
}
Esempio n. 13
0
void TmxMapComponentTest::defaultPlay()
{
	CCComRender *tmxMap = static_cast<CCComRender*>(m_rootNode->getChildByTag(10015)->getComponent("CCTMXTiledMap"));
	CCActionInterval *actionTo = CCSkewTo::create(2, 0.f, 2.f);
	CCActionInterval *rotateTo = CCRotateTo::create(2, 61.0f);
	CCActionInterval *actionScaleTo = CCScaleTo::create(2, -0.44f, 0.47f);

	CCActionInterval *actionScaleToBack = CCScaleTo::create(2, 1.0f, 1.0f);
	CCActionInterval *rotateToBack = CCRotateTo::create(2, 0);
	CCActionInterval *actionToBack = CCSkewTo::create(2, 0, 0);

	tmxMap->getNode()->runAction(CCSequence::create(actionTo, actionToBack, NULL));
	tmxMap->getNode()->runAction(CCSequence::create(rotateTo, rotateToBack, NULL));
	tmxMap->getNode()->runAction(CCSequence::create(actionScaleTo, actionScaleToBack, NULL));
}
Esempio n. 14
0
void UIComponentTest::touchEvent(CCObject *pSender, TouchEventType type)
{
	switch (type)
	{
	case TOUCH_EVENT_BEGAN:
		{
			CCComRender *pBlowFish = static_cast<CCComRender*>(m_rootNode->getChildByTag(10010)->getComponent("CCArmature"));
			pBlowFish->getNode()->runAction(CCMoveBy::create(10.0f, ccp(-1000.0f, 0)));

			CCComRender *pButterflyfish = static_cast<CCComRender*>(m_rootNode->getChildByTag(10011)->getComponent("CCArmature"));
			pButterflyfish->getNode()->runAction(CCMoveBy::create(10.0f, ccp(-1000.0f, 0)));
		}
		break;
	default:
		break;
	}
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
	m_fTime = 0.0f;
	m_bStart = false;
	m_bDead = false;
	m_fPercentage = 100.0f;
	m_fSpeed = 4.0f;
	m_fAttackDis = 120.0f;

	m_pGameScene = NULL;
    
	CCNode *pGameScene = SceneReader::sharedSceneReader()->createNodeWithSceneFile("FightScene.json");
	m_pGameScene = pGameScene;
	this->addChild(pGameScene);

    CCComRender *render = (CCComRender*)(m_pGameScene->getChildByTag(10005)->getComponent("CCArmature"));
                                         
    CCArmature *pArmature = (CCArmature*)(render->getNode());
	
    pArmature->getAnimation()->play("run");
	
    m_bStart = true;

    CCMenuItemFont *itemBack = CCMenuItemFont::create("End", this, menu_selector(HelloWorld::menuCloseCallback));
    itemBack->setColor(ccc3(255, 255, 255));
    itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
    CCMenu *menuBack = CCMenu::create(itemBack, NULL);
    menuBack->setPosition(CCPointZero);
    menuBack->setZOrder(4);
    
    this->addChild(menuBack);

	scheduleUpdate();

    return true;
}
    CCNode* CCJsonReader::createObject(cs::CSJsonDictionary * inputFiles, CCNode* parenet)
    {
        const char* className = inputFiles->getItemStringValue("classname"); 

        if(strcmp(className, "CCNode") == 0)
        {
            CCNode* gb = NULL;
            if(NULL == parenet)
            {
                gb = CCNode::create();
            }
            else
            {
                gb = CCNode::create();
                parenet->addChild(gb);
            }
            
            setPropertyFromJsonDict(gb, inputFiles);
    
            int count = inputFiles->getArrayItemCount("components");
            for (int i = 0; i < count; i++)
            {
                cs::CSJsonDictionary * subDict = inputFiles->getSubItemFromArray("components", i);
                if (!subDict)
                   break;
                const char *comName = subDict->getItemStringValue("classname");
                const char *file = subDict->getItemStringValue("file");
                const char *pComName = subDict->getItemStringValue("name");
                if (file == NULL || strcmp(file, "") == 0)
                {
                    continue;
                }
                CCAssert(file != NULL, "file must be not NULL!");
                std::string pPath = cocos2d::CCFileUtils::sharedFileUtils()->fullPathForFilename(file);

                if (comName != NULL && strcmp(comName, "CCSprite") == 0)
                {
                    cocos2d::CCSprite *pSprite = CCSprite::create(pPath.c_str());
					
                    CCComRender *pRender = CCComRender::create(pSprite, "CCSprite");
                    if (pComName != NULL)
                    {
                        pRender->setName(pComName);
                    }
                    
                    gb->addComponent(pRender);
                }
                else if(comName != NULL && strcmp(comName, "CCTMXTiledMap") == 0)
                {
                    cocos2d::CCTMXTiledMap *pTmx = CCTMXTiledMap::create(pPath.c_str());
                    CCComRender *pRender = CCComRender::create(pTmx, "CCTMXTiledMap");
                    if (pComName != NULL)
                    {
                        pRender->setName(pComName);
                    }
                    gb->addComponent(pRender);
                }
                else if(comName != NULL && strcmp(comName, "CCParticleSystemQuad") == 0)
                {
                    std::string::size_type pos =  pPath.find(".plist");
                    if (pos  == pPath.npos)
                    {
                        continue;
                    }
                    cocos2d::CCParticleSystemQuad *pParticle = CCParticleSystemQuad::create(pPath.c_str());

					pParticle->setPosition(0, 0);
                    CCComRender *pRender = CCComRender::create(pParticle, "CCParticleSystemQuad");
                    if (pComName != NULL)
                    {
                        pRender->setName(pComName);
                    }
                    gb->addComponent(pRender);
                }
                else if(comName != NULL && strcmp(comName, "CCArmature") == 0)
                {
                    std::string reDir = pPath;
                    std::string file_path = "";
                    size_t pos = reDir.find_last_of('/');
                    if (pos != std::string::npos)
                    {
                        file_path = reDir.substr(0, pos+1);
                    }
                    unsigned long size = 0;
                    const char *des = (char*)(cocos2d::CCFileUtils::sharedFileUtils()->getFileData(pPath.c_str(),"r" , &size));
			        cs::CSJsonDictionary *jsonDict = new cs::CSJsonDictionary();
			        jsonDict->initWithDescription(des);
                    if(NULL == des || strcmp(des, "") == 0)
                    {
                        CCLog("read json file[%s] error!\n", pPath.c_str());
                    }
                    
                    int childrenCount = DICTOOL->getArrayCount_json(jsonDict, "armature_data");
                    cs::CSJsonDictionary* subData = DICTOOL->getDictionaryFromArray_json(jsonDict, "armature_data", 0);
                    const char *name = DICTOOL->getStringValue_json(subData, "name");

                    childrenCount = DICTOOL->getArrayCount_json(jsonDict, "config_file_path");
                    for (int i = 0; i < childrenCount; ++i)
                    {
                        const char* plist = DICTOOL->getStringValueFromArray_json(jsonDict, "config_file_path", i);
                        std::string plistpath;
                        plistpath += file_path;
                        plistpath.append(plist);
                        cocos2d::CCDictionary *root = CCDictionary::createWithContentsOfFile(plistpath.c_str());
                        CCDictionary* metadata = DICTOOL->getSubDictionary(root, "metadata");
                        const char* textureFileName = DICTOOL->getStringValue(metadata, "textureFileName");

                        std::string textupath;
                        textupath += file_path;
                        textupath.append(textureFileName);

                        CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo(textupath.c_str(), plistpath.c_str(), pPath.c_str());
                        
                    }
                    
                    CCArmature *pAr = CCArmature::create(name);
                    CCComRender *pRender = CCComRender::create(pAr, "CCArmature");
                    if (pComName != NULL)
                    {
                        pRender->setName(pComName);
                    }
                    gb->addComponent(pRender);

                    CC_SAFE_DELETE(jsonDict);
                }
                else if(comName != NULL && strcmp(comName, "CCComAudio") == 0)
                {
                    CCComAudio *pAudio = CCComAudio::create();
                    pAudio->preloadEffect(pPath.c_str());
                    gb->addComponent(pAudio);
                }
                else if(comName != NULL && strcmp(comName, "CCComAttribute") == 0)
                {
                    CCComAttribute *pAttribute = CCComAttribute::create();
                    gb->addComponent(pAttribute);
                }
                else if (comName != NULL && strcmp(comName, "CCBackgroundAudio") == 0)
                {
                    CCComAudio *pAudio = CCComAudio::create();
                    pAudio->preloadBackgroundMusic(pPath.c_str());
					pAudio->setFile(pPath.c_str());
					bool bLoop = subDict->getItemIntValue("loop", 0);
					pAudio->setIsLoop(bLoop);
                    gb->addComponent(pAudio);
                }
				else if(comName != NULL && strcmp(comName, "GUIComponent") == 0)
				{
					cocos2d::extension::UILayer *pLayer = cocos2d::extension::UILayer::create();
					UIWidget* widget=cocos2d::extension::UIHelper::instance()->createWidgetFromJsonFile(pPath.c_str());
					pLayer->addWidget(widget);
					CCComRender *pRender = CCComRender::create(pLayer, "GUIComponent");
					if (pComName != NULL)
					{
						pRender->setName(pComName);
					}
					gb->addComponent(pRender);
				}
                
                CC_SAFE_DELETE(subDict);
            }

            for (int i = 0; i < inputFiles->getArrayItemCount("gameobjects"); i++)
            {
                cs::CSJsonDictionary * subDict = inputFiles->getSubItemFromArray("gameobjects", i);
                if (!subDict)
                {
                    break;
                }
                createObject(subDict, gb);
                CC_SAFE_DELETE(subDict);
            }
            
            return gb;
        }
        
        return NULL;
    }
Esempio n. 17
0
void EffectComponentTest::defaultPlay()
{
	CCComRender *pRender = static_cast<CCComRender*>(m_rootNode->getChildByTag(10015)->getComponent("CCArmature"));
	CCArmature *pAr = static_cast<CCArmature*>(pRender->getNode());
	pAr->getAnimation()->setMovementEventCallFunc(this, movementEvent_selector(EffectComponentTest::animationEvent));
}
Esempio n. 18
0
	CCNode* SceneReader::createObject(const rapidjson::Value &root, cocos2d::CCNode* parent)
    {
        const char *className = DICTOOL->getStringValue_json(root, "classname"); //inputFiles->getItemStringValue("classname");
        if(strcmp(className, "CCNode") == 0)
        {
            CCNode* gb = NULL;
            if(NULL == parent)
            {
                gb = CCNode::create();
            }
            else
            {
                gb = CCNode::create();
                parent->addChild(gb);
            }
            
            setPropertyFromJsonDict(root, gb);
    
            int count = DICTOOL->getArrayCount_json(root, "components");
            for (int i = 0; i < count; i++)
            {
                const rapidjson::Value &subDict = DICTOOL->getSubDictionary_json(root, "components", i);
                if (!DICTOOL->checkObjectExist_json(subDict))
                {
                    break;
                }

                const char *comName = DICTOOL->getStringValue_json(subDict, "classname");
				const char *pComName = DICTOOL->getStringValue_json(subDict, "name");
				const rapidjson::Value &fileData = DICTOOL->getSubDictionary_json(subDict, "fileData");
                std::string pPath;
                std::string pPlistFile;
				int nResType = 0;
				//if (fileData != NULL)
                if (DICTOOL->checkObjectExist_json(fileData))
                {
					const char *file = DICTOOL->getStringValue_json(fileData, "path");
					nResType = DICTOOL->getIntValue_json(fileData, "resourceType", - 1);
					const char *plistFile = DICTOOL->getStringValue_json(fileData, "plistFile");
					if (file != NULL)
					{
						pPath.append(cocos2d::CCFileUtils::sharedFileUtils()->fullPathForFilename(file));
					}

					if (plistFile != NULL)
					{
						pPlistFile.append(cocos2d::CCFileUtils::sharedFileUtils()->fullPathForFilename(plistFile));
					}
                }

                if (comName != NULL && strcmp(comName, "CCSprite") == 0)
                {
					cocos2d::CCSprite *pSprite = NULL;

					if (nResType == 0)
					{
						if (pPath.find(".png") == pPath.npos)
						{
							continue;
						}
						pSprite = CCSprite::create(pPath.c_str());
					}
					else if (nResType == 1)
					{
						std::string pngFile = pPlistFile;
						std::string::size_type pos = pngFile.find(".plist");
						if (pos  == pPath.npos)
						{
							continue;
						}
						pngFile.replace(pos, pngFile.length(), ".png");
						CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(pPlistFile.c_str(), pngFile.c_str());
						pSprite = CCSprite::createWithSpriteFrameName(pPath.c_str());
					}
					else
					{
						continue;
					}
					
                    CCComRender *pRender = CCComRender::create(pSprite, "CCSprite");
                    if (pComName != NULL)
                    {
                        pRender->setName(pComName);
                    }
                    
                    gb->addComponent(pRender);
					if (_pListener && _pfnSelector)
					{
						(_pListener->*_pfnSelector)(pSprite, (void*)(&subDict));
					}
                }
                else if(comName != NULL && strcmp(comName, "CCTMXTiledMap") == 0)
                {
					cocos2d::CCTMXTiledMap *pTmx = NULL;
					if (nResType == 0)
					{
						if (pPath.find(".tmx") == pPath.npos)
						{
							continue;
						}
						pTmx = CCTMXTiledMap::create(pPath.c_str());
					}
					else
					{
						continue;
					}

                    CCComRender *pRender = CCComRender::create(pTmx, "CCTMXTiledMap");
                    if (pComName != NULL)
                    {
                        pRender->setName(pComName);
                    }
                    gb->addComponent(pRender);
					if (_pListener && _pfnSelector)
					{
						(_pListener->*_pfnSelector)(pTmx, (void*)(&subDict));
					}
                }
                else if(comName != NULL && strcmp(comName, "CCParticleSystemQuad") == 0)
                {
                    std::string::size_type pos =  pPath.find(".plist");
                    if (pos  == pPath.npos)
                    {
                        continue;
                    }

					cocos2d::CCParticleSystemQuad *pParticle = NULL;
					if (nResType == 0)
					{
						pParticle = CCParticleSystemQuad::create(pPath.c_str());
					}
					else
					{
						CCLog("unknown resourcetype on CCParticleSystemQuad!");
					}

					pParticle->setPosition(0, 0);
                    CCComRender *pRender = CCComRender::create(pParticle, "CCParticleSystemQuad");
                    if (pComName != NULL)
                    {
                        pRender->setName(pComName);
                    }
                    gb->addComponent(pRender);
					if (_pListener && _pfnSelector)
					{
						(_pListener->*_pfnSelector)(pParticle, (void*)(&subDict));
					}
                }
                else if(comName != NULL && strcmp(comName, "CCArmature") == 0)
                {
					if (nResType != 0)
					{
						continue;
					}
                    std::string reDir = pPath;
                    std::string file_path = "";
                    size_t pos = reDir.find_last_of('/');
                    if (pos != std::string::npos)
                    {
                        file_path = reDir.substr(0, pos+1);
                    }
                    
                    rapidjson::Document jsonDict;
                    if(!readJson(pPath.c_str(), jsonDict))
                    {
                        CCLog("read json file[%s] error!\n", pPath.c_str());
                        continue;
                    }
                    
                    
                    int childrenCount = DICTOOL->getArrayCount_json(jsonDict, "armature_data");
                    const rapidjson::Value &subData = DICTOOL->getDictionaryFromArray_json(jsonDict, "armature_data", 0);
                    const char *name = DICTOOL->getStringValue_json(subData, "name");

                    childrenCount = DICTOOL->getArrayCount_json(jsonDict, "config_file_path");
                    for (int i = 0; i < childrenCount; ++i)
                    {
                        const char* plist = DICTOOL->getStringValueFromArray_json(jsonDict, "config_file_path", i);
                        if (plist == NULL)
                        {
                            continue;
                        }
                        std::string plistpath;
                        plistpath += file_path;
                        plistpath.append(plist);
                        cocos2d::CCDictionary *root = CCDictionary::createWithContentsOfFile(plistpath.c_str());
                        CCDictionary* metadata = DICTOOL->getSubDictionary(root, "metadata");
                        const char* textureFileName = DICTOOL->getStringValue(metadata, "textureFileName");

                        std::string textupath;
                        textupath += file_path;
                        textupath.append(textureFileName);

                        CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo(textupath.c_str(), plistpath.c_str(), pPath.c_str());
                        
                    }
                    
                    CCArmature *pAr = CCArmature::create(name);
                    CCComRender *pRender = CCComRender::create(pAr, "CCArmature");
                    if (pComName != NULL)
                    {
                        pRender->setName(pComName);
                    }
                    gb->addComponent(pRender);
					const char *actionName = DICTOOL->getStringValue_json(subDict, "selectedactionname"); 
					if (actionName != NULL && pAr->getAnimation() != NULL)
					{
						pAr->getAnimation()->play(actionName);
					}
					if (_pListener && _pfnSelector)
					{
						(_pListener->*_pfnSelector)(pAr, (void*)(&subDict));
					}
                }
                else if(comName != NULL && strcmp(comName, "CCComAudio") == 0)
                {
					CCComAudio *pAudio = NULL;
					if (nResType == 0)
					{
						pAudio = CCComAudio::create();
					}
					else
					{
						continue;
					}
                    pAudio->preloadEffect(pPath.c_str());
                    gb->addComponent(pAudio);
					if (_pListener && _pfnSelector)
					{
						(_pListener->*_pfnSelector)(pAudio, (void*)(&subDict));
					}
                }
                else if(comName != NULL && strcmp(comName, "CCComAttribute") == 0)
                {
                    CCComAttribute *pAttribute = NULL;
					if (nResType == 0)
					{
						pAttribute = CCComAttribute::create();
						unsigned long size = 0;
						const char* pData = 0;
						pData = (char*)(cocos2d::CCFileUtils::sharedFileUtils()->getFileData(pPath.c_str(), "r", &size));
						if(pData != NULL && strcmp(pData, "") != 0)
						{
                            pAttribute->parse(pData);
						}
					}
					else
					{
						CCLog("unknown resourcetype on CCComAttribute!");
						continue;
					}
                    gb->addComponent(pAttribute);
					if (_pListener && _pfnSelector)
					{
						(_pListener->*_pfnSelector)(pAttribute, (void*)(&subDict));
					}
                }
                else if (comName != NULL && strcmp(comName, "CCBackgroundAudio") == 0)
                {
					CCComAudio *pAudio = NULL;
					if (nResType == 0)
					{
						pAudio = CCComAudio::create();
					}
					else
					{
						continue;
					}
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
                    // no MP3 support for CC_PLATFORM_WP8
                    std::string::size_type pos = pPath.find(".mp3");
					if (pos  == pPath.npos)
					{
						continue;
					}
					pPath.replace(pos, pPath.length(), ".wav");
#endif
                    pAudio->preloadBackgroundMusic(pPath.c_str());
					pAudio->setFile(pPath.c_str());
					bool bLoop = (bool)(DICTOOL->getIntValue_json(subDict, "loop"));
					pAudio->setLoop(bLoop);
                    gb->addComponent(pAudio);
					if (_pListener && _pfnSelector)
					{
						(_pListener->*_pfnSelector)(pAudio, (void*)(&subDict));
					}
					pAudio->playBackgroundMusic(pPath.c_str(), bLoop);
                }
				else if(comName != NULL && strcmp(comName, "GUIComponent") == 0)
				{
					cocos2d::extension::UILayer *pLayer = cocos2d::extension::UILayer::create();
                    pLayer->scheduleUpdate();
                    UIWidget* widget = cocos2d::extension::GUIReader::shareReader()->widgetFromJsonFile(pPath.c_str());
					pLayer->addWidget(widget);
					CCComRender *pRender = CCComRender::create(pLayer, "GUIComponent");
					if (pComName != NULL)
					{
					pRender->setName(pComName);
					}
					gb->addComponent(pRender);
					if (_pListener && _pfnSelector)
					{
						(_pListener->*_pfnSelector)(pLayer, (void*)(&subDict));
					}
				}
            }

            int length = DICTOOL->getArrayCount_json(root, "gameobjects");
            for (int i = 0; i < length; ++i)
            {
                const rapidjson::Value &subDict = DICTOOL->getSubDictionary_json(root, "gameobjects", i);
                if (!DICTOOL->checkObjectExist_json(subDict))
                {
                    break;
                }
                createObject(subDict, gb);
            }
            
            return gb;
        }
        
        return NULL;
    }