Esempio n. 1
0
    SkinData *XMLDataParser::parseSkinData(const dragonBones::XMLElement *skinXML, SkeletonData *data)
    {
        SkinData *skinData = new SkinData();
        skinData->name = skinXML->Attribute(ConstValues::A_NAME.c_str());

        for(const dragonBones::XMLElement* slotXML = skinXML->FirstChildElement(ConstValues::SLOT.c_str()) ; slotXML ; slotXML = slotXML->NextSiblingElement(ConstValues::SLOT.c_str()))
        {
            skinData->addSlotData(parseSlotData(slotXML, data));
        }

        return skinData;
    }
SkinData * ObjectDataParser::parseSkinData(Json::Value & skinObject, SkeletonData * data) {
	SkinData* skinData = new SkinData();
	int nameVal = skinObject[ConstValues::A_NAME].asInt();
	char temp[64];
	sprintf(temp, "%d", nameVal);
	skinData->name = temp;

	Json::Value & slots = skinObject[ConstValues::SLOT];

	for (uint i = 0; i < slots.size(); i++) {
		Json::Value & slotObject = slots[i];
		skinData->addSlotData(parseSlotData(slotObject, data));
	}

	return skinData;
}