Frame* TextureFrame::clone() { TextureFrame* frame = TextureFrame::create(); frame->setTextureName(_textureName); frame->cloneProperty(this); return frame; }
Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::TimeLineTextureFrame *flatbuffers) { std::string path = ""; int resourceType = 0; std::string plist = ""; TextureFrame* frame = TextureFrame::create(); auto fileNameData = flatbuffers->fileNameData(); resourceType = fileNameData->resourceType(); switch (resourceType) { case 0: { path = fileNameData->path()->c_str(); if (FileUtils::getInstance()->isFileExist(path)) { std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path); path = fullPath; } else { path = ""; } break; } case 1: { plist = fileNameData->plistFile()->c_str(); if (FileUtils::getInstance()->isFileExist(plist)) { path = fileNameData->path()->c_str(); } else { path = ""; } break; } default: break; } frame->setTextureName(path); int frameIndex = flatbuffers->frameIndex(); frame->setFrameIndex(frameIndex); bool tween = flatbuffers->tween(); frame->setTween(tween); return frame; }
Frame* ActionTimelineCache::loadTextureFrame(const rapidjson::Value& json) { TextureFrame* frame = TextureFrame::create(); const char* texture = DICTOOL->getStringValue_json(json, Value); if(texture != NULL) frame->setTextureName(texture); return frame; }
Frame* ActionTimelineCache::loadTextureFrame(const rapidjson::Value& json) { TextureFrame* frame = TextureFrame::create(); const char* texture = DICTOOL->getStringValue_json(json, Value); if(texture != nullptr) { std::string path = texture; SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(path); if(spriteFrame == nullptr) { std::string jsonPath = CSLoader::getInstance()->getJsonPath(); path = jsonPath + texture; } frame->setTextureName(path); } return frame; }