Tidy sources

This commit is contained in:
halx99 2020-08-04 10:55:30 +08:00
parent d2d656e83d
commit bc94591603
37 changed files with 425 additions and 503 deletions

View File

@ -733,9 +733,9 @@ Frame* ActionTimelineCache::loadColorFrameWithFlatBuffers(const flatbuffers::Col
Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::TextureFrame *flatbuffers)
{
std::string path = "";
std::string path;
int resourceType = 0;
std::string plist = "";
std::string plist;
TextureFrame* frame = TextureFrame::create();
@ -747,19 +747,13 @@ Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::T
case 0:
{
path = fileNameData->path()->c_str();
if (!FileUtils::getInstance()->isFileExist(path))
{
path = "";
} // pitfall: x-studio spec, use fullPath will lead some asset managment solution not work with ETC1 seperate ALPHA channel.
// pitfall: use fullPath will lead some asset managment solution not work with ETC1 seperate ALPHA channel.
/*if (FileUtils::getInstance()->isFileExist(path))
{
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
path = fullPath;
}
else
{
path = "";
}*/
*/
break;
}
@ -772,7 +766,7 @@ Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::T
}
else
{
path = "";
path;
}
break;
}

View File

@ -431,7 +431,7 @@ Node* CSLoader::createNodeFromJson(const std::string& filename)
else
{
GUIReader::getInstance()->setFilePath("");
_jsonPath = "";
_jsonPath;
}
Node* node = loadNodeWithFile(filename);

View File

@ -302,7 +302,7 @@ void DataReaderHelper::addDataFromFile(const std::string& filePath)
}
else
{
basefilePath = "";
basefilePath;
}
std::string fileExtension = cocos2d::FileUtils::getInstance()->getFileExtension(filePath);
@ -368,7 +368,7 @@ void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const
}
else
{
basefilePath = "";
basefilePath;
}

View File

@ -379,7 +379,7 @@ Widget* GUIReader::widgetFromBinaryFile(const char *fileName)
auto fileDataBytes = fileData.getBytes();
auto fileDataSize = fileData.getSize();
const char* fileVersion = "";
const char* fileVersion;
ui::Widget* widget = nullptr;
if (fileDataBytes != nullptr && fileDataSize > 0)

View File

@ -508,7 +508,7 @@ void SceneReader::setPropertyFromJsonDict(CocoLoader *cocoLoader, stExpCocoNode
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
float x = 0.0f, y = 0.0f, fScaleX = 1.0f, fScaleY = 1.0f, fRotationZ = 1.0f;
bool bVisible = false;
const char *sName = "";
const char *sName;
int nTag = 0, nZorder = -1;
for (int i = 0; i < cocoNode->GetChildNum(); ++i)

View File

@ -190,7 +190,7 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithOpaque(void* opaque,
pugi::xml_node element = rootElement.first_child();
bool serializeEnabled = false;
std::string rootType = "";
std::string rootType;
while (element)
{
@ -346,7 +346,7 @@ Offset<NodeTree> FlatBuffersSerialize::createNodeTree(pugi::xml_node objectData,
std::string classname = classType.substr(0, classType.find("ObjectData"));
// CCLOG("classname = %s", classname.c_str());
std::string name = "";
std::string name;
Offset<Options> options;
std::vector<Offset<NodeTree>> children;
@ -430,7 +430,7 @@ Offset<NodeTree> FlatBuffersSerialize::createNodeTree(pugi::xml_node objectData,
}
//
std::string customClassName = "";
std::string customClassName;
auto attribute = objectData.first_attribute();
while (attribute)
{
@ -574,7 +574,7 @@ Offset<NodeAction> FlatBuffersSerialize::createNodeAction(pugi::xml_node objectD
{
int duration = 0;
float speed = 0.0f;
std::string currentAnimationName = "";
std::string currentAnimationName;
// CCLOG("animation name = %s", objectData->Name());
@ -623,7 +623,7 @@ Offset<NodeAction> FlatBuffersSerialize::createNodeAction(pugi::xml_node objectD
Offset<flatbuffers::AnimationInfo> FlatBuffersSerialize::createAnimationInfo(pugi::xml_node objectData)
{
std::string infoName = "";
std::string infoName;
int startIndex = 0;
int endIndex = 0;
@ -652,7 +652,7 @@ Offset<flatbuffers::AnimationInfo> FlatBuffersSerialize::createAnimationInfo(pug
Offset<TimeLine> FlatBuffersSerialize::createTimeLine(pugi::xml_node objectData)
{
int actionTag = 0;
std::string property = "";
std::string property;
// TimelineData attributes
auto attribute = objectData.first_attribute();
@ -959,12 +959,12 @@ Offset<flatbuffers::TextureFrame> FlatBuffersSerialize::createTextureFrame(pugi:
int frameIndex = 0;
bool tween = true;
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
auto attribute = objectData.first_attribute();
while (attribute)
@ -1032,7 +1032,7 @@ Offset<flatbuffers::EventFrame> FlatBuffersSerialize::createEventFrame(pugi::xml
{
int frameIndex = 0;
bool tween = true;
std::string value = "";
std::string value;
auto attribute = objectData.first_attribute();
while (attribute)
@ -1138,7 +1138,7 @@ Offset<flatbuffers::InnerActionFrame> FlatBuffersSerialize::createInnerActionFra
int frameIndex = 0;
bool tween = true;
int innerActionType = 0;
std::string currentAniamtionName = "";
std::string currentAniamtionName;
int singleFrameIndex = 0;
auto attribute = objectData.first_attribute();
@ -1196,8 +1196,8 @@ flatbuffers::Offset<flatbuffers::BlendFrame> FlatBuffersSerialize::createBlendFr
int frameIndex = 0;
bool tween = true;
int32_t src = GLBlendConst::ONE, dst = GLBlendConst::ONE_MINUS_SRC_ALPHA;
std::string name = "";
std::string value = "";
std::string name;
std::string value;
auto attribute = objectData.first_attribute();
while (attribute)
@ -1322,7 +1322,7 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato
pugi::xml_node element = rootElement.first_child();
bool serializeEnabled = false;
std::string rootType = "";
std::string rootType;
while (element)
{
@ -1436,7 +1436,7 @@ Offset<NodeTree> FlatBuffersSerialize::createNodeTreeForSimulator(pugi::xml_node
std::string classname = classType.substr(0, classType.find("ObjectData"));
// CCLOG("classname = %s", classname.c_str());
std::string name = "";
std::string name;
Offset<Options> options;
std::vector<Offset<NodeTree>> children;
@ -1521,7 +1521,7 @@ Offset<NodeTree> FlatBuffersSerialize::createNodeTreeForSimulator(pugi::xml_node
//
std::string customClassName = "";
std::string customClassName;
auto attribute = objectData.first_attribute();
while (attribute)
{
@ -1549,7 +1549,7 @@ Offset<ProjectNodeOptions> FlatBuffersSerialize::createProjectNodeOptionsForSimu
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, _builder);
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
std::string filename = "";
std::string filename;
float innerspeed = 1.0f;
pugi::xml_attribute objattri = objectData.first_attribute();
@ -1626,8 +1626,8 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFileForLanguageData
}
//Read all of the Key-Values in the XML file.
std::string key = "";
std::string text = "";
std::string key;
std::string text;
bool hasKeyReaded = false;
bool hasTextReaded = false;
pugi::xml_node childElement = element.first_child();

View File

@ -109,7 +109,7 @@ public:
/* serialize flat buffers with XML */
static std::string serializeFlatBuffersWithXMLFile(const std::string& xmlFileName,
const std::string& flatbuffersFileName);
/* x-studio365 spec: serialize flat buffers with XML buffer */
/* x-studio spec: serialize flat buffers with XML buffer */
static std::string serializeFlatBuffersWithXMLBuffer(std::string& xmlBuffer,
const std::string& flatbuffersFileName);
static std::string serializeFlatBuffersWithOpaque(void* opaque,

View File

@ -56,7 +56,7 @@ Offset<Table> ArmatureNodeReader::createOptionsWithFlatBuffers(pugi::xml_node ob
std::string currentArmatureName;
int type = 0;
std::string path = "";
std::string path;
float armatureScale = 1.0f;
float timeScale = 1.0f;
@ -149,7 +149,7 @@ void ArmatureNodeReader::setPropsWithFlatBuffers(cocos2d::Node *node,
auto options = (flatbuffers::CSArmatureNodeOption*)nodeOptions;
bool fileExist = false;
std::string errorFilePath = "";
std::string errorFilePath;
std::string filepath(options->fileData()->path()->c_str());

View File

@ -108,8 +108,7 @@ namespace cocostudio
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
// assets[0] = backgroundValue;
auto fileData = cocos2d::wext::makeResourceData(backgroundValue, (int)imageFileNameType);
button->loadTextureNormal(fileData.file, imageFileNameType);
button->loadTextureNormal(backgroundValue, imageFileNameType);
}
else if (key == P_PressedData){
@ -121,8 +120,7 @@ namespace cocostudio
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(backgroundValue, (int)imageFileNameType);
button->loadTexturePressed(fileData.file, imageFileNameType);
button->loadTexturePressed(backgroundValue, imageFileNameType);
}
else if (key == P_DisabledData){
@ -134,8 +132,7 @@ namespace cocostudio
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(backgroundValue, (int)imageFileNameType);
button->loadTextureDisabled(fileData.file, imageFileNameType);
button->loadTextureDisabled(backgroundValue, imageFileNameType);
}else if (key == P_Text){
button->setTitleText(value);
@ -161,8 +158,7 @@ namespace cocostudio
}else if(key == P_FontSize){
button->setTitleFontSize(valueToFloat(value));
}else if(key == P_FontName){
auto fileData = cocos2d::wext::makeResourceData(value);
button->setTitleFontName(fileData.file); // fonts
button->setTitleFontName(value); // fonts
}
} //end of for loop
@ -269,27 +265,27 @@ namespace cocostudio
bool displaystate = true;
bool scale9Enabled = false;
Rect capInsets;
std::string text = "";
std::string text;
bool isLocalized = false;
int fontSize = 14;
std::string fontName = "";
std::string fontName;
cocos2d::Size scale9Size;
Color4B textColor(255, 255, 255, 255);
std::string normalPath = "";
std::string normalPlistFile = "";
std::string normalPath;
std::string normalPlistFile;
int normalResourceType = 0;
std::string pressedPath = "";
std::string pressedPlistFile = "";
std::string pressedPath;
std::string pressedPlistFile;
int pressedResourceType = 0;
std::string disabledPath = "";
std::string disabledPlistFile = "";
std::string disabledPath;
std::string disabledPlistFile;
int disabledResourceType = 0;
std::string fontResourcePath = "";
std::string fontResourcePlistFile = "";
std::string fontResourcePath;
std::string fontResourcePlistFile;
int fontResourceResourceType = 0;
bool outlineEnabled = false;
@ -452,8 +448,8 @@ namespace cocostudio
}
else if (name == "DisabledFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -487,8 +483,8 @@ namespace cocostudio
}
else if (name == "PressedFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -522,8 +518,8 @@ namespace cocostudio
}
else if (name == "NormalFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -728,10 +724,10 @@ namespace cocostudio
button->setScale9Enabled(scale9Enabled);
bool normalFileExist = false;
std::string normalErrorFilePath = "";
auto normalDic = cocos2d::wext::makeResourceData(options->normalData());
int normalType = normalDic.type;
std::string& normalTexturePath = normalDic.file;
std::string normalErrorFilePath;
auto normalDic = options->normalData();
int normalType = normalDic->resourceType();
std::string normalTexturePath = normalDic->path()->c_str();
switch (normalType)
{
case 0:
@ -746,14 +742,14 @@ namespace cocostudio
}
else
{
normalErrorFilePath = normalTexturePath;
normalErrorFilePath = std::move(normalTexturePath);
normalFileExist = false;
}
break;
case 1:
{
std::string& plist = normalDic.plist;
std::string plist = normalDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(normalTexturePath);
if (spriteFrame)
{
@ -765,7 +761,7 @@ namespace cocostudio
{
ValueMap value = FileUtils::getInstance()->getValueMapFromFile(plist);
ValueMap metadata = value["metadata"].asValueMap();
std::string textureFileName = metadata["textureFileName"].asString();
auto& textureFileName = metadata["textureFileName"].asString();
if (!FileUtils::getInstance()->isFileExist(textureFileName))
{
normalErrorFilePath = textureFileName;
@ -773,7 +769,7 @@ namespace cocostudio
}
else
{
normalErrorFilePath = plist;
normalErrorFilePath = std::move(plist);
}
normalFileExist = false;
}
@ -789,10 +785,10 @@ namespace cocostudio
}
bool pressedFileExist = false;
std::string pressedErrorFilePath = "";
auto pressedDic = cocos2d::wext::makeResourceData(options->pressedData());
int pressedType = pressedDic.type;
std::string& pressedTexturePath = pressedDic.file;
std::string pressedErrorFilePath;
auto pressedDic = options->pressedData();
int pressedType = pressedDic->resourceType();
std::string pressedTexturePath = pressedDic->path()->c_str();
switch (pressedType)
{
case 0:
@ -811,7 +807,7 @@ namespace cocostudio
case 1:
{
std::string& plist = pressedDic.plist;
std::string plist = pressedDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(pressedTexturePath);
if (spriteFrame)
{
@ -823,7 +819,7 @@ namespace cocostudio
{
ValueMap value = FileUtils::getInstance()->getValueMapFromFile(plist);
ValueMap metadata = value["metadata"].asValueMap();
std::string textureFileName = metadata["textureFileName"].asString();
auto& textureFileName = metadata["textureFileName"].asString();
if (!FileUtils::getInstance()->isFileExist(textureFileName))
{
pressedErrorFilePath = textureFileName;
@ -831,7 +827,7 @@ namespace cocostudio
}
else
{
pressedErrorFilePath = plist;
pressedErrorFilePath = std::move(plist);
}
pressedFileExist = false;
}
@ -847,10 +843,10 @@ namespace cocostudio
}
bool disabledFileExist = false;
std::string disabledErrorFilePath = "";
auto disabledDic = cocos2d::wext::makeResourceData(options->disabledData());
int disabledType = disabledDic.type;
std::string& disabledTexturePath = disabledDic.file;
std::string disabledErrorFilePath;
auto disabledDic = options->disabledData();
int disabledType = disabledDic->resourceType();
std::string disabledTexturePath = disabledDic->path()->c_str();
switch (disabledType)
{
case 0:
@ -869,7 +865,7 @@ namespace cocostudio
case 1:
{
std::string& plist = disabledDic.plist;
std::string plist = disabledDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(disabledTexturePath);
if (spriteFrame)
{
@ -881,7 +877,7 @@ namespace cocostudio
{
ValueMap value = FileUtils::getInstance()->getValueMapFromFile(plist);
ValueMap metadata = value["metadata"].asValueMap();
std::string textureFileName = metadata["textureFileName"].asString();
auto& textureFileName = metadata["textureFileName"].asString();
if (!FileUtils::getInstance()->isFileExist(textureFileName))
{
disabledErrorFilePath = textureFileName;
@ -889,7 +885,7 @@ namespace cocostudio
}
else
{
disabledErrorFilePath = plist;
disabledErrorFilePath = std::move(plist);
}
disabledFileExist = false;
}
@ -924,25 +920,15 @@ namespace cocostudio
std::string titleFontName = options->fontName()->c_str();
button->setTitleFontName(titleFontName);
auto resourceData = cocos2d::wext::makeResourceData(options->fontResource());
bool fileExist = false;
std::string errorFilePath = "";
std::string& path = resourceData.file;
if (path != "")
auto resourceData = options->fontResource();
std::string errorFilePath;
std::string path = resourceData->path()->c_str();
if (!path.empty())
{
if (FileUtils::getInstance()->isFileExist(path))
{
fileExist = true;
}
else
{
errorFilePath = path;
fileExist = false;
}
if (fileExist)
{
button->setTitleFontName(path);
}
else
errorFilePath = path;
}
int titleFontSize = options->fontSize();

View File

@ -75,9 +75,7 @@ namespace cocostudio
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(backgroundValue, (int)imageFileNameType);
checkBox->loadTextureBackGround(fileData.file, imageFileNameType);
checkBox->loadTextureBackGround(backgroundValue, imageFileNameType);
}else if(key == P_BackGroundBoxSelectedData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);
@ -85,9 +83,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(backgroundValue, (int)imageFileNameType);
checkBox->loadTextureBackGroundSelected(fileData.file, imageFileNameType);
checkBox->loadTextureBackGroundSelected(backgroundValue, imageFileNameType);
}else if(key == P_FrontCrossData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);
@ -95,9 +91,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(backgroundValue, (int)imageFileNameType);
checkBox->loadTextureFrontCross(fileData.file, imageFileNameType);
checkBox->loadTextureFrontCross(backgroundValue, imageFileNameType);
}else if(key == P_BackGroundBoxDisabledData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);
@ -105,8 +99,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(backgroundValue, (int)imageFileNameType);
checkBox->loadTextureBackGroundDisabled(fileData.file, imageFileNameType);
checkBox->loadTextureBackGroundDisabled(backgroundValue, imageFileNameType);
}else if (key == P_FrontCrossDisabledData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);
@ -114,8 +107,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(backgroundValue, (int)imageFileNameType);
checkBox->loadTextureFrontCrossDisabled(fileData.file, imageFileNameType);
checkBox->loadTextureFrontCrossDisabled(backgroundValue, imageFileNameType);
}
// else if (key == "selectedState"){
// checkBox->setSelectedState(valueToBool(value));
@ -184,25 +176,25 @@ namespace cocostudio
bool displaystate = true;
int backgroundboxResourceType = 0;
std::string backgroundboxPath = "";
std::string backgroundboxPlistFile = "";
std::string backgroundboxPath;
std::string backgroundboxPlistFile;
int backGroundBoxSelectedResourceType = 0;
std::string backGroundBoxSelectedPath = "";
std::string backGroundBoxSelectedPlistFile = "";
std::string backGroundBoxSelectedPath;
std::string backGroundBoxSelectedPlistFile;
int frontCrossResourceType = 0;
std::string frontCrossPath = "";
std::string frontCrossPlistFile = "";
std::string frontCrossPath;
std::string frontCrossPlistFile;
int backGroundBoxDisabledResourceType = 0;
std::string backGroundBoxDisabledPath = "";
std::string backGroundBoxDisabledPlistFile = "";
std::string backGroundBoxDisabledPath;
std::string backGroundBoxDisabledPlistFile;
int frontCrossDisabledResourceType = 0;
std::string frontCrossDisabledPath = "";
std::string frontCrossDisabledPlistFile = "";
std::string frontCrossDisabledPath;
std::string frontCrossDisabledPlistFile;
// attributes
auto attribute = objectData.first_attribute();
@ -230,8 +222,8 @@ namespace cocostudio
if (name == "NormalBackFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -265,8 +257,8 @@ namespace cocostudio
}
else if (name == "PressedBackFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -300,8 +292,8 @@ namespace cocostudio
}
else if (name == "NodeNormalFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -335,8 +327,8 @@ namespace cocostudio
}
else if (name == "DisableBackFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -370,8 +362,8 @@ namespace cocostudio
}
else if (name == "NodeDisableFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -446,10 +438,10 @@ namespace cocostudio
//load background image
bool backGroundFileExist = false;
std::string backGroundErrorFilePath = "";
auto backGroundDic = cocos2d::wext::makeResourceData(options->backGroundBoxData());
int backGroundType = backGroundDic.type;
std::string& backGroundTexturePath = backGroundDic.file;
std::string backGroundErrorFilePath;
auto backGroundDic = options->backGroundBoxData();
int backGroundType = backGroundDic->resourceType();
std::string backGroundTexturePath = backGroundDic->path()->c_str();
switch (backGroundType)
{
@ -469,7 +461,7 @@ namespace cocostudio
case 1:
{
std::string plist = backGroundDic.plist;
std::string plist = backGroundDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(backGroundTexturePath);
if (spriteFrame)
{
@ -506,10 +498,10 @@ namespace cocostudio
//load background selected image
bool backGroundSelectedfileExist = false;
std::string backGroundSelectedErrorFilePath = "";
auto backGroundSelectedDic = cocos2d::wext::makeResourceData(options->backGroundBoxSelectedData());
int backGroundSelectedType = backGroundSelectedDic.type;
std::string& backGroundSelectedTexturePath = backGroundSelectedDic.file;
std::string backGroundSelectedErrorFilePath;
auto backGroundSelectedDic = options->backGroundBoxSelectedData();
int backGroundSelectedType = backGroundSelectedDic->resourceType();
std::string backGroundSelectedTexturePath = backGroundSelectedDic->path()->c_str();
switch (backGroundSelectedType)
{
@ -529,7 +521,7 @@ namespace cocostudio
case 1:
{
std::string plist = backGroundSelectedDic.plist;
std::string plist = backGroundSelectedDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(backGroundSelectedTexturePath);
if (spriteFrame)
{
@ -566,10 +558,10 @@ namespace cocostudio
//load frontCross image
bool frontCrossFileExist = false;
std::string frontCrossErrorFilePath = "";
auto frontCrossDic = cocos2d::wext::makeResourceData(options->frontCrossData());
int frontCrossType = frontCrossDic.type;
std::string& frontCrossFileName = frontCrossDic.file;
std::string frontCrossErrorFilePath;
auto frontCrossDic = (options->frontCrossData());
int frontCrossType = frontCrossDic->resourceType();
std::string frontCrossFileName = frontCrossDic->path()->c_str();
switch (frontCrossType)
{
case 0:
@ -588,7 +580,7 @@ namespace cocostudio
case 1:
{
std::string plist = frontCrossDic.plist;
std::string plist = frontCrossDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(frontCrossFileName);
if (spriteFrame)
{
@ -625,10 +617,10 @@ namespace cocostudio
//load backGroundBoxDisabledData
bool backGroundBoxDisabledFileExist = false;
std::string backGroundBoxDisabledErrorFilePath = "";
auto backGroundDisabledDic = cocos2d::wext::makeResourceData(options->backGroundBoxDisabledData());
int backGroundDisabledType = backGroundDisabledDic.type;
std::string& backGroundDisabledFileName = backGroundDisabledDic.file;
std::string backGroundBoxDisabledErrorFilePath;
auto backGroundDisabledDic = (options->backGroundBoxDisabledData());
int backGroundDisabledType = backGroundDisabledDic->resourceType();
std::string backGroundDisabledFileName = backGroundDisabledDic->path()->c_str();
switch (backGroundDisabledType)
{
case 0:
@ -647,7 +639,7 @@ namespace cocostudio
case 1:
{
std::string plist = backGroundDisabledDic.plist;
std::string plist = backGroundDisabledDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(backGroundDisabledFileName);
if (spriteFrame)
{
@ -684,10 +676,10 @@ namespace cocostudio
///load frontCrossDisabledData
bool frontCrossDisabledFileExist = false;
std::string frontCrossDisabledErrorFilePath = "";
auto frontCrossDisabledDic = cocos2d::wext::makeResourceData(options->frontCrossDisabledData());
int frontCrossDisabledType = frontCrossDisabledDic.type;
std::string& frontCrossDisabledFileName = frontCrossDisabledDic.file;
std::string frontCrossDisabledErrorFilePath;
auto frontCrossDisabledDic = (options->frontCrossDisabledData());
int frontCrossDisabledType = frontCrossDisabledDic->resourceType();
std::string frontCrossDisabledFileName = frontCrossDisabledDic->path()->c_str();
switch (frontCrossDisabledType)
{
case 0:
@ -706,7 +698,7 @@ namespace cocostudio
case 1:
{
std::string plist = frontCrossDisabledDic.plist;
std::string plist = frontCrossDisabledDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(frontCrossDisabledFileName);
if (spriteFrame)
{

View File

@ -73,13 +73,13 @@ namespace cocostudio
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
std::string name = "";
std::string name;
bool enabled = false;
bool loop = false;
float volume = 0;
std::string path = "";
std::string plist = "";
std::string path;
std::string plist;
int resourceType = 0;
auto attribute = objectData.first_attribute();

View File

@ -75,8 +75,8 @@ namespace cocostudio
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
// child elements
@ -140,7 +140,7 @@ namespace cocostudio
auto fileNameData = options->fileNameData();
bool fileExist = false;
std::string errorFilePath = "";
std::string errorFilePath;
std::string path = fileNameData->path()->c_str();
int resourceType = fileNameData->resourceType();
switch (resourceType)
@ -168,7 +168,7 @@ namespace cocostudio
auto mapInfo = TMXMapInfo::create(path);
auto& layers = mapInfo->getLayers();
bool valid = false;
std::string layerName = "";
std::string layerName;
for (const auto &layerInfo : layers)
{
valid = false;

View File

@ -82,38 +82,38 @@ namespace cocostudio
Offset<Table> GameNode3DReader::createOptionsWithFlatBuffers(pugi::xml_node objectData,
flatbuffers::FlatBufferBuilder *builder)
{
std::string name = "";
std::string name;
bool useDefaultLight = false;
int skyBoxMask = 1;
bool skyBoxEnabled = false;
bool skyBoxValid = true;
std::string leftPath = "";
std::string leftPlistFile = "";
std::string leftPath;
std::string leftPlistFile;
int leftResourceType = 0;
std::string rightPath = "";
std::string rightPlistFile = "";
std::string rightPath;
std::string rightPlistFile;
int rightResourceType = 0;
std::string upPath = "";
std::string upPlistFile = "";
std::string upPath;
std::string upPlistFile;
int upResourceType = 0;
std::string downPath = "";
std::string downPlistFile = "";
std::string downPath;
std::string downPlistFile;
int downResourceType = 0;
std::string forwardPath = "";
std::string forwardPlistFile = "";
std::string forwardPath;
std::string forwardPlistFile;
int forwardResourceType = 0;
std::string backPath = "";
std::string backPlistFile = "";
std::string backPath;
std::string backPlistFile;
int backResourceType = 0;
std::string frameEvent = "";
std::string customProperty = "";
std::string frameEvent;
std::string customProperty;
// attributes
auto attribute = objectData.first_attribute();

View File

@ -85,8 +85,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(std::move(backgroundValue), (int)imageFileNameType);
imageView->loadTexture(fileData.file, imageFileNameType);
imageView->loadTexture(backgroundValue, imageFileNameType);
}
else if(key == P_Scale9Width){
@ -172,8 +171,8 @@ namespace cocostudio
Rect capInsets;
cocos2d::Size scale9Size;
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
// attributes
@ -239,8 +238,8 @@ namespace cocostudio
}
else if (name == "FileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -299,10 +298,10 @@ namespace cocostudio
bool fileExist = false;
std::string errorFilePath = "";
auto imageFileNameDic = cocos2d::wext::makeResourceData(options->fileNameData());
int imageFileNameType = imageFileNameDic.type;
std::string& imageFileName = imageFileNameDic.file;
std::string errorFilePath;
auto imageFileNameDic = (options->fileNameData());
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = imageFileNameDic->path()->c_str();
switch (imageFileNameType)
{
case 0:
@ -321,7 +320,7 @@ namespace cocostudio
case 1:
{
std::string& plist = imageFileNameDic.plist;
std::string plist = imageFileNameDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(imageFileName);
if (spriteFrame)
{

View File

@ -144,8 +144,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(std::move(backgroundValue), (int)imageFileNameType);
panel->setBackGroundImage(fileData.file, imageFileNameType);
panel->setBackGroundImage(backgroundValue, imageFileNameType);
}
}else if(key == P_CapInsetsX){
@ -335,8 +334,8 @@ namespace cocostudio
auto temp = WidgetReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
bool clipEnabled = false;
@ -521,8 +520,8 @@ namespace cocostudio
}
else if (name == "FileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -619,10 +618,10 @@ namespace cocostudio
bool fileExist = false;
std::string errorFilePath = "";
auto imageFileNameDic = cocos2d::wext::makeResourceData(options->backGroundImageData());
int imageFileNameType = imageFileNameDic.type;
std::string& imageFileName = imageFileNameDic.file;
std::string errorFilePath;
auto imageFileNameDic = (options->backGroundImageData());
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = imageFileNameDic->path()->c_str();
if (imageFileName != "")
{
switch (imageFileNameType)
@ -643,7 +642,7 @@ namespace cocostudio
case 1:
{
std::string& plist = imageFileNameDic.plist;
std::string plist = imageFileNameDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(imageFileName);
if (spriteFrame)
{

View File

@ -433,10 +433,10 @@ namespace cocostudio
bool fileExist = false;
std::string errorFilePath = "";
auto imageFileNameDic = cocos2d::wext::makeResourceData(options->backGroundImageData());
int imageFileNameType = imageFileNameDic.type;
std::string& imageFileName = imageFileNameDic.file;
std::string errorFilePath;
auto imageFileNameDic = (options->backGroundImageData());
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = imageFileNameDic->path()->c_str();
if (imageFileName != "")
{
switch (imageFileNameType)
@ -457,7 +457,7 @@ namespace cocostudio
case 1:
{
std::string& plist = imageFileNameDic.plist;
std::string plist = imageFileNameDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(imageFileName);
if (spriteFrame)
{

View File

@ -87,8 +87,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(std::move(backgroundValue), (int)imageFileNameType);
loadingBar->loadTexture(fileData.file, imageFileNameType);
loadingBar->loadTexture(backgroundValue, imageFileNameType);
}
else if(key == P_CapInsetsX){
@ -161,8 +160,8 @@ namespace cocostudio
auto temp = WidgetReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
int percent = 80;
@ -195,8 +194,8 @@ namespace cocostudio
if (name == "ImageFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -251,10 +250,10 @@ namespace cocostudio
auto options = (LoadingBarOptions*)loadingBarOptions;
bool fileExist = false;
std::string errorFilePath = "";
auto imageFileNameDic = cocos2d::wext::makeResourceData(options->textureData());
int imageFileNameType = imageFileNameDic.type;
std::string& imageFileName = imageFileNameDic.file;
std::string errorFilePath;
auto imageFileNameDic = (options->textureData());
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = imageFileNameDic->path()->c_str();
switch (imageFileNameType)
{
case 0:
@ -278,7 +277,7 @@ namespace cocostudio
case 1:
{
std::string& plist = imageFileNameDic.plist;
std::string plist = imageFileNameDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(imageFileName);
if (spriteFrame)
{

View File

@ -106,7 +106,7 @@ namespace cocostudio
Offset<Table> Node3DReader::createOptionsWithFlatBuffersForNode(pugi::xml_node objectData,
flatbuffers::FlatBufferBuilder *builder)
{
std::string name = "";
std::string name;
long actionTag = 0;
Vec2 rotationSkew = Vec2::ZERO;
int zOrder = 0;
@ -123,8 +123,8 @@ namespace cocostudio
bool flipY = false;
bool ignoreSize = false;
bool touchEnabled = false;
std::string frameEvent = "";
std::string customProperty = "";
std::string frameEvent;
std::string customProperty;
bool positionXPercentEnabled = false;
bool positionYPercentEnabled = false;

View File

@ -86,7 +86,7 @@ namespace cocostudio
Offset<Table> NodeReader::createOptionsWithFlatBuffers(pugi::xml_node objectData,
flatbuffers::FlatBufferBuilder *builder)
{
std::string name = "";
std::string name;
long actionTag = 0;
Vec2 rotationSkew;
int zOrder = 0;
@ -103,8 +103,8 @@ namespace cocostudio
bool flipY = false;
bool ignoreSize = false;
bool touchEnabled = false;
std::string frameEvent = "";
std::string customProperty = "";
std::string frameEvent;
std::string customProperty;
bool positionXPercentEnabled = false;
bool positionYPercentEnabled = false;
@ -123,7 +123,7 @@ namespace cocostudio
float topMargin = 0;
float bottomMargin = 0;
// x-studio365 spec: read from .csb.
// since x-studio 10.0.593.0: read from .csb.
bool cascadeColorEnabled = false;
bool cascadeOpacityEnabled = false;
@ -492,7 +492,7 @@ namespace cocostudio
int alpha = options->alpha();
Color3B color(options->color()->r(), options->color()->g(), options->color()->b());
// x-studio365 10.0.593.0: read from .csb.
// x-studio 10.0.593.0: read from .csb.
node->setCascadeColorEnabled(options->cascadeColorEnabled());
node->setCascadeOpacityEnabled(options->cascadeOpacityEnabled());
@ -512,7 +512,7 @@ namespace cocostudio
node->setRotationSkewX(rotationSkewX);
if (rotationSkewY != 0)
node->setRotationSkewY(rotationSkewY);
// if(anchorx != 0.5f || anchory != 0.5f) x-studio365 spec: fix bugs, No need to check
// if(anchorx != 0.5f || anchory != 0.5f) x-studio spec: fix bugs, No need to check
node->setAnchorPoint(Point(anchorx, anchory));
if(zorder != 0)
node->setLocalZOrder(zorder);

View File

@ -12,28 +12,3 @@
#include "ui/CocosGUI.h"
#include "cocostudio/CCArmature.h"
#include "cocostudio/ActionTimeline/CCSkeletonNode.h"
cocos2d::ResourceData cocos2d::wext::makeResourceData(const flatbuffers::ResourceData* orig)
{
cocos2d::ResourceData fileData;
fileData.file = orig->path()->c_str();
fileData.plist = orig->plistFile()->c_str();
fileData.type = orig->resourceType();
return fileData;
}
cocos2d::ResourceData cocos2d::wext::makeResourceData(const std::string& path, int type)
{
cocos2d::ResourceData fileData;
fileData.file = path;
fileData.type = type;
return fileData;
}
cocos2d::ResourceData cocos2d::wext::makeResourceData(std::string&& path, int type)
{
cocos2d::ResourceData fileData;
fileData.file = std::move(path);
fileData.type = type;
return fileData;
}

View File

@ -39,7 +39,7 @@ namespace flatbuffers
class Table;
struct ResourceData; // x-studio365 spec, csb batch load support, assets hook functions.
struct ResourceData;
}
namespace cocos2d
@ -63,8 +63,6 @@ namespace cocostudio
};
}
// x-studio365 spec, csb batch load support, assets hook functions.
namespace cocostudio
{
class Armature;
@ -99,11 +97,6 @@ namespace cocos2d {
class Widget;
}
namespace wext {
CC_STUDIOP_DLL extern cocos2d::ResourceData makeResourceData(const flatbuffers::ResourceData* data);
CC_STUDIOP_DLL extern cocos2d::ResourceData makeResourceData(const std::string& path, int type = 0);
CC_STUDIOP_DLL extern cocos2d::ResourceData makeResourceData(std::string&& path, int type = 0);
};
};
#endif /* defined(__cocos2d_libs__NodeReaderProtocol__) */

View File

@ -62,8 +62,8 @@ namespace cocostudio
auto temp = WidgetReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
bool clipEnabled = false;
@ -248,8 +248,8 @@ namespace cocostudio
}
else if (name == "FileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -346,10 +346,10 @@ namespace cocostudio
bool fileExist = false;
std::string errorFilePath = "";
auto imageFileNameDic = cocos2d::wext::makeResourceData(options->backGroundImageData());
int imageFileNameType = imageFileNameDic.type;
std::string& imageFileName = imageFileNameDic.file;
std::string errorFilePath;
auto imageFileNameDic = (options->backGroundImageData());
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = imageFileNameDic->path()->c_str();
if (imageFileName != "")
{
switch (imageFileNameType)
@ -370,7 +370,7 @@ namespace cocostudio
case 1:
{
std::string& plist = imageFileNameDic.plist;
std::string plist = imageFileNameDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(imageFileName);
if (spriteFrame)
{

View File

@ -78,8 +78,8 @@ namespace cocostudio
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
cocos2d::BlendFunc blendFunc = cocos2d::BlendFunc::ALPHA_PREMULTIPLIED;
@ -177,12 +177,12 @@ namespace cocostudio
ParticleSystemQuad* particle = nullptr;
auto options = (ParticleSystemOptions*)particleOptions;
auto fileNameData = cocos2d::wext::makeResourceData(options->fileNameData());
auto fileNameDataDic = (options->fileNameData());
bool fileExist = false;
std::string errorFilePath = "";
std::string& path = fileNameData.file;
int resourceType = fileNameData.type;
std::string errorFilePath;
std::string path = fileNameDataDic->path()->c_str();
int resourceType = fileNameDataDic->resourceType();
switch (resourceType)
{
case 0:

View File

@ -72,7 +72,7 @@ namespace cocostudio
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
std::string filename = "";
std::string filename;
float innerspeed = 1.0f;
pugi::xml_attribute objattri = objectData.first_attribute();

View File

@ -62,25 +62,25 @@ namespace cocostudio
bool displaystate = true;
int backgroundboxResourceType = 0;
std::string backgroundboxPath = "";
std::string backgroundboxPlistFile = "";
std::string backgroundboxPath;
std::string backgroundboxPlistFile;
int backGroundBoxSelectedResourceType = 0;
std::string backGroundBoxSelectedPath = "";
std::string backGroundBoxSelectedPlistFile = "";
std::string backGroundBoxSelectedPath;
std::string backGroundBoxSelectedPlistFile;
int frontCrossResourceType = 0;
std::string frontCrossPath = "";
std::string frontCrossPlistFile = "";
std::string frontCrossPath;
std::string frontCrossPlistFile;
int backGroundBoxDisabledResourceType = 0;
std::string backGroundBoxDisabledPath = "";
std::string backGroundBoxDisabledPlistFile = "";
std::string backGroundBoxDisabledPath;
std::string backGroundBoxDisabledPlistFile;
int frontCrossDisabledResourceType = 0;
std::string frontCrossDisabledPath = "";
std::string frontCrossDisabledPlistFile = "";
std::string frontCrossDisabledPath;
std::string frontCrossDisabledPlistFile;
// attributes
auto attribute = objectData.first_attribute();
@ -108,8 +108,8 @@ namespace cocostudio
if (name == "NormalBackFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -143,8 +143,8 @@ namespace cocostudio
}
else if (name == "PressedBackFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -178,8 +178,8 @@ namespace cocostudio
}
else if (name == "NodeNormalFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -213,8 +213,8 @@ namespace cocostudio
}
else if (name == "DisableBackFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -248,8 +248,8 @@ namespace cocostudio
}
else if (name == "NodeDisableFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -322,10 +322,10 @@ namespace cocostudio
//load background image
bool backGroundFileExist = false;
std::string backGroundErrorFilePath = "";
auto backGroundDic = cocos2d::wext::makeResourceData(options->backGroundBoxData());
int backGroundType = backGroundDic.type;
std::string& backGroundTexturePath = backGroundDic.file;
std::string backGroundErrorFilePath;
auto backGroundDic = (options->backGroundBoxData());
int backGroundType = backGroundDic->resourceType();
std::string backGroundTexturePath = backGroundDic->path()->c_str();
switch (backGroundType)
{
case 0:
@ -344,7 +344,7 @@ namespace cocostudio
case 1:
{
std::string plist = backGroundDic.plist;
std::string plist = backGroundDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(backGroundTexturePath);
if (spriteFrame)
{
@ -381,10 +381,10 @@ namespace cocostudio
//load background selected image
bool backGroundSelectedfileExist = false;
std::string backGroundSelectedErrorFilePath = "";
auto backGroundSelectedDic = cocos2d::wext::makeResourceData(options->backGroundBoxSelectedData());
int backGroundSelectedType = backGroundSelectedDic.type;
std::string& backGroundSelectedTexturePath = backGroundSelectedDic.file;
std::string backGroundSelectedErrorFilePath;
auto backGroundSelectedDic = (options->backGroundBoxSelectedData());
int backGroundSelectedType = backGroundSelectedDic->resourceType();
std::string backGroundSelectedTexturePath = backGroundSelectedDic->path()->c_str();
switch (backGroundSelectedType)
{
case 0:
@ -403,7 +403,7 @@ namespace cocostudio
case 1:
{
std::string plist = backGroundSelectedDic.plist;
std::string plist = backGroundSelectedDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(backGroundSelectedTexturePath);
if (spriteFrame)
{
@ -440,10 +440,10 @@ namespace cocostudio
//load frontCross image
bool frontCrossFileExist = false;
std::string frontCrossErrorFilePath = "";
auto frontCrossDic = cocos2d::wext::makeResourceData(options->frontCrossData());
int frontCrossType = frontCrossDic.type;
std::string& frontCrossFileName = frontCrossDic.file;
std::string frontCrossErrorFilePath;
auto frontCrossDic = (options->frontCrossData());
int frontCrossType = frontCrossDic->resourceType();
std::string frontCrossFileName = frontCrossDic->path()->c_str();
switch (frontCrossType)
{
case 0:
@ -462,7 +462,7 @@ namespace cocostudio
case 1:
{
std::string plist = frontCrossDic.plist;
std::string plist = frontCrossDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(frontCrossFileName);
if (spriteFrame)
{
@ -499,10 +499,10 @@ namespace cocostudio
//load backGroundBoxDisabledData
bool backGroundBoxDisabledFileExist = false;
std::string backGroundBoxDisabledErrorFilePath = "";
auto backGroundDisabledDic = cocos2d::wext::makeResourceData(options->backGroundBoxDisabledData());
int backGroundDisabledType = backGroundDisabledDic.type;
std::string& backGroundDisabledFileName = backGroundDisabledDic.file;
std::string backGroundBoxDisabledErrorFilePath;
auto backGroundDisabledDic = (options->backGroundBoxDisabledData());
int backGroundDisabledType = backGroundDisabledDic->resourceType();
std::string backGroundDisabledFileName = backGroundDisabledDic->path()->c_str();
switch (backGroundDisabledType)
{
case 0:
@ -521,7 +521,7 @@ namespace cocostudio
case 1:
{
std::string plist = backGroundDisabledDic.plist;
std::string plist = backGroundDisabledDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(backGroundDisabledFileName);
if (spriteFrame)
{
@ -558,10 +558,10 @@ namespace cocostudio
///load frontCrossDisabledData
bool frontCrossDisabledFileExist = false;
std::string frontCrossDisabledErrorFilePath = "";
auto frontCrossDisabledDic = cocos2d::wext::makeResourceData(options->frontCrossDisabledData());
int frontCrossDisabledType = frontCrossDisabledDic.type;
std::string& frontCrossDisabledFileName = frontCrossDisabledDic.file;
std::string frontCrossDisabledErrorFilePath;
auto frontCrossDisabledDic = (options->frontCrossDisabledData());
int frontCrossDisabledType = frontCrossDisabledDic->resourceType();
std::string frontCrossDisabledFileName = frontCrossDisabledDic->path()->c_str();
switch (frontCrossDisabledType)
{
case 0:
@ -580,7 +580,7 @@ namespace cocostudio
case 1:
{
std::string plist = frontCrossDisabledDic.plist;
std::string plist = frontCrossDisabledDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(frontCrossDisabledFileName);
if (spriteFrame)
{

View File

@ -104,8 +104,8 @@ namespace cocostudio
auto temp = WidgetReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
bool clipEnabled = false;
@ -342,8 +342,8 @@ namespace cocostudio
}
else if (name == "FileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -447,10 +447,10 @@ namespace cocostudio
bool fileExist = false;
std::string errorFilePath = "";
auto imageFileNameDic = cocos2d::wext::makeResourceData(options->backGroundImageData());
int imageFileNameType = imageFileNameDic.type;
std::string& imageFileName = imageFileNameDic.file;
std::string errorFilePath;
auto imageFileNameDic = (options->backGroundImageData());
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = imageFileNameDic->path()->c_str();
if (imageFileName != "")
{
switch (imageFileNameType)
@ -471,7 +471,7 @@ namespace cocostudio
case 1:
{
std::string& plist = imageFileNameDic.plist;
std::string plist = imageFileNameDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(imageFileName);
if (spriteFrame)
{

View File

@ -87,8 +87,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(std::move(backgroundValue), (int)imageFileNameType);
slider->loadBarTexture(fileData.file, imageFileNameType);
slider->loadBarTexture(backgroundValue, imageFileNameType);
}else if(key == P_Length){
barLength = valueToFloat(value);
@ -99,8 +98,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(std::move(backgroundValue), (int)imageFileNameType);
slider->loadSlidBallTextureNormal(fileData.file, imageFileNameType);
slider->loadSlidBallTextureNormal(backgroundValue, imageFileNameType);
}else if(key == P_BallPressedData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
@ -109,8 +107,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(std::move(backgroundValue), (int)imageFileNameType);
slider->loadSlidBallTexturePressed(fileData.file, imageFileNameType);
slider->loadSlidBallTexturePressed(backgroundValue, imageFileNameType);
}else if(key == P_BallDisabledData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
@ -119,8 +116,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(std::move(backgroundValue), (int)imageFileNameType);
slider->loadSlidBallTextureDisabled(fileData.file, imageFileNameType);
slider->loadSlidBallTextureDisabled(backgroundValue, imageFileNameType);
}else if(key == P_ProgressBarData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
@ -129,8 +125,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(std::move(backgroundValue), (int)imageFileNameType);
slider->loadProgressBarTexture(fileData.file, imageFileNameType);
slider->loadProgressBarTexture(backgroundValue, imageFileNameType);
}
@ -207,24 +202,24 @@ namespace cocostudio
auto temp = WidgetReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
std::string barFileNamePath = "";
std::string barFileNamePlistFile = "";
std::string barFileNamePath;
std::string barFileNamePlistFile;
int barFileNameResourceType = 0;
std::string ballNormalPath = "";
std::string ballNormalPlistFile = "";
std::string ballNormalPath;
std::string ballNormalPlistFile;
int ballNormalResourceType = 0;
std::string ballPressedPath = "";
std::string ballPressedPlistFile = "";
std::string ballPressedPath;
std::string ballPressedPlistFile;
int ballPressedResourceType = 0;
std::string ballDisabledPath = "";
std::string ballDisabledPlistFile = "";
std::string ballDisabledPath;
std::string ballDisabledPlistFile;
int ballDisabledResourceType = 0;
std::string progressBarPath = "";
std::string progressBarPlistFile = "";
std::string progressBarPath;
std::string progressBarPlistFile;
int progressBarResourceType = 0;
int percent = 0;
@ -257,8 +252,8 @@ namespace cocostudio
if (name == "BackGroundData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -292,8 +287,8 @@ namespace cocostudio
}
else if (name == "BallNormalData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -327,8 +322,8 @@ namespace cocostudio
}
else if (name == "BallPressedData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -362,8 +357,8 @@ namespace cocostudio
}
else if (name == "BallDisabledData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -397,8 +392,8 @@ namespace cocostudio
}
else if (name == "ProgressBarData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -472,10 +467,10 @@ namespace cocostudio
//slider->setPercent(percent);
bool imageFileExist = false;
std::string imageErrorFilePath = "";
auto imageFileNameDic = cocos2d::wext::makeResourceData(options->barFileNameData());
int imageFileNameType = imageFileNameDic.type;
std::string& imageFileName = imageFileNameDic.file;
std::string imageErrorFilePath;
auto imageFileNameDic = (options->barFileNameData());
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = imageFileNameDic->path()->c_str();
switch (imageFileNameType)
{
case 0:
@ -494,7 +489,7 @@ namespace cocostudio
case 1:
{
std::string plist = imageFileNameDic.plist;
std::string plist = imageFileNameDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(imageFileName);
if (spriteFrame)
{
@ -537,10 +532,10 @@ namespace cocostudio
//loading normal slider ball texture
bool normalFileExist = false;
std::string normalErrorFilePath = "";
auto normalDic = cocos2d::wext::makeResourceData(options->ballNormalData());
int normalType = normalDic.type;
std::string& normalFileName = normalDic.file;
std::string normalErrorFilePath;
auto normalDic = (options->ballNormalData());
int normalType = normalDic->resourceType();
std::string normalFileName = normalDic->path()->c_str();
switch (normalType)
{
case 0:
@ -559,7 +554,7 @@ namespace cocostudio
case 1:
{
std::string plist = normalDic.plist;
std::string plist = normalDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(normalFileName);
if (spriteFrame)
{
@ -602,10 +597,10 @@ namespace cocostudio
//loading slider ball press texture
bool pressedFileExist = false;
std::string pressedErrorFilePath = "";
auto pressedDic = cocos2d::wext::makeResourceData(options->ballPressedData());
int pressedType = pressedDic.type;
std::string& pressedFileName = pressedDic.file;
std::string pressedErrorFilePath;
auto pressedDic = (options->ballPressedData());
int pressedType = pressedDic->resourceType();
std::string pressedFileName = pressedDic->path()->c_str();
switch (pressedType)
{
case 0:
@ -624,7 +619,7 @@ namespace cocostudio
case 1:
{
std::string plist = pressedDic.plist;
std::string plist = pressedDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(pressedFileName);
if (spriteFrame)
{
@ -667,10 +662,10 @@ namespace cocostudio
//loading slider ball disable texture
bool disabledFileExist = false;
std::string disabledErrorFilePath = "";
auto disabledDic = cocos2d::wext::makeResourceData(options->ballDisabledData());
int disabledType = disabledDic.type;
std::string& disabledFileName = disabledDic.file;
std::string disabledErrorFilePath;
auto disabledDic = (options->ballDisabledData());
int disabledType = disabledDic->resourceType();
std::string disabledFileName = disabledDic->path()->c_str();
switch (disabledType)
{
case 0:
@ -689,7 +684,7 @@ namespace cocostudio
case 1:
{
std::string plist = disabledDic.plist;
std::string plist = disabledDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(disabledFileName);
if (spriteFrame)
{
@ -732,10 +727,10 @@ namespace cocostudio
//load slider progress texture
bool progressFileExist = false;
std::string progressErrorFilePath = "";
auto progressBarDic = cocos2d::wext::makeResourceData(options->progressBarData());
int progressBarType = progressBarDic.type;
std::string& progressBarFileName = progressBarDic.file;
std::string progressErrorFilePath;
auto progressBarDic = (options->progressBarData());
int progressBarType = progressBarDic->resourceType();
std::string progressBarFileName = progressBarDic->path()->c_str();
switch (progressBarType)
{
case 0:
@ -754,7 +749,7 @@ namespace cocostudio
case 1:
{
std::string plist = progressBarDic.plist;
std::string plist = progressBarDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(progressBarFileName);
if (spriteFrame)
{

View File

@ -133,8 +133,8 @@ namespace cocostudio
if (name == "DataFile")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
auto attribute = child.first_attribute();

View File

@ -84,8 +84,8 @@ namespace cocostudio
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
bool intelliShadingEnabled = false;
cocos2d::Vec3 hsv;
@ -117,8 +117,8 @@ namespace cocostudio
pugi::xml_attribute attribute;
if (name == "FileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -245,12 +245,12 @@ namespace cocostudio
auto nodeReader = NodeReader::getInstance();
nodeReader->setPropsWithFlatBuffers(node, (Table*)(options->nodeOptions()));
auto fileNameData = cocos2d::wext::makeResourceData(options->fileNameData());
auto fileNameDataDic = (options->fileNameData());
int resourceType = fileNameData.type;
std::string& path = fileNameData.file;
int resourceType = fileNameDataDic->resourceType();
std::string path = fileNameDataDic->path()->c_str();
std::string errorFilePath = "";
std::string errorFilePath;
switch (resourceType)
{
@ -269,7 +269,7 @@ namespace cocostudio
case 1:
{
std::string& plist = fileNameData.plist;
std::string plist = fileNameDataDic->plistFile()->c_str();
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(path);
if (spriteFrame)
{

View File

@ -247,33 +247,33 @@ flatbuffers::Offset<flatbuffers::Table> TabHeaderReader::createOptionsWithFlatBu
int fontsize = 12;
std::string text = "";
std::string text;
cocos2d::Color4B textColor(255, 255, 255, 255);
std::string fontName;
int backgroundboxResourceType = 0;
std::string backgroundboxPath = "";
std::string backgroundboxPlistFile = "";
std::string backgroundboxPath;
std::string backgroundboxPlistFile;
int backGroundBoxSelectedResourceType = 0;
std::string backGroundBoxSelectedPath = "";
std::string backGroundBoxSelectedPlistFile = "";
std::string backGroundBoxSelectedPath;
std::string backGroundBoxSelectedPlistFile;
int frontCrossResourceType = 0;
std::string frontCrossPath = "";
std::string frontCrossPlistFile = "";
std::string frontCrossPath;
std::string frontCrossPlistFile;
int backGroundBoxDisabledResourceType = 0;
std::string backGroundBoxDisabledPath = "";
std::string backGroundBoxDisabledPlistFile = "";
std::string backGroundBoxDisabledPath;
std::string backGroundBoxDisabledPlistFile;
int frontCrossDisabledResourceType = 0;
std::string frontCrossDisabledPath = "";
std::string frontCrossDisabledPlistFile = "";
std::string frontCrossDisabledPath;
std::string frontCrossDisabledPlistFile;
std::string fontResourcePath = "";
std::string fontResourcePlistFile = "";
std::string fontResourcePath;
std::string fontResourcePlistFile;
int fontResourceResourceType = 0;
auto attribute = objectData.first_attribute();
@ -325,8 +325,8 @@ flatbuffers::Offset<flatbuffers::Table> TabHeaderReader::createOptionsWithFlatBu
}
else if (name == "NormalBackFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -360,8 +360,8 @@ flatbuffers::Offset<flatbuffers::Table> TabHeaderReader::createOptionsWithFlatBu
}
else if (name == "PressedBackFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -395,8 +395,8 @@ flatbuffers::Offset<flatbuffers::Table> TabHeaderReader::createOptionsWithFlatBu
}
else if (name == "NodeNormalFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -430,8 +430,8 @@ flatbuffers::Offset<flatbuffers::Table> TabHeaderReader::createOptionsWithFlatBu
}
else if (name == "DisableBackFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -465,8 +465,8 @@ flatbuffers::Offset<flatbuffers::Table> TabHeaderReader::createOptionsWithFlatBu
}
else if (name == "NodeDisableFileData")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -574,7 +574,7 @@ void TabHeaderReader::setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuf
auto resourceData = options->fontRes();
bool fileExist = false;
std::string errorFilePath = "";
std::string errorFilePath;
std::string path = resourceData->path()->c_str();
if (path != "")
{
@ -594,7 +594,7 @@ void TabHeaderReader::setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuf
}
bool backGroundFileExist = false;
std::string backGroundErrorFilePath = "";
std::string backGroundErrorFilePath;
auto backGroundDic = options->normalBackFile();
int backGroundType = backGroundDic->resourceType();
std::string backGroundTexturePath = backGroundDic->path()->c_str();
@ -653,7 +653,7 @@ void TabHeaderReader::setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuf
//load background selected image
bool backGroundSelectedfileExist = false;
std::string backGroundSelectedErrorFilePath = "";
std::string backGroundSelectedErrorFilePath;
auto backGroundSelectedDic = options->pressBackFile();
int backGroundSelectedType = backGroundSelectedDic->resourceType();
std::string backGroundSelectedTexturePath = backGroundSelectedDic->path()->c_str();
@ -712,7 +712,7 @@ void TabHeaderReader::setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuf
//load frontCross image
bool frontCrossFileExist = false;
std::string frontCrossErrorFilePath = "";
std::string frontCrossErrorFilePath;
auto frontCrossDic = options->crossNormalFile();
int frontCrossType = frontCrossDic->resourceType();
std::string frontCrossFileName = frontCrossDic->path()->c_str();
@ -771,7 +771,7 @@ void TabHeaderReader::setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuf
//load backGroundBoxDisabledData
bool backGroundBoxDisabledFileExist = false;
std::string backGroundBoxDisabledErrorFilePath = "";
std::string backGroundBoxDisabledErrorFilePath;
auto backGroundDisabledDic = options->disableBackFile();
int backGroundDisabledType = backGroundDisabledDic->resourceType();
std::string backGroundDisabledFileName = backGroundDisabledDic->path()->c_str();
@ -830,7 +830,7 @@ void TabHeaderReader::setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuf
///load frontCrossDisabledData
bool frontCrossDisabledFileExist = false;
std::string frontCrossDisabledErrorFilePath = "";
std::string frontCrossDisabledErrorFilePath;
auto frontCrossDisabledDic = options->crossDisableFile();
int frontCrossDisabledType = frontCrossDisabledDic->resourceType();
std::string frontCrossDisabledFileName = frontCrossDisabledDic->path()->c_str();

View File

@ -65,7 +65,9 @@ namespace cocostudio
std::string startCharMap;
float itemWidth;
float itemHeight;
cocos2d::ResourceData charmapFileData;
int resourceType = 0;
std::string charMapFile;
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue(cocoLoader);
@ -84,11 +86,7 @@ namespace cocostudio
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
//charMapFileName = backgroundValue;
//type = imageFileNameType;
charmapFileData = cocos2d::wext::makeResourceData(std::move(backgroundValue), (int)imageFileNameType);
charMapFile = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
}else if(key == P_ItemWidth){
itemWidth = valueToFloat(value);
}else if(key == P_ItemHeight){
@ -98,8 +96,8 @@ namespace cocostudio
}
} //end of for loop
if (charmapFileData.type == 0) {
labelAtlas->setProperty(stringValue, charmapFileData.file, itemWidth, itemHeight, startCharMap);
if (resourceType == 0) {
labelAtlas->setProperty(stringValue, charMapFile, itemWidth, itemHeight, startCharMap);
}
this->endSetBasicProperties(widget);
}
@ -152,14 +150,14 @@ namespace cocostudio
auto temp = WidgetReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
std::string stringValue = "0123456789";
int itemWidth = 0;
int itemHeight = 0;
std::string startCharMap = "";
std::string startCharMap;
// attributes
auto attribute = objectData.first_attribute();
@ -196,8 +194,8 @@ namespace cocostudio
if (name == "LabelAtlasFileImage_CNB")
{
std::string texture = "";
std::string texturePng = "";
std::string texture;
std::string texturePng;
attribute = child.first_attribute();
@ -247,16 +245,16 @@ namespace cocostudio
TextAtlas* labelAtlas = static_cast<TextAtlas*>(node);
auto options = (TextAtlasOptions*)textAtlasOptions;
auto cmftDic = cocos2d::wext::makeResourceData(options->charMapFileData());
int cmfType = cmftDic.type;
auto cmftDic = (options->charMapFileData());
int cmfType = cmftDic->resourceType();
switch (cmfType)
{
case 0:
{
const char* cmfPath = cmftDic.file.c_str();
std::string cmfPath = cmftDic->path()->c_str();
bool fileExist = false;
std::string errorFilePath = "";
std::string errorFilePath;
if (FileUtils::getInstance()->isFileExist(cmfPath))
{

View File

@ -73,9 +73,8 @@ namespace cocostudio
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
auto fileData = cocos2d::wext::makeResourceData(std::move(backgroundValue), (int)imageFileNameType);
if (imageFileNameType == (Widget::TextureResType)0) {
labelBMFont->setFntFile(fileData.file);
labelBMFont->setFntFile(backgroundValue);
}
}else if(key == P_Text){
@ -129,8 +128,8 @@ namespace cocostudio
std::string text = "Fnt Text Label";
bool isLocalized = false;
std::string path = "";
std::string plistFlie = "";
std::string path;
std::string plistFlie;
int resourceType = 0;
// attributes
@ -204,12 +203,12 @@ namespace cocostudio
TextBMFont* labelBMFont = static_cast<TextBMFont*>(node);
auto options = (TextBMFontOptions*)textBMFontOptions;
auto cmftDic = cocos2d::wext::makeResourceData(options->fileNameData());
auto cmftDic = (options->fileNameData());
bool fileExist = false;
std::string errorFilePath = "";
std::string errorContent = "";
std::string& path = cmftDic.file;
int cmfType = cmftDic.type;
std::string errorFilePath;
std::string errorContent;
std::string path = cmftDic->path()->c_str();
int cmfType = cmftDic->resourceType();
switch (cmfType)
{
case 0:

View File

@ -75,13 +75,13 @@ namespace cocostudio
auto temp = WidgetReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
std::string fontName = "";
std::string fontName;
int fontSize = 20;
std::string text = "";
std::string text;
bool isLocalized = false;
std::string placeHolder = "Text Field Extend";
bool passwordEnabled = false;
@ -317,9 +317,9 @@ namespace cocostudio
std::string fontName = options->fontName()->c_str();
bool fileExist = false;
std::string errorFilePath = "";
auto resourceData = cocos2d::wext::makeResourceData(options->fontResource());
std::string& path = resourceData.file;
std::string errorFilePath;
auto resourceDataDic = (options->fontResource());
std::string path = resourceDataDic->path()->c_str();
if (path != "")
{
if (FileUtils::getInstance()->isFileExist(path))

View File

@ -79,8 +79,7 @@ namespace cocostudio
}else if(key == P_FontSize){
textField->setFontSize(valueToInt(value));
}else if(key == P_FontName){
auto fontData = cocos2d::wext::makeResourceData(value);
textField->setFontName(fontData.file);
textField->setFontName(value);
}else if(key == P_TouchSizeWidth){
textField->setTouchSize(Size(valueToFloat(value), textField->getTouchSize().height));
}else if(key == P_TouchSizeHeight){
@ -159,13 +158,13 @@ namespace cocostudio
auto temp = WidgetReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
std::string fontName = "";
std::string fontName;
int fontSize = 20;
std::string text = "";
std::string text;
bool isLocalized = false;
std::string placeHolder = "Text Field";
bool passwordEnabled = false;
@ -334,9 +333,9 @@ namespace cocostudio
bool fileExist = false;
std::string errorFilePath = "";
auto resourceData = cocos2d::wext::makeResourceData(options->fontResource());
std::string& path = resourceData.file;
std::string errorFilePath;
auto resourceDataDic = (options->fontResource());
std::string path = resourceDataDic->path()->c_str();
if (path != "")
{
if (FileUtils::getInstance()->isFileExist(path))

View File

@ -83,14 +83,8 @@ namespace cocostudio
}else if(key == P_FontSize){
label->setFontSize(valueToInt(value));
}else if(key == P_FontName){
std::string fontFilePath;
fontFilePath = binaryFilePath.append(value);
auto fontData = cocos2d::wext::makeResourceData(std::move(fontFilePath));
if (FileUtils::getInstance()->isFileExist(fontFilePath)) {
label->setFontName(fontData.file);
}else{
label->setFontName(fontData.file);
}
auto& fontFilePath = binaryFilePath.append(value);
label->setFontName(fontFilePath);
}else if(key == P_AreaWidth){
label->setTextAreaSize(Size(valueToFloat(value), label->getTextAreaSize().height));
}else if(key == P_AreaHeight){
@ -161,7 +155,7 @@ namespace cocostudio
bool touchScaleEnabled = false;
bool isCustomSize = false;
std::string fontName = "";
std::string fontName;
int fontSize = 20;
std::string text = "Text Label";
bool isLocalized = false;
@ -177,14 +171,14 @@ namespace cocostudio
Size shadowOffset = Size(2, -2);
int shadowBlurRadius = 0;
// since x-studio365 reader 10.0.593.0
// since x-studio reader 10.0.593.0
bool glowEnabled = false;
Color4B glowColor = Color4B::BLACK;
bool boldEnabled = false, underlineEnabled = false, italicsEnabled = false, strikethroughEnabled = false;
std::string path = "";
std::string plistFile = "";
std::string path;
std::string plistFile;
int resourceType = 0;
// attributes
@ -472,16 +466,16 @@ namespace cocostudio
label->setTextAreaSize(areaSize);
}
auto resourceData = cocos2d::wext::makeResourceData(options->fontResource());
std::string& path = resourceData.file;
auto resourceDataDic = (options->fontResource());
std::string path = resourceDataDic->path()->c_str();
if (!path.empty() && FileUtils::getInstance()->isFileExist(path))
{
label->setFontName(path);
}
else
{
std::string fontName = options->fontName()->c_str();
label->setFontName(fontName);
path = options->fontName()->c_str();
label->setFontName(path);
}
TextHAlignment h_alignment = (TextHAlignment)options->hAlignment();

View File

@ -158,28 +158,28 @@ namespace cocostudio
Vec2 clipPlane(1, 1000);
std::string leftPath = "";
std::string leftPlistFile = "";
std::string leftPath;
std::string leftPlistFile;
int leftResourceType = 0;
std::string rightPath = "";
std::string rightPlistFile = "";
std::string rightPath;
std::string rightPlistFile;
int rightResourceType = 0;
std::string upPath = "";
std::string upPlistFile = "";
std::string upPath;
std::string upPlistFile;
int upResourceType = 0;
std::string downPath = "";
std::string downPlistFile = "";
std::string downPath;
std::string downPlistFile;
int downResourceType = 0;
std::string forwardPath = "";
std::string forwardPlistFile = "";
std::string forwardPath;
std::string forwardPlistFile;
int forwardResourceType = 0;
std::string backPath = "";
std::string backPlistFile = "";
std::string backPath;
std::string backPlistFile;
int backResourceType = 0;
// FileData

View File

@ -400,7 +400,7 @@ namespace cocostudio
Offset<Table> WidgetReader::createOptionsWithFlatBuffers(pugi::xml_node objectData, flatbuffers::FlatBufferBuilder *builder)
{
std::string name = "";
std::string name;
long actionTag = 0;
Vec2 rotationSkew;
int zOrder = 0;
@ -416,10 +416,10 @@ namespace cocostudio
bool flipY = false;
bool ignoreSize = false;
bool touchEnabled = false;
std::string frameEvent = "";
std::string customProperty = "";
std::string callbackType = "";
std::string callbackName = "";
std::string frameEvent;
std::string customProperty;
std::string callbackType;
std::string callbackName;
bool positionXPercentEnabled = false;
bool positionYPercentEnabled = false;
@ -438,7 +438,7 @@ namespace cocostudio
float topMargin = 0;
float bottomMargin = 0;
// x-studio365 10.0.593.0: read from .csb.
// x-studio 10.0.593.0: read from .csb.
bool cascadeColorEnabled = false;
bool cascadeOpacityEnabled = false;
@ -798,7 +798,7 @@ namespace cocostudio
auto options = (WidgetOptions*)widgetOptions;
// x-studio365 10.0.593.0: read from .csb
// x-studio 10.0.593.0: read from .csb
node->setCascadeColorEnabled(options->cascadeColorEnabled());
node->setCascadeOpacityEnabled(options->cascadeOpacityEnabled());