change read name

This commit is contained in:
2youyou2 2014-06-12 19:12:05 +08:00
parent ea7e24ba24
commit eb2e973e07
1 changed files with 30 additions and 27 deletions

View File

@ -424,35 +424,38 @@ Node* NodeCache::loadParticle(const rapidjson::Value& json)
cocos2d::Node* NodeCache::loadWidget(const rapidjson::Value& json)
{
const char* classname = DICTOOL->getStringValue_json(json, CLASSNAME);
const char* str = DICTOOL->getStringValue_json(json, CLASSNAME);
if(str == nullptr)
return nullptr;
std::string classname = str;
if (classname == "Panel")
{
classname = "Layout";
}
else if (classname == "TextArea")
{
classname = "Text";
}
else if (classname == "TextButton")
{
classname = "Button";
}
else if (classname == "Label")
{
classname = "Text";
}
else if (classname == "LabelAtlas")
{
classname = "TextAtlas";
}
else if (classname == "LabelBMFont")
{
classname = "TextBMFont";
}
std::string readerName = classname;
if (readerName == "Panel")
{
readerName = "Layout";
}
else if (readerName == "TextArea")
{
readerName = "Text";
}
else if (readerName == "TextButton")
{
readerName = "Button";
}
else if (readerName == "Label")
{
readerName = "Text";
}
else if (readerName == "LabelAtlas")
{
readerName = "TextAtlas";
}
else if (readerName == "LabelBMFont")
{
readerName = "TextBMFont";
}
readerName.append("Reader");
Widget* widget = dynamic_cast<Widget*>(ObjectFactory::getInstance()->createObject(classname));