ValueMap dict = FileUtils::getInstance()->getValueMapFromFile("loading_xml.xml"); std::string pStrLoading = dict.at("loading_now").asString(); Label * pLabelLoading = Label::createWithSystemFont(pStrLoading,"Arial",10); CC_BREAK_IF(pLabelLoading==NULL); pLabelLoading->setPosition(pProLoadRec->getPosition()); addChild(pLabelLoading,enZOrderMid+2,enTagLabel);
CCDictionary *pDicLang = CCDictionary::createWithContentsOfFile("ui_xml/loading_xml.xml"); CC_BREAK_IF(pDicLang==NULL); //加载信息label CCString *pStrLoading = dynamic_cast<CCString*>(pDicLang->objectForKey("loading_now")); CCLabelTTF * pLabelLoading = CCLabelTTF::create(pStrLoading->m_sString.c_str(),10); CC_BREAK_IF(pLabelLoading==NULL); pLabelLoading->setPosition(pProLoadRec->getPosition()); addChild(pLabelLoading,enTagLabel);
<?xml version="1.0" encoding="UTF-8"?> <plist> <dict> <!--正在加载 --> <key>loading_now</key> <string>正在加载配置......</string> <!--加载完成 --> <key>loading_end</key> <string>加载配置完成</string> </dict> </plist>
-------------------------------------------------------------------