m_pUIlayer = UILayer::create(); addChild(m_pUIlayer,3); //加入背景json文件,即背景地图 m_pWidget = static_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile("MyGameMap_4/MyGameMap_1.ExportJson")); m_pUIlayer->addWidget(m_pWidget); CCSize screenSize = CCDirector::sharedDirector()->getWinSize(); CCSize rootSize = m_pWidget->getSize(); m_pUIlayer->setPosition(CCPoint((screenSize.width - rootSize.width) / 2,(screenSize.height - rootSize.height) / 2));//操作部分CCSize size = CCDirector::sharedDirector()->getWinSize(); m_pUIlayer->setScale(0.5); CCActionInterval* actionTo = CCMoveTo::create(1.0f,ccp(size.width,size.height)); m_pUIlayer->runAction(actionTo);