2013-09-13 22:20:20 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2013 cocos2d-x.org
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "../GUI/System/CocosGUI.h"
|
|
|
|
#include "../Json/DictionaryHelper.h"
|
2013-09-17 22:39:42 +08:00
|
|
|
#include "../Action/CCActionManagerEx.h"
|
2013-09-13 22:20:20 +08:00
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
|
|
NS_CC_EXT_BEGIN
|
|
|
|
|
|
|
|
static CCSGUIReader* sharedReader = NULL;
|
|
|
|
|
|
|
|
CCSGUIReader::CCSGUIReader():
|
|
|
|
m_strFilePath(""),
|
|
|
|
m_bOlderVersion(false)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CCSGUIReader::~CCSGUIReader()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CCSGUIReader* CCSGUIReader::shareReader()
|
|
|
|
{
|
|
|
|
if (!sharedReader)
|
|
|
|
{
|
|
|
|
sharedReader = new CCSGUIReader();
|
|
|
|
}
|
|
|
|
return sharedReader;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::purgeCCSGUIReader()
|
|
|
|
{
|
|
|
|
CC_SAFE_DELETE(sharedReader);
|
|
|
|
}
|
|
|
|
|
|
|
|
int CCSGUIReader::getVersionInteger(const char *str)
|
|
|
|
{
|
|
|
|
/*********temp***********/
|
|
|
|
std::string strVersion = str;
|
|
|
|
int length = strVersion.length();
|
|
|
|
if (length < 7)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int pos = strVersion.find_first_of(".");
|
|
|
|
std::string t = strVersion.substr(0,pos);
|
|
|
|
strVersion = strVersion.substr(pos+1,strVersion.length()-1);
|
|
|
|
|
|
|
|
pos = strVersion.find_first_of(".");
|
|
|
|
std::string h = strVersion.substr(0,pos);
|
|
|
|
strVersion = strVersion.substr(pos+1,strVersion.length()-1);
|
|
|
|
|
|
|
|
pos = strVersion.find_first_of(".");
|
|
|
|
std::string te = strVersion.substr(0,pos);
|
|
|
|
strVersion = strVersion.substr(pos+1,strVersion.length()-1);
|
|
|
|
|
|
|
|
pos = strVersion.find_first_of(".");
|
|
|
|
std::string s = strVersion.substr(0,pos);
|
|
|
|
|
|
|
|
int it = atoi(t.c_str());
|
|
|
|
int ih = atoi(h.c_str());
|
|
|
|
int ite = atoi(te.c_str());
|
|
|
|
int is = atoi(s.c_str());
|
|
|
|
|
|
|
|
int iVersion = it*1000+ih*100+ite*10+is;
|
|
|
|
CCLOG("iversion %d",iVersion);
|
|
|
|
return iVersion;
|
|
|
|
/************************/
|
|
|
|
}
|
|
|
|
|
|
|
|
UIWidget* CCSGUIReader::widgetFromJsonDictionary(cs::JsonDictionary* data)
|
|
|
|
{
|
|
|
|
UIWidget* widget = NULL;
|
|
|
|
const char* classname = DICTOOL->getStringValue_json(data, "classname");
|
|
|
|
cs::JsonDictionary* uiOptions = DICTOOL->getSubDictionary_json(data, "options");
|
|
|
|
if (classname && strcmp(classname, "Button") == 0)
|
|
|
|
{
|
|
|
|
widget = UIButton::create();
|
|
|
|
setPropsForButtonFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "CheckBox") == 0)
|
|
|
|
{
|
|
|
|
widget = UICheckBox::create();
|
|
|
|
setPropsForCheckBoxFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "Label") == 0)
|
|
|
|
{
|
|
|
|
widget = UILabel::create();
|
|
|
|
setPropsForLabelFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "LabelAtlas") == 0)
|
|
|
|
{
|
|
|
|
widget = UILabelAtlas::create();
|
|
|
|
setPropsForLabelAtlasFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "LoadingBar") == 0)
|
|
|
|
{
|
|
|
|
widget = UILoadingBar::create();
|
|
|
|
setPropsForLoadingBarFromJsonDictionary(widget, uiOptions);
|
|
|
|
}else if (classname && strcmp(classname, "ScrollView") == 0){
|
|
|
|
widget = UIScrollView::create();
|
|
|
|
setPropsForScrollViewFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "TextArea") == 0)
|
|
|
|
{
|
|
|
|
widget = UILabel::create();
|
|
|
|
setPropsForTextAreaFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "TextButton") == 0)
|
|
|
|
{
|
|
|
|
widget = UIButton::create();
|
|
|
|
setPropsForTextButtonFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "TextField") == 0)
|
|
|
|
{
|
|
|
|
widget = UITextField::create();
|
|
|
|
setPropsForTextFieldFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "ImageView") == 0)
|
|
|
|
{
|
|
|
|
widget = UIImageView::create();
|
|
|
|
setPropsForImageViewFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "Panel") == 0)
|
|
|
|
{
|
|
|
|
widget = Layout::create();
|
|
|
|
setPropsForPanelFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "Slider") == 0)
|
|
|
|
{
|
|
|
|
widget = UISlider::create();
|
|
|
|
setPropsForSliderFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "ListView") == 0)
|
|
|
|
{
|
|
|
|
// widget = UIListView::create();
|
|
|
|
// setPropsForListViewFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "PageView") == 0)
|
|
|
|
{
|
|
|
|
widget = UIPageView::create();
|
|
|
|
setPropsForPageViewFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "LabelBMFont") == 0)
|
|
|
|
{
|
|
|
|
widget = UILabelBMFont::create();
|
|
|
|
setPropsForLabelBMFontFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
else if (classname && strcmp(classname, "DragPanel") == 0)
|
|
|
|
{
|
|
|
|
widget = UIDragPanel::create();
|
|
|
|
setPropsForDragPanelFromJsonDictionary(widget, uiOptions);
|
|
|
|
}
|
|
|
|
|
|
|
|
int childrenCount = DICTOOL->getArrayCount_json(data, "children");
|
|
|
|
for (int i=0;i<childrenCount;i++)
|
|
|
|
{
|
|
|
|
cs::JsonDictionary* subData = DICTOOL->getDictionaryFromArray_json(data, "children", i);
|
|
|
|
UIWidget* child = widgetFromJsonDictionary(subData);
|
|
|
|
if (child)
|
|
|
|
{
|
|
|
|
widget->addChild(child);
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(subData);
|
|
|
|
}
|
|
|
|
|
|
|
|
CC_SAFE_DELETE(uiOptions);
|
|
|
|
return widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIWidget* CCSGUIReader::widgetFromJsonFile(const char *fileName)
|
|
|
|
{
|
|
|
|
m_bOlderVersion = false;
|
|
|
|
const char *des = NULL;
|
|
|
|
std::string jsonpath;
|
|
|
|
cs::JsonDictionary *jsonDict = NULL;
|
2013-09-16 15:32:52 +08:00
|
|
|
jsonpath = FileUtils::getInstance()->fullPathForFilename(fileName);
|
2013-09-13 22:20:20 +08:00
|
|
|
|
|
|
|
unsigned long size = 0;
|
2013-09-16 15:32:52 +08:00
|
|
|
des = (char*)(FileUtils::getInstance()->getFileData(jsonpath.c_str(),"r" , &size));
|
2013-09-13 22:20:20 +08:00
|
|
|
if(NULL == des || strcmp(des, "") == 0)
|
|
|
|
{
|
|
|
|
printf("read json file[%s] error!\n", fileName);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
std::string strDes(des);
|
|
|
|
jsonDict = new cs::JsonDictionary();
|
|
|
|
jsonDict->initWithDescription(strDes.c_str());
|
|
|
|
|
|
|
|
const char* fileVersion = DICTOOL->getStringValue_json(jsonDict, "version");
|
|
|
|
if (!fileVersion || getVersionInteger(fileVersion) < 250)
|
|
|
|
{
|
|
|
|
m_bOlderVersion = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
int texturesCount = DICTOOL->getArrayCount_json(jsonDict, "textures");
|
|
|
|
int pos = jsonpath.find_last_of('/');
|
|
|
|
m_strFilePath = jsonpath.substr(0,pos+1);
|
|
|
|
for (int i=0; i<texturesCount; i++)
|
|
|
|
{
|
|
|
|
const char* file = DICTOOL->getStringValueFromArray_json(jsonDict, "textures", i);
|
|
|
|
std::string tp = m_strFilePath;
|
|
|
|
tp.append(file);
|
|
|
|
CCUIHELPER->addSpriteFrame(tp.c_str());
|
|
|
|
}
|
|
|
|
float fileDesignWidth = DICTOOL->getFloatValue_json(jsonDict, "designWidth");
|
|
|
|
float fileDesignHeight = DICTOOL->getFloatValue_json(jsonDict, "designHeight");
|
|
|
|
if (fileDesignWidth <= 0 || fileDesignHeight <= 0) {
|
|
|
|
printf("Read design size error!\n");
|
2013-09-16 15:32:52 +08:00
|
|
|
Size winSize = Director::getInstance()->getWinSize();
|
2013-09-13 22:20:20 +08:00
|
|
|
CCUIHELPER->setFileDesignWidth(winSize.width);
|
|
|
|
CCUIHELPER->setFileDesignHeight(winSize.height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CCUIHELPER->setFileDesignWidth(fileDesignWidth);
|
|
|
|
CCUIHELPER->setFileDesignHeight(fileDesignHeight);
|
|
|
|
}
|
|
|
|
cs::JsonDictionary* widgetTree = DICTOOL->getSubDictionary_json(jsonDict, "widgetTree");
|
|
|
|
UIWidget* widget = widgetFromJsonDictionary(widgetTree);
|
|
|
|
|
|
|
|
/* *********temp********* */
|
2013-09-16 15:32:52 +08:00
|
|
|
if (widget->getContentSize().equals(Size::ZERO))
|
2013-09-13 22:20:20 +08:00
|
|
|
{
|
|
|
|
Layout* rootWidget = dynamic_cast<Layout*>(widget);
|
2013-09-16 15:32:52 +08:00
|
|
|
rootWidget->setSize(Size(fileDesignWidth, fileDesignHeight));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
/* ********************** */
|
|
|
|
|
|
|
|
// widget->setFileDesignSize(CCSizeMake(fileDesignWidth, fileDesignHeight));
|
|
|
|
cs::JsonDictionary* actions = DICTOOL->getSubDictionary_json(jsonDict, "animation");
|
|
|
|
/* *********temp********* */
|
2013-09-17 21:14:45 +08:00
|
|
|
// ActionManager::shareManager()->releaseActions();
|
2013-09-13 22:20:20 +08:00
|
|
|
/* ********************** */
|
|
|
|
CCLOG("file name == [%s]",fileName);
|
2013-09-17 21:14:45 +08:00
|
|
|
ActionManagerEx::shareManager()->initWithDictionary(fileName,actions,widget);
|
2013-09-13 22:20:20 +08:00
|
|
|
|
|
|
|
CC_SAFE_DELETE(widgetTree);
|
|
|
|
CC_SAFE_DELETE(actions);
|
|
|
|
CC_SAFE_DELETE(jsonDict);
|
|
|
|
CC_SAFE_DELETE_ARRAY(des);
|
|
|
|
return widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForWidgetFromJsonDictionary(UIWidget*widget,cs::JsonDictionary *options)
|
|
|
|
{
|
|
|
|
bool ignoreSizeExsit = DICTOOL->checkObjectExist_json(options, "ignoreSize");
|
|
|
|
if (ignoreSizeExsit)
|
|
|
|
{
|
|
|
|
widget->ignoreContentAdaptWithSize(DICTOOL->getBooleanValue_json(options, "ignoreSize"));
|
|
|
|
}
|
|
|
|
|
|
|
|
float w = DICTOOL->getFloatValue_json(options, "width");
|
|
|
|
float h = DICTOOL->getFloatValue_json(options, "height");
|
2013-09-16 15:32:52 +08:00
|
|
|
widget->setSize(Size(w, h));
|
2013-09-13 22:20:20 +08:00
|
|
|
|
|
|
|
widget->setTag(DICTOOL->getIntValue_json(options, "tag"));
|
|
|
|
widget->setActionTag(DICTOOL->getIntValue_json(options, "actiontag"));
|
|
|
|
widget->setTouchEnabled(DICTOOL->getBooleanValue_json(options, "touchAble"));
|
|
|
|
const char* name = DICTOOL->getStringValue_json(options, "name");
|
|
|
|
const char* widgetName = name?name:"default";
|
|
|
|
widget->setName(widgetName);
|
|
|
|
float x = DICTOOL->getFloatValue_json(options, "x");
|
|
|
|
float y = DICTOOL->getFloatValue_json(options, "y");
|
2013-09-16 15:32:52 +08:00
|
|
|
widget->setPosition(Point(x,y));
|
2013-09-13 22:20:20 +08:00
|
|
|
bool sx = DICTOOL->checkObjectExist_json(options, "scaleX");
|
|
|
|
if (sx)
|
|
|
|
{
|
|
|
|
widget->setScaleX(DICTOOL->getFloatValue_json(options, "scaleX"));
|
|
|
|
}
|
|
|
|
bool sy = DICTOOL->checkObjectExist_json(options, "scaleY");
|
|
|
|
if (sy)
|
|
|
|
{
|
|
|
|
widget->setScaleY(DICTOOL->getFloatValue_json(options, "scaleY"));
|
|
|
|
}
|
|
|
|
bool rt = DICTOOL->checkObjectExist_json(options, "rotation");
|
|
|
|
if (rt)
|
|
|
|
{
|
|
|
|
widget->setRotation(DICTOOL->getFloatValue_json(options, "rotation"));
|
|
|
|
}
|
|
|
|
bool vb = DICTOOL->checkObjectExist_json(options, "visible");
|
|
|
|
if (vb)
|
|
|
|
{
|
|
|
|
widget->setVisible(DICTOOL->getBooleanValue_json(options, "visible"));
|
|
|
|
}
|
|
|
|
// widget->setUseMergedTexture(DICTOOL->getBooleanValue_json(options, "useMergedTexture"));
|
|
|
|
int z = DICTOOL->getIntValue_json(options, "ZOrder");
|
|
|
|
widget->setZOrder(z);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setColorPropsForWidgetFromJsonDictionary(UIWidget *widget, cs::JsonDictionary *options)
|
|
|
|
{
|
|
|
|
bool op = DICTOOL->checkObjectExist_json(options, "opacity");
|
|
|
|
if (op)
|
|
|
|
{
|
|
|
|
widget->setOpacity(DICTOOL->getIntValue_json(options, "opacity"));
|
|
|
|
}
|
|
|
|
bool cr = DICTOOL->checkObjectExist_json(options, "colorR");
|
|
|
|
bool cg = DICTOOL->checkObjectExist_json(options, "colorG");
|
|
|
|
bool cb = DICTOOL->checkObjectExist_json(options, "colorB");
|
|
|
|
int colorR = cr ? DICTOOL->getIntValue_json(options, "colorR") : 255;
|
|
|
|
int colorG = cg ? DICTOOL->getIntValue_json(options, "colorG") : 255;
|
|
|
|
int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255;
|
2013-09-16 15:32:52 +08:00
|
|
|
widget->setColor(Color3B(colorR, colorG, colorB));
|
2013-09-13 22:20:20 +08:00
|
|
|
bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX");
|
|
|
|
float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : 0.5f;
|
|
|
|
bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY");
|
|
|
|
float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : 0.5f;
|
2013-09-16 15:32:52 +08:00
|
|
|
widget->setAnchorPoint(Point(apxf, apyf));
|
2013-09-13 22:20:20 +08:00
|
|
|
bool flipX = DICTOOL->getBooleanValue_json(options, "flipX");
|
|
|
|
bool flipY = DICTOOL->getBooleanValue_json(options, "flipY");
|
|
|
|
widget->setFlipX(flipX);
|
|
|
|
widget->setFlipY(flipY);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForButtonFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
if (m_bOlderVersion)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UIButton* button = (UIButton*)widget;
|
|
|
|
bool scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
|
|
|
button->setScale9Enabled(scale9Enable);
|
|
|
|
|
|
|
|
std::string tp_n = m_strFilePath;
|
|
|
|
std::string tp_p = m_strFilePath;
|
|
|
|
std::string tp_d = m_strFilePath;
|
|
|
|
|
|
|
|
const char* normalFileName = DICTOOL->getStringValue_json(options, "normal");
|
|
|
|
const char* pressedFileName = DICTOOL->getStringValue_json(options, "pressed");
|
|
|
|
const char* disabledFileName = DICTOOL->getStringValue_json(options, "disabled");
|
|
|
|
|
|
|
|
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL;
|
|
|
|
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL;
|
|
|
|
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():NULL;
|
|
|
|
bool useMergedTexture = DICTOOL->getBooleanValue_json(options, "useMergedTexture");
|
|
|
|
if (scale9Enable)
|
|
|
|
{
|
|
|
|
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
|
|
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
|
|
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
|
|
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
|
|
|
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
button->loadTextures(normalFileName, pressedFileName, disabledFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
button->loadTextures(normalFileName_tp, pressedFileName_tp, disabledFileName_tp);
|
|
|
|
}
|
2013-09-16 15:32:52 +08:00
|
|
|
button->setCapInsets(Rect(cx, cy, cw, ch));
|
2013-09-13 22:20:20 +08:00
|
|
|
bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");
|
|
|
|
bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");
|
|
|
|
if (sw && sh)
|
|
|
|
{
|
|
|
|
float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
|
|
|
|
float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
|
2013-09-16 15:32:52 +08:00
|
|
|
button->setSize(Size(swf, shf));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
button->loadTextures(normalFileName, pressedFileName, disabledFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
button->loadTextures(normalFileName_tp, pressedFileName_tp, disabledFileName_tp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UIButton* button = (UIButton*)widget;
|
|
|
|
bool scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
|
|
|
button->setScale9Enabled(scale9Enable);
|
|
|
|
|
|
|
|
cs::JsonDictionary* normalDic = DICTOOL->getSubDictionary_json(options, "normalData");
|
|
|
|
int normalType = DICTOOL->getIntValue_json(normalDic, "resourceType");
|
|
|
|
switch (normalType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_n = m_strFilePath;
|
|
|
|
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
|
|
|
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL;
|
|
|
|
button->loadTextureNormal(normalFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
|
|
|
button->loadTextureNormal(normalFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(normalDic);
|
|
|
|
cs::JsonDictionary* pressedDic = DICTOOL->getSubDictionary_json(options, "pressedData");
|
|
|
|
int pressedType = DICTOOL->getIntValue_json(pressedDic, "resourceType");
|
|
|
|
switch (pressedType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_p = m_strFilePath;
|
|
|
|
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
|
|
|
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL;
|
|
|
|
button->loadTexturePressed(pressedFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
|
|
|
button->loadTexturePressed(pressedFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pressedDic);
|
|
|
|
cs::JsonDictionary* disabledDic = DICTOOL->getSubDictionary_json(options, "disabledData");
|
|
|
|
int disabledType = DICTOOL->getIntValue_json(disabledDic, "resourceType");
|
|
|
|
switch (disabledType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_d = m_strFilePath;
|
|
|
|
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
|
|
|
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():NULL;
|
|
|
|
button->loadTextureDisabled(disabledFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
|
|
|
button->loadTextureDisabled(disabledFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(disabledDic);
|
|
|
|
if (scale9Enable)
|
|
|
|
{
|
|
|
|
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
|
|
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
|
|
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
|
|
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
|
|
|
|
2013-09-16 15:32:52 +08:00
|
|
|
button->setCapInsets(Rect(cx, cy, cw, ch));
|
2013-09-13 22:20:20 +08:00
|
|
|
bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");
|
|
|
|
bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");
|
|
|
|
if (sw && sh)
|
|
|
|
{
|
|
|
|
float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
|
|
|
|
float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
|
2013-09-16 15:32:52 +08:00
|
|
|
button->setSize(Size(swf, shf));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForCheckBoxFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
if (m_bOlderVersion)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UICheckBox* checkBox = (UICheckBox*)widget;
|
|
|
|
const char* backGroundFileName = DICTOOL->getStringValue_json(options, "backGroundBox");
|
|
|
|
const char* backGroundSelectedFileName = DICTOOL->getStringValue_json(options, "backGroundBoxSelected");
|
|
|
|
const char* frontCrossFileName = DICTOOL->getStringValue_json(options, "frontCross");
|
|
|
|
const char* backGroundDisabledFileName = DICTOOL->getStringValue_json(options, "backGroundBoxDisabled");
|
|
|
|
const char* frontCrossDisabledFileName = DICTOOL->getStringValue_json(options, "frontCrossDisabled");
|
|
|
|
|
|
|
|
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
std::string tp_bs = m_strFilePath;
|
|
|
|
std::string tp_c = m_strFilePath;
|
|
|
|
std::string tp_bd = m_strFilePath;
|
|
|
|
std::string tp_cd = m_strFilePath;
|
|
|
|
|
|
|
|
const char* backGroundFileName_tp = (backGroundFileName && (strcmp(backGroundFileName, "") != 0))?tp_b.append(backGroundFileName).c_str():NULL;
|
|
|
|
const char* backGroundSelectedFileName_tp = (backGroundSelectedFileName && (strcmp(backGroundSelectedFileName, "") != 0))?tp_bs.append(backGroundSelectedFileName).c_str():NULL;
|
|
|
|
const char* frontCrossFileName_tp = (frontCrossFileName && (strcmp(frontCrossFileName, "") != 0))?tp_c.append(frontCrossFileName).c_str():NULL;
|
|
|
|
const char* backGroundDisabledFileName_tp = (backGroundDisabledFileName && (strcmp(backGroundDisabledFileName, "") != 0))?tp_bd.append(backGroundDisabledFileName).c_str():NULL;
|
|
|
|
const char* frontCrossDisabledFileName_tp = (frontCrossDisabledFileName && (strcmp(frontCrossDisabledFileName, "") != 0))?tp_cd.append(frontCrossDisabledFileName).c_str():NULL;
|
|
|
|
bool useMergedTexture = DICTOOL->getBooleanValue_json(options, "useMergedTexture");
|
|
|
|
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
checkBox->loadTextures(backGroundFileName, backGroundSelectedFileName, frontCrossFileName,backGroundDisabledFileName,frontCrossDisabledFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
checkBox->loadTextures(backGroundFileName_tp, backGroundSelectedFileName_tp, frontCrossFileName_tp,backGroundDisabledFileName_tp,frontCrossDisabledFileName_tp);
|
|
|
|
}
|
|
|
|
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UICheckBox* checkBox = (UICheckBox*)widget;
|
|
|
|
|
|
|
|
cs::JsonDictionary* backGroundDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxData");
|
|
|
|
int backGroundType = DICTOOL->getIntValue_json(backGroundDic, "resourceType");
|
|
|
|
switch (backGroundType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
const char* backGroundFileName = DICTOOL->getStringValue_json(backGroundDic, "path");
|
|
|
|
const char* backGroundFileName_tp = (backGroundFileName && (strcmp(backGroundFileName, "") != 0))?tp_b.append(backGroundFileName).c_str():NULL;
|
|
|
|
checkBox->loadTextureBackGround(backGroundFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* backGroundFileName = DICTOOL->getStringValue_json(backGroundDic, "path");
|
|
|
|
checkBox->loadTextureBackGround(backGroundFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(backGroundDic);
|
|
|
|
|
|
|
|
cs::JsonDictionary* backGroundSelectedDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxSelectedData");
|
|
|
|
int backGroundSelectedType = DICTOOL->getIntValue_json(backGroundSelectedDic, "resourceType");
|
|
|
|
switch (backGroundSelectedType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_bs = m_strFilePath;
|
|
|
|
const char* backGroundSelectedFileName = DICTOOL->getStringValue_json(backGroundSelectedDic, "path");
|
|
|
|
const char* backGroundSelectedFileName_tp = (backGroundSelectedFileName && (strcmp(backGroundSelectedFileName, "") != 0))?tp_bs.append(backGroundSelectedFileName).c_str():NULL;
|
|
|
|
checkBox->loadTextureBackGroundSelected(backGroundSelectedFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* backGroundSelectedFileName = DICTOOL->getStringValue_json(backGroundSelectedDic, "path");
|
|
|
|
checkBox->loadTextureBackGroundSelected(backGroundSelectedFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(backGroundSelectedDic);
|
|
|
|
|
|
|
|
cs::JsonDictionary* frontCrossDic = DICTOOL->getSubDictionary_json(options, "frontCrossData");
|
|
|
|
int frontCrossType = DICTOOL->getIntValue_json(frontCrossDic, "resourceType");
|
|
|
|
switch (frontCrossType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_c = m_strFilePath;
|
|
|
|
const char* frontCrossFileName = DICTOOL->getStringValue_json(frontCrossDic, "path");
|
|
|
|
const char* frontCrossFileName_tp = (frontCrossFileName && (strcmp(frontCrossFileName, "") != 0))?tp_c.append(frontCrossFileName).c_str():NULL;
|
|
|
|
checkBox->loadTextureFrontCross(frontCrossFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* frontCrossFileName = DICTOOL->getStringValue_json(frontCrossDic, "path");
|
|
|
|
checkBox->loadTextureFrontCross(frontCrossFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(frontCrossDic);
|
|
|
|
|
|
|
|
cs::JsonDictionary* backGroundDisabledDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxDisabledData");
|
|
|
|
int backGroundDisabledType = DICTOOL->getIntValue_json(backGroundDisabledDic, "resourceType");
|
|
|
|
switch (backGroundDisabledType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_bd = m_strFilePath;
|
|
|
|
const char* backGroundDisabledFileName = DICTOOL->getStringValue_json(backGroundDisabledDic, "path");
|
|
|
|
const char* backGroundDisabledFileName_tp = (backGroundDisabledFileName && (strcmp(backGroundDisabledFileName, "") != 0))?tp_bd.append(backGroundDisabledFileName).c_str():NULL;
|
|
|
|
checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* backGroundDisabledFileName = DICTOOL->getStringValue_json(backGroundDisabledDic, "path");
|
|
|
|
checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(backGroundDisabledDic);
|
|
|
|
|
|
|
|
cs::JsonDictionary* frontCrossDisabledDic = DICTOOL->getSubDictionary_json(options, "frontCrossDisabledData");
|
|
|
|
int frontCrossDisabledType = DICTOOL->getIntValue_json(frontCrossDisabledDic, "resourceType");
|
|
|
|
switch (frontCrossDisabledType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_cd = m_strFilePath;
|
|
|
|
const char* frontCrossDisabledFileName = DICTOOL->getStringValue_json(options, "path");
|
|
|
|
const char* frontCrossDisabledFileName_tp = (frontCrossDisabledFileName && (strcmp(frontCrossDisabledFileName, "") != 0))?tp_cd.append(frontCrossDisabledFileName).c_str():NULL;
|
|
|
|
checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* frontCrossDisabledFileName = DICTOOL->getStringValue_json(options, "path");
|
|
|
|
checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(frontCrossDisabledDic);
|
|
|
|
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForImageViewFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
if (m_bOlderVersion)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
|
|
|
|
UIImageView* imageView = (UIImageView*)widget;
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(options, "fileName");
|
|
|
|
bool scale9EnableExist = DICTOOL->checkObjectExist_json(options, "scale9Enable");
|
|
|
|
bool scale9Enable = false;
|
|
|
|
if (scale9EnableExist)
|
|
|
|
{
|
|
|
|
scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
|
|
|
}
|
|
|
|
imageView->setScale9Enabled(scale9Enable);
|
|
|
|
|
|
|
|
std::string tp_i = m_strFilePath;
|
|
|
|
const char* imageFileName_tp = NULL;
|
|
|
|
if (imageFileName && (strcmp(imageFileName, "") != 0))
|
|
|
|
{
|
|
|
|
imageFileName_tp = tp_i.append(imageFileName).c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool useMergedTexture = DICTOOL->getBooleanValue_json(options, "useMergedTexture");
|
|
|
|
if (scale9Enable)
|
|
|
|
{
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
imageView->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
imageView->loadTexture(imageFileName_tp);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");
|
|
|
|
bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");
|
|
|
|
if (sw && sh)
|
|
|
|
{
|
|
|
|
float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
|
|
|
|
float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
|
2013-09-16 15:32:52 +08:00
|
|
|
imageView->setSize(Size(swf, shf));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
|
|
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
|
|
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
|
|
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
2013-09-16 15:32:52 +08:00
|
|
|
imageView->setCapInsets(Rect(cx, cy, cw, ch));
|
2013-09-13 22:20:20 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
imageView->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
imageView->loadTexture(imageFileName_tp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
|
|
|
|
UIImageView* imageView = (UIImageView*)widget;
|
|
|
|
|
|
|
|
cs::JsonDictionary* imageFileNameDic = DICTOOL->getSubDictionary_json(options, "fileNameData");
|
|
|
|
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
|
|
|
switch (imageFileNameType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_i = m_strFilePath;
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
|
|
const char* imageFileName_tp = NULL;
|
|
|
|
if (imageFileName && (strcmp(imageFileName, "") != 0))
|
|
|
|
{
|
|
|
|
imageFileName_tp = tp_i.append(imageFileName).c_str();
|
|
|
|
imageView->loadTexture(imageFileName_tp);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
|
|
imageView->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(imageFileNameDic);
|
|
|
|
|
|
|
|
bool scale9EnableExist = DICTOOL->checkObjectExist_json(options, "scale9Enable");
|
|
|
|
bool scale9Enable = false;
|
|
|
|
if (scale9EnableExist)
|
|
|
|
{
|
|
|
|
scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
|
|
|
}
|
|
|
|
imageView->setScale9Enabled(scale9Enable);
|
|
|
|
|
|
|
|
|
|
|
|
if (scale9Enable)
|
|
|
|
{
|
|
|
|
bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");
|
|
|
|
bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");
|
|
|
|
if (sw && sh)
|
|
|
|
{
|
|
|
|
float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
|
|
|
|
float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
|
2013-09-16 15:32:52 +08:00
|
|
|
imageView->setSize(Size(swf, shf));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
|
|
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
|
|
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
|
|
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
|
|
|
|
2013-09-16 15:32:52 +08:00
|
|
|
imageView->setCapInsets(Rect(cx, cy, cw, ch));
|
2013-09-13 22:20:20 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForLabelFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UILabel* label = (UILabel*)widget;
|
|
|
|
bool touchScaleChangeAble = DICTOOL->getBooleanValue_json(options, "touchScaleEnable");
|
|
|
|
label->setTouchScaleChangeAble(touchScaleChangeAble);
|
|
|
|
const char* text = DICTOOL->getStringValue_json(options, "text");
|
|
|
|
label->setText(text);
|
|
|
|
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
|
|
|
|
if (fs)
|
|
|
|
{
|
|
|
|
label->setFontSize(DICTOOL->getIntValue_json(options, "fontSize"));
|
|
|
|
}
|
|
|
|
bool fn = DICTOOL->checkObjectExist_json(options, "fontName");
|
|
|
|
if (fn)
|
|
|
|
{
|
|
|
|
label->setFontName(DICTOOL->getStringValue_json(options, "fontName"));
|
|
|
|
}
|
|
|
|
bool cro = DICTOOL->checkObjectExist_json(options, "colorR");
|
|
|
|
bool cgo = DICTOOL->checkObjectExist_json(options, "colorG");
|
|
|
|
bool cbo = DICTOOL->checkObjectExist_json(options, "colorB");
|
|
|
|
int cr = cro?DICTOOL->getIntValue_json(options, "colorR"):255;
|
|
|
|
int cg = cgo?DICTOOL->getIntValue_json(options, "colorG"):255;
|
|
|
|
int cb = cbo?DICTOOL->getIntValue_json(options, "colorB"):255;
|
2013-09-16 15:32:52 +08:00
|
|
|
Color3B tc = Color3B(cr, cg, cb);
|
2013-09-13 22:20:20 +08:00
|
|
|
label->setColor(tc);
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForLabelAtlasFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
if (m_bOlderVersion)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UILabelAtlas* labelAtlas = (UILabelAtlas*)widget;
|
|
|
|
bool sv = DICTOOL->checkObjectExist_json(options, "stringValue");
|
|
|
|
bool cmf = DICTOOL->checkObjectExist_json(options, "charMapFile");
|
|
|
|
bool iw = DICTOOL->checkObjectExist_json(options, "itemWidth");
|
|
|
|
bool ih = DICTOOL->checkObjectExist_json(options, "itemHeight");
|
|
|
|
bool scm = DICTOOL->checkObjectExist_json(options, "startCharMap");
|
|
|
|
if (sv && cmf && iw && ih && scm && (strcmp(DICTOOL->getStringValue_json(options, "charMapFile"), "") != 0))
|
|
|
|
{
|
|
|
|
std::string tp_c = m_strFilePath;
|
|
|
|
const char* cmf_tp = NULL;
|
|
|
|
const char* cmft = DICTOOL->getStringValue_json(options, "charMapFile");
|
|
|
|
cmf_tp = tp_c.append(cmft).c_str();
|
|
|
|
|
|
|
|
labelAtlas->setProperty(DICTOOL->getStringValue_json(options, "stringValue"),cmf_tp,DICTOOL->getIntValue_json(options, "itemWidth"),DICTOOL->getIntValue_json(options,"itemHeight"),DICTOOL->getStringValue_json(options, "startCharMap"));
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UILabelAtlas* labelAtlas = (UILabelAtlas*)widget;
|
|
|
|
bool sv = DICTOOL->checkObjectExist_json(options, "stringValue");
|
|
|
|
bool cmf = DICTOOL->checkObjectExist_json(options, "charMapFile");
|
|
|
|
bool iw = DICTOOL->checkObjectExist_json(options, "itemWidth");
|
|
|
|
bool ih = DICTOOL->checkObjectExist_json(options, "itemHeight");
|
|
|
|
bool scm = DICTOOL->checkObjectExist_json(options, "startCharMap");
|
|
|
|
if (sv && cmf && iw && ih && scm)
|
|
|
|
{
|
|
|
|
|
|
|
|
cs::JsonDictionary* cmftDic = DICTOOL->getSubDictionary_json(options, "charMapFileData");
|
|
|
|
int cmfType = DICTOOL->getIntValue_json(cmftDic, "resourceType");
|
|
|
|
switch (cmfType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_c = m_strFilePath;
|
|
|
|
const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, "path");
|
|
|
|
const char* cmf_tp = tp_c.append(cmfPath).c_str();
|
|
|
|
labelAtlas->setProperty(DICTOOL->getStringValue_json(options, "stringValue"),cmf_tp,DICTOOL->getIntValue_json(options, "itemWidth"),DICTOOL->getIntValue_json(options,"itemHeight"),DICTOOL->getStringValue_json(options, "startCharMap"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
CCLOG("Wrong res type of LabelAtlas!");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(cmftDic);
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForContainerWidgetFromJsonDictionary(UIWidget *widget, cs::JsonDictionary *options)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
Layout* containerWidget = (Layout*)widget;
|
|
|
|
if (!dynamic_cast<UIScrollView*>(containerWidget)
|
|
|
|
&& !dynamic_cast<UIListView*>(containerWidget)
|
|
|
|
&& !dynamic_cast<UIDragPanel*>(containerWidget))
|
|
|
|
{
|
|
|
|
containerWidget->setClippingEnabled(DICTOOL->getBooleanValue_json(options, "clipAble"));
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForPanelFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
if (m_bOlderVersion)
|
|
|
|
{
|
|
|
|
setPropsForContainerWidgetFromJsonDictionary(widget, options);
|
|
|
|
Layout* panel = (Layout*)widget;
|
|
|
|
bool backGroundScale9Enable = DICTOOL->getBooleanValue_json(options, "backGroundScale9Enable");
|
|
|
|
panel->setBackGroundImageScale9Enabled(backGroundScale9Enable);
|
|
|
|
int cr = DICTOOL->getIntValue_json(options, "bgColorR");
|
|
|
|
int cg = DICTOOL->getIntValue_json(options, "bgColorG");
|
|
|
|
int cb = DICTOOL->getIntValue_json(options, "bgColorB");
|
|
|
|
|
|
|
|
int scr = DICTOOL->getIntValue_json(options, "bgStartColorR");
|
|
|
|
int scg = DICTOOL->getIntValue_json(options, "bgStartColorG");
|
|
|
|
int scb = DICTOOL->getIntValue_json(options, "bgStartColorB");
|
|
|
|
|
|
|
|
int ecr = DICTOOL->getIntValue_json(options, "bgEndColorR");
|
|
|
|
int ecg = DICTOOL->getIntValue_json(options, "bgEndColorG");
|
|
|
|
int ecb = DICTOOL->getIntValue_json(options, "bgEndColorB");
|
|
|
|
|
|
|
|
float bgcv1 = DICTOOL->getFloatValue_json(options, "vectorX");
|
|
|
|
float bgcv2 = DICTOOL->getFloatValue_json(options, "vectorY");
|
2013-09-16 15:32:52 +08:00
|
|
|
panel->setBackGroundColorVector(Point(bgcv1, bgcv2));
|
2013-09-13 22:20:20 +08:00
|
|
|
|
|
|
|
int co = DICTOOL->getIntValue_json(options, "bgColorOpacity");
|
|
|
|
|
|
|
|
int colorType = DICTOOL->getIntValue_json(options, "colorType");
|
|
|
|
panel->setBackGroundColorType(LayoutBackGroundColorType(colorType));
|
|
|
|
// float w = DICTOOL->getFloatValue_json(options, "width");
|
|
|
|
// float h = DICTOOL->getFloatValue_json(options, "height");
|
2013-09-16 15:32:52 +08:00
|
|
|
panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb));
|
|
|
|
panel->setBackGroundColor(Color3B(cr, cg, cb));
|
2013-09-13 22:20:20 +08:00
|
|
|
panel->setBackGroundColorOpacity(co);
|
|
|
|
// panel->setSize(CCSizeMake(w, h));
|
|
|
|
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(options, "backGroundImage");
|
|
|
|
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL;
|
|
|
|
bool useMergedTexture = DICTOOL->getBooleanValue_json(options, "useMergedTexture");
|
|
|
|
if (backGroundScale9Enable)
|
|
|
|
{
|
|
|
|
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
|
|
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
|
|
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
|
|
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
panel->setBackGroundImage(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
panel->setBackGroundImage(imageFileName_tp);
|
|
|
|
}
|
2013-09-16 15:32:52 +08:00
|
|
|
panel->setBackGroundImageCapInsets(Rect(cx, cy, cw, ch));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
panel->setBackGroundImage(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
panel->setBackGroundImage(imageFileName_tp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setPropsForContainerWidgetFromJsonDictionary(widget, options);
|
|
|
|
Layout* panel = (Layout*)widget;
|
|
|
|
bool backGroundScale9Enable = DICTOOL->getBooleanValue_json(options, "backGroundScale9Enable");
|
|
|
|
panel->setBackGroundImageScale9Enabled(backGroundScale9Enable);
|
|
|
|
int cr = DICTOOL->getIntValue_json(options, "bgColorR");
|
|
|
|
int cg = DICTOOL->getIntValue_json(options, "bgColorG");
|
|
|
|
int cb = DICTOOL->getIntValue_json(options, "bgColorB");
|
|
|
|
|
|
|
|
int scr = DICTOOL->getIntValue_json(options, "bgStartColorR");
|
|
|
|
int scg = DICTOOL->getIntValue_json(options, "bgStartColorG");
|
|
|
|
int scb = DICTOOL->getIntValue_json(options, "bgStartColorB");
|
|
|
|
|
|
|
|
int ecr = DICTOOL->getIntValue_json(options, "bgEndColorR");
|
|
|
|
int ecg = DICTOOL->getIntValue_json(options, "bgEndColorG");
|
|
|
|
int ecb = DICTOOL->getIntValue_json(options, "bgEndColorB");
|
|
|
|
|
|
|
|
float bgcv1 = DICTOOL->getFloatValue_json(options, "vectorX");
|
|
|
|
float bgcv2 = DICTOOL->getFloatValue_json(options, "vectorY");
|
2013-09-16 15:32:52 +08:00
|
|
|
panel->setBackGroundColorVector(Point(bgcv1, bgcv2));
|
2013-09-13 22:20:20 +08:00
|
|
|
|
|
|
|
int co = DICTOOL->getIntValue_json(options, "bgColorOpacity");
|
|
|
|
|
|
|
|
int colorType = DICTOOL->getIntValue_json(options, "colorType");
|
|
|
|
panel->setBackGroundColorType(LayoutBackGroundColorType(colorType));
|
|
|
|
// float w = DICTOOL->getFloatValue_json(options, "width");
|
|
|
|
// float h = DICTOOL->getFloatValue_json(options, "height");
|
2013-09-16 15:32:52 +08:00
|
|
|
panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb));
|
|
|
|
panel->setBackGroundColor(Color3B(cr, cg, cb));
|
2013-09-13 22:20:20 +08:00
|
|
|
panel->setBackGroundColorOpacity(co);
|
|
|
|
// panel->setSize(CCSizeMake(w, h));
|
|
|
|
|
|
|
|
|
|
|
|
cs::JsonDictionary* imageFileNameDic = DICTOOL->getSubDictionary_json(options, "backGroundImageData");
|
|
|
|
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
|
|
|
switch (imageFileNameType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
|
|
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL;
|
|
|
|
panel->setBackGroundImage(imageFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
|
|
panel->setBackGroundImage(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(imageFileNameDic);
|
|
|
|
|
|
|
|
if (backGroundScale9Enable)
|
|
|
|
{
|
|
|
|
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
|
|
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
|
|
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
|
|
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
2013-09-16 15:32:52 +08:00
|
|
|
panel->setBackGroundImageCapInsets(Rect(cx, cy, cw, ch));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForScrollViewFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
setPropsForPanelFromJsonDictionary(widget, options);
|
|
|
|
UIScrollView* scrollView = (UIScrollView*)widget;
|
|
|
|
float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth");
|
|
|
|
float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight");
|
2013-09-16 15:32:52 +08:00
|
|
|
scrollView->setInnerContainerSize(Size(innerWidth, innerHeight));
|
2013-09-13 22:20:20 +08:00
|
|
|
/* gui mark */
|
|
|
|
int direction = DICTOOL->getFloatValue_json(options, "direction");
|
|
|
|
scrollView->setDirection((SCROLLVIEW_DIR)direction);
|
|
|
|
/**/
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForSliderFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
if (m_bOlderVersion)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UISlider* slider = (UISlider*)widget;
|
|
|
|
|
|
|
|
bool barTextureScale9Enable = DICTOOL->getBooleanValue_json(options, "barTextureScale9Enable");
|
|
|
|
slider->setScale9Enabled(barTextureScale9Enable);
|
|
|
|
bool bt = DICTOOL->checkObjectExist_json(options, "barFileName");
|
|
|
|
float barLength = DICTOOL->getFloatValue_json(options, "length");
|
|
|
|
bool useMergedTexture = DICTOOL->getBooleanValue_json(options, "useMergedTexture");
|
|
|
|
if (bt)
|
|
|
|
{
|
|
|
|
if (barTextureScale9Enable)
|
|
|
|
{
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(options, "barFileName");
|
|
|
|
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL;
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
slider->loadBarTexture(imageFileName_tp);
|
|
|
|
}
|
2013-09-16 15:32:52 +08:00
|
|
|
slider->setSize(Size(barLength, slider->getContentSize().height));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(options, "barFileName");
|
|
|
|
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL;
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
slider->loadBarTexture(imageFileName_tp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::string tp_n = m_strFilePath;
|
|
|
|
std::string tp_p = m_strFilePath;
|
|
|
|
std::string tp_d = m_strFilePath;
|
|
|
|
|
|
|
|
const char* normalFileName = DICTOOL->getStringValue_json(options, "ballNormal");
|
|
|
|
const char* pressedFileName = DICTOOL->getStringValue_json(options, "ballPressed");
|
|
|
|
const char* disabledFileName = DICTOOL->getStringValue_json(options, "ballDisabled");
|
|
|
|
|
|
|
|
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL;
|
|
|
|
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL;
|
|
|
|
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():NULL;
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
slider->loadSlidBallTextures(normalFileName,pressedFileName,disabledFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
slider->loadSlidBallTextures(normalFileName_tp,pressedFileName_tp,disabledFileName_tp);
|
|
|
|
}
|
|
|
|
slider->setPercent(DICTOOL->getIntValue_json(options, "percent"));
|
|
|
|
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(options, "progressBarFileName");
|
|
|
|
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL;
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
slider->loadProgressBarTexture(imageFileName, UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
slider->loadProgressBarTexture(imageFileName_tp);
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UISlider* slider = (UISlider*)widget;
|
|
|
|
|
|
|
|
bool barTextureScale9Enable = DICTOOL->getBooleanValue_json(options, "barTextureScale9Enable");
|
|
|
|
slider->setScale9Enabled(barTextureScale9Enable);
|
|
|
|
bool bt = DICTOOL->checkObjectExist_json(options, "barFileName");
|
|
|
|
float barLength = DICTOOL->getFloatValue_json(options, "length");
|
|
|
|
if (bt)
|
|
|
|
{
|
|
|
|
if (barTextureScale9Enable)
|
|
|
|
{
|
|
|
|
|
|
|
|
cs::JsonDictionary* imageFileNameDic = DICTOOL->getSubDictionary_json(options, "barFileNameData");
|
|
|
|
int imageFileType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
|
|
|
switch (imageFileType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
|
|
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL;
|
|
|
|
slider->loadBarTexture(imageFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
|
|
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-09-16 15:32:52 +08:00
|
|
|
slider->setSize(Size(barLength, slider->getContentSize().height));
|
2013-09-13 22:20:20 +08:00
|
|
|
CC_SAFE_DELETE(imageFileNameDic);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cs::JsonDictionary* imageFileNameDic = DICTOOL->getSubDictionary_json(options, "barFileNameData");
|
|
|
|
int imageFileType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
|
|
|
switch (imageFileType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
const char*imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
|
|
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL;
|
|
|
|
slider->loadBarTexture(imageFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char*imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
|
|
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(imageFileNameDic);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// std::string tp_n = m_strFilePath;
|
|
|
|
// std::string tp_p = m_strFilePath;
|
|
|
|
// std::string tp_d = m_strFilePath;
|
|
|
|
//
|
|
|
|
// const char* normalFileName = DICTOOL->getStringValue_json(options, "ballNormal");
|
|
|
|
// const char* pressedFileName = DICTOOL->getStringValue_json(options, "ballPressed");
|
|
|
|
// const char* disabledFileName = DICTOOL->getStringValue_json(options, "ballDisabled");
|
|
|
|
//
|
|
|
|
// const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL;
|
|
|
|
// const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL;
|
|
|
|
// const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():NULL;
|
|
|
|
// if (useMergedTexture)
|
|
|
|
// {
|
|
|
|
// slider->setSlidBallTextures(normalFileName,pressedFileName,disabledFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// slider->setSlidBallTextures(normalFileName_tp,pressedFileName_tp,disabledFileName_tp);
|
|
|
|
// }
|
|
|
|
|
|
|
|
cs::JsonDictionary* normalDic = DICTOOL->getSubDictionary_json(options, "ballNormalData");
|
|
|
|
int normalType = DICTOOL->getIntValue_json(normalDic, "resourceType");
|
|
|
|
switch (normalType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_n = m_strFilePath;
|
|
|
|
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
|
|
|
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL;
|
|
|
|
slider->loadSlidBallTextureNormal(normalFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
|
|
|
slider->loadSlidBallTextureNormal(normalFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(normalDic);
|
|
|
|
|
|
|
|
cs::JsonDictionary* pressedDic = DICTOOL->getSubDictionary_json(options, "ballPressedData");
|
|
|
|
int pressedType = DICTOOL->getIntValue_json(pressedDic, "resourceType");
|
|
|
|
switch (pressedType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_p = m_strFilePath;
|
|
|
|
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
|
|
|
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL;
|
|
|
|
slider->loadSlidBallTexturePressed(pressedFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
|
|
|
slider->loadSlidBallTexturePressed(pressedFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pressedDic);
|
|
|
|
|
|
|
|
cs::JsonDictionary* disabledDic = DICTOOL->getSubDictionary_json(options, "ballDisabledData");
|
|
|
|
int disabledType = DICTOOL->getIntValue_json(disabledDic, "resourceType");
|
|
|
|
switch (disabledType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_d = m_strFilePath;
|
|
|
|
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
|
|
|
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():NULL;
|
|
|
|
slider->loadSlidBallTextureDisabled(disabledFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
|
|
|
slider->loadSlidBallTextureDisabled(disabledFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(disabledDic);
|
|
|
|
|
|
|
|
slider->setPercent(DICTOOL->getIntValue_json(options, "percent"));
|
|
|
|
|
|
|
|
cs::JsonDictionary* progressBarDic = DICTOOL->getSubDictionary_json(options, "progressBarData");
|
|
|
|
int progressBarType = DICTOOL->getIntValue_json(progressBarDic, "resourceType");
|
|
|
|
switch (progressBarType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(progressBarDic, "path");
|
|
|
|
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL;
|
|
|
|
slider->loadProgressBarTexture(imageFileName_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(progressBarDic, "path");
|
|
|
|
slider->loadProgressBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForTextAreaFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UILabel* textArea = (UILabel*)widget;
|
|
|
|
textArea->setText(DICTOOL->getStringValue_json(options, "text"));
|
|
|
|
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
|
|
|
|
if (fs)
|
|
|
|
{
|
|
|
|
textArea->setFontSize(DICTOOL->getIntValue_json(options, "fontSize"));
|
|
|
|
}
|
|
|
|
int cr = DICTOOL->getIntValue_json(options, "colorR");
|
|
|
|
int cg = DICTOOL->getIntValue_json(options, "colorG");
|
|
|
|
int cb = DICTOOL->getIntValue_json(options, "colorB");
|
2013-09-16 15:32:52 +08:00
|
|
|
textArea->setColor(Color3B(cr, cg, cb));
|
2013-09-13 22:20:20 +08:00
|
|
|
textArea->setFontName(DICTOOL->getStringValue_json(options, "fontName"));
|
|
|
|
bool aw = DICTOOL->checkObjectExist_json(options, "areaWidth");
|
|
|
|
bool ah = DICTOOL->checkObjectExist_json(options, "areaHeight");
|
|
|
|
if (aw && ah)
|
|
|
|
{
|
2013-09-16 15:32:52 +08:00
|
|
|
Size size = Size(DICTOOL->getFloatValue_json(options, "areaWidth"),DICTOOL->getFloatValue_json(options,"areaHeight"));
|
2013-09-13 22:20:20 +08:00
|
|
|
textArea->setTextAreaSize(size);
|
|
|
|
}
|
|
|
|
bool ha = DICTOOL->checkObjectExist_json(options, "hAlignment");
|
|
|
|
if (ha)
|
|
|
|
{
|
2013-09-16 15:32:52 +08:00
|
|
|
textArea->setTextHorizontalAlignment((TextHAlignment)DICTOOL->getIntValue_json(options, "hAlignment"));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
bool va = DICTOOL->checkObjectExist_json(options, "vAlignment");
|
|
|
|
if (va)
|
|
|
|
{
|
2013-09-16 15:32:52 +08:00
|
|
|
textArea->setTextVerticalAlignment((TextVAlignment)DICTOOL->getIntValue_json(options, "vAlignment"));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForTextButtonFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
setPropsForButtonFromJsonDictionary(widget, options);
|
|
|
|
|
|
|
|
|
|
|
|
UIButton* textButton = (UIButton*)widget;
|
|
|
|
textButton->setTitleText(DICTOOL->getStringValue_json(options, "text"));
|
|
|
|
bool cr = DICTOOL->checkObjectExist_json(options, "textColorR");
|
|
|
|
bool cg = DICTOOL->checkObjectExist_json(options, "textColorG");
|
|
|
|
bool cb = DICTOOL->checkObjectExist_json(options, "textColorB");
|
|
|
|
int cri = cr?DICTOOL->getIntValue_json(options, "textColorR"):255;
|
|
|
|
int cgi = cg?DICTOOL->getIntValue_json(options, "textColorG"):255;
|
|
|
|
int cbi = cb?DICTOOL->getIntValue_json(options, "textColorB"):255;
|
2013-09-16 15:32:52 +08:00
|
|
|
textButton->setTitleColor(Color3B(cri,cgi,cbi));
|
2013-09-13 22:20:20 +08:00
|
|
|
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
|
|
|
|
if (fs)
|
|
|
|
{
|
|
|
|
textButton->setTitleFontSize(DICTOOL->getIntValue_json(options, "fontSize"));
|
|
|
|
}
|
|
|
|
bool fn = DICTOOL->checkObjectExist_json(options, "fontName");
|
|
|
|
if (fn)
|
|
|
|
{
|
|
|
|
textButton->setTitleFontName(DICTOOL->getStringValue_json(options, "fontName"));
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForTextFieldFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UITextField* textField = (UITextField*)widget;
|
|
|
|
bool ph = DICTOOL->checkObjectExist_json(options, "placeHolder");
|
|
|
|
if (ph)
|
|
|
|
{
|
|
|
|
textField->setPlaceHolder(DICTOOL->getStringValue_json(options, "placeHolder"));
|
|
|
|
}
|
|
|
|
textField->setText(DICTOOL->getStringValue_json(options, "text"));
|
|
|
|
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
|
|
|
|
if (fs)
|
|
|
|
{
|
|
|
|
textField->setFontSize(DICTOOL->getIntValue_json(options, "fontSize"));
|
|
|
|
}
|
|
|
|
bool fn = DICTOOL->checkObjectExist_json(options, "fontName");
|
|
|
|
if (fn)
|
|
|
|
{
|
|
|
|
textField->setFontName(DICTOOL->getStringValue_json(options, "fontName"));
|
|
|
|
}
|
|
|
|
bool tsw = DICTOOL->checkObjectExist_json(options, "touchSizeWidth");
|
|
|
|
bool tsh = DICTOOL->checkObjectExist_json(options, "touchSizeHeight");
|
|
|
|
if (tsw && tsh)
|
|
|
|
{
|
2013-09-16 15:32:52 +08:00
|
|
|
textField->setTouchSize(Size(DICTOOL->getFloatValue_json(options, "touchSizeWidth"), DICTOOL->getFloatValue_json(options,"touchSizeHeight")));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
float dw = DICTOOL->getFloatValue_json(options, "width");
|
|
|
|
float dh = DICTOOL->getFloatValue_json(options, "height");
|
|
|
|
if (dw > 0.0f || dh > 0.0f)
|
|
|
|
{
|
|
|
|
//textField->setSize(CCSizeMake(dw, dh));
|
|
|
|
}
|
|
|
|
bool maxLengthEnable = DICTOOL->getBooleanValue_json(options, "maxLengthEnable");
|
|
|
|
textField->setMaxLengthEnable(maxLengthEnable);
|
|
|
|
|
|
|
|
if (maxLengthEnable)
|
|
|
|
{
|
|
|
|
int maxLength = DICTOOL->getIntValue_json(options, "maxLength");
|
|
|
|
textField->setMaxLength(maxLength);
|
|
|
|
}
|
|
|
|
bool passwordEnable = DICTOOL->getBooleanValue_json(options, "passwordEnable");
|
|
|
|
textField->setPasswordEnable(passwordEnable);
|
|
|
|
if (passwordEnable)
|
|
|
|
{
|
|
|
|
textField->setPasswordStyleText(DICTOOL->getStringValue_json(options, "passwordStyleText"));
|
|
|
|
}
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForLoadingBarFromJsonDictionary(UIWidget *widget, cs::JsonDictionary *options)
|
|
|
|
{
|
|
|
|
if (m_bOlderVersion)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UILoadingBar* loadingBar = (UILoadingBar*)widget;
|
|
|
|
bool useMergedTexture = DICTOOL->getBooleanValue_json(options, "useMergedTexture");
|
|
|
|
std::string tp_b = m_strFilePath;
|
|
|
|
const char*imageFileName = DICTOOL->getStringValue_json(options, "texture");
|
|
|
|
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL;
|
|
|
|
if (useMergedTexture)
|
|
|
|
{
|
|
|
|
loadingBar->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
loadingBar->loadTexture(imageFileName_tp);
|
|
|
|
}
|
|
|
|
loadingBar->setDirection(LoadingBarType(DICTOOL->getIntValue_json(options, "direction")));
|
|
|
|
loadingBar->setPercent(DICTOOL->getIntValue_json(options, "percent"));
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
UILoadingBar* loadingBar = (UILoadingBar*)widget;
|
|
|
|
|
|
|
|
cs::JsonDictionary* imageFileNameDic = DICTOOL->getSubDictionary_json(options, "textureData");
|
|
|
|
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
|
|
|
switch (imageFileNameType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_i = m_strFilePath;
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
|
|
const char* imageFileName_tp = NULL;
|
|
|
|
if (imageFileName && (strcmp(imageFileName, "") != 0))
|
|
|
|
{
|
|
|
|
imageFileName_tp = tp_i.append(imageFileName).c_str();
|
|
|
|
loadingBar->loadTexture(imageFileName_tp);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
|
|
loadingBar->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(imageFileNameDic);
|
|
|
|
|
|
|
|
/* gui mark add load bar scale9 parse */
|
|
|
|
bool scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
|
|
|
loadingBar->setScale9Enabled(scale9Enable);
|
|
|
|
|
|
|
|
if (scale9Enable)
|
|
|
|
{
|
|
|
|
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
|
|
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
|
|
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
|
|
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
|
|
|
|
2013-09-16 15:32:52 +08:00
|
|
|
loadingBar->setCapInsets(Rect(cx, cy, cw, ch));
|
2013-09-13 22:20:20 +08:00
|
|
|
|
|
|
|
float width = DICTOOL->getFloatValue_json(options, "width");
|
|
|
|
float height = DICTOOL->getFloatValue_json(options, "height");
|
2013-09-16 15:32:52 +08:00
|
|
|
loadingBar->setSize(Size(width, height));
|
2013-09-13 22:20:20 +08:00
|
|
|
}
|
|
|
|
/**/
|
|
|
|
|
|
|
|
loadingBar->setDirection(LoadingBarType(DICTOOL->getIntValue_json(options, "direction")));
|
|
|
|
loadingBar->setPercent(DICTOOL->getIntValue_json(options, "percent"));
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForListViewFromJsonDictionary(UIWidget *widget, cs::JsonDictionary *options)
|
|
|
|
{
|
|
|
|
setPropsForScrollViewFromJsonDictionary(widget, options);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForPageViewFromJsonDictionary(UIWidget*widget,cs::JsonDictionary* options)
|
|
|
|
{
|
|
|
|
setPropsForPanelFromJsonDictionary(widget, options);
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForLabelBMFontFromJsonDictionary(UIWidget *widget, cs::JsonDictionary *options)
|
|
|
|
{
|
|
|
|
if (m_bOlderVersion)
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
|
|
|
|
UILabelBMFont* labelBMFont = (UILabelBMFont*)widget;
|
|
|
|
|
|
|
|
std::string tp_c = m_strFilePath;
|
|
|
|
const char* cmf_tp = NULL;
|
|
|
|
const char* cmft = DICTOOL->getStringValue_json(options, "fileName");
|
|
|
|
cmf_tp = tp_c.append(cmft).c_str();
|
|
|
|
|
|
|
|
labelBMFont->setFntFile(cmf_tp);
|
|
|
|
|
|
|
|
const char* text = DICTOOL->getStringValue_json(options, "text");
|
|
|
|
labelBMFont->setText(text);
|
|
|
|
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
|
|
|
|
UILabelBMFont* labelBMFont = (UILabelBMFont*)widget;
|
|
|
|
|
|
|
|
cs::JsonDictionary* cmftDic = DICTOOL->getSubDictionary_json(options, "fileNameData");
|
|
|
|
int cmfType = DICTOOL->getIntValue_json(cmftDic, "resourceType");
|
|
|
|
switch (cmfType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string tp_c = m_strFilePath;
|
|
|
|
const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, "path");
|
|
|
|
const char* cmf_tp = tp_c.append(cmfPath).c_str();
|
|
|
|
labelBMFont->setFntFile(cmf_tp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
CCLOG("Wrong res type of LabelAtlas!");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(cmftDic);
|
|
|
|
|
|
|
|
const char* text = DICTOOL->getStringValue_json(options, "text");
|
|
|
|
labelBMFont->setText(text);
|
|
|
|
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget,options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCSGUIReader::setPropsForDragPanelFromJsonDictionary(UIWidget *widget, cs::JsonDictionary *options)
|
|
|
|
{
|
|
|
|
setPropsForPanelFromJsonDictionary(widget, options);
|
|
|
|
|
|
|
|
UIDragPanel* dragPanel = (UIDragPanel*)widget;
|
|
|
|
|
|
|
|
bool bounceEnable = DICTOOL->getBooleanValue_json(options, "bounceEnable");
|
|
|
|
dragPanel->setBounceEnable(bounceEnable);
|
|
|
|
|
|
|
|
float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth");
|
|
|
|
float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight");
|
2013-09-16 15:32:52 +08:00
|
|
|
dragPanel->setInnerContainerSize(Size(innerWidth, innerHeight));
|
2013-09-13 22:20:20 +08:00
|
|
|
|
|
|
|
setColorPropsForWidgetFromJsonDictionary(widget, options);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_CC_EXT_END
|