diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp index 794e44cbce..3078dcd54a 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp @@ -45,6 +45,8 @@ static const char* ClassName_Button = "Button"; static const char* ClassName_CheckBox = "CheckBox"; static const char* ClassName_ImageView = "ImageView"; static const char* ClassName_TextAtlas = "TextAtlas"; +static const char* ClassName_LabelAtlas = "LabelAtlas"; +static const char* ClassName_LabelBMFont= "LabelBMFont"; static const char* ClassName_TextBMFont = "TextBMFont"; static const char* ClassName_Text = "Text"; static const char* ClassName_LoadingBar = "LoadingBar"; @@ -132,7 +134,8 @@ void NodeReader::init() _funcs.insert(Pair(ClassName_SubGraph, std::bind(&NodeReader::loadSubGraph, this, _1))); _funcs.insert(Pair(ClassName_Sprite, std::bind(&NodeReader::loadSprite, this, _1))); _funcs.insert(Pair(ClassName_Particle, std::bind(&NodeReader::loadParticle, this, _1))); - + _funcs.insert(Pair(ClassName_LabelAtlas,std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_LabelBMFont,std::bind(&NodeReader::loadWidget, this, _1))); _funcs.insert(Pair(ClassName_Panel, std::bind(&NodeReader::loadWidget, this, _1))); _funcs.insert(Pair(ClassName_Button, std::bind(&NodeReader::loadWidget, this, _1))); _funcs.insert(Pair(ClassName_CheckBox, std::bind(&NodeReader::loadWidget, this, _1))); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp index be42ed09fd..c96a1dfbe7 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp @@ -216,23 +216,18 @@ namespace cocostudio } } - bool cr = DICTOOL->checkObjectExist_json(options, P_TextColorR); - bool cg = DICTOOL->checkObjectExist_json(options, P_TextColorG); - bool cb = DICTOOL->checkObjectExist_json(options, P_TextColorB); - int cri = cr?DICTOOL->getIntValue_json(options, P_TextColorR):255; - int cgi = cg?DICTOOL->getIntValue_json(options, P_TextColorG):255; - int cbi = cb?DICTOOL->getIntValue_json(options, P_TextColorB):255; + + int cri = DICTOOL->getIntValue_json(options, P_TextColorR,255); + int cgi = DICTOOL->getIntValue_json(options, P_TextColorG,255); + int cbi = DICTOOL->getIntValue_json(options, P_TextColorB,255); button->setTitleColor(Color3B(cri,cgi,cbi)); - bool fs = DICTOOL->checkObjectExist_json(options, P_FontSize); - if (fs) - { - button->setTitleFontSize(DICTOOL->getIntValue_json(options, P_FontSize)); - } - bool fn = DICTOOL->checkObjectExist_json(options, P_FontName); - if (fn) - { - button->setTitleFontName(DICTOOL->getStringValue_json(options, P_FontName)); - } + + + button->setTitleFontSize(DICTOOL->getIntValue_json(options, P_FontSize,14)); + + + button->setTitleFontName(DICTOOL->getStringValue_json(options, P_FontName,"微软雅黑")); + WidgetReader::setColorPropsFromJsonDictionary(widget, options); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp index 12ee1aa5da..4e8be4ac45 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp @@ -125,19 +125,16 @@ namespace cocostudio if (scale9Enable) { - bool sw = DICTOOL->checkObjectExist_json(options, P_Scale9Width); - bool sh = DICTOOL->checkObjectExist_json(options, P_Scale9Height); - if (sw && sh) - { - float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width); - float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height); - imageView->setSize(Size(swf, shf)); - } + + float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width,80.0f); + float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height,80.0f); + imageView->setSize(Size(swf, shf)); + float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX); float cy = DICTOOL->getFloatValue_json(options, P_CapInsetsY); - float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth); - float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight); + float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth,1.0f); + float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight,1.0f); imageView->setCapInsets(Rect(cx, cy, cw, ch)); diff --git a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp index 1d9a9cd4d5..b41cebbcde 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp @@ -194,25 +194,25 @@ namespace cocostudio bool backGroundScale9Enable = DICTOOL->getBooleanValue_json(options, P_BackGroundScale9Enable); panel->setBackGroundImageScale9Enabled(backGroundScale9Enable); - int cr = DICTOOL->getIntValue_json(options, P_BgColorR); - int cg = DICTOOL->getIntValue_json(options, P_BgColorG); - int cb = DICTOOL->getIntValue_json(options, P_BgColorB); + int cr = DICTOOL->getIntValue_json(options, P_BgColorR,150); + int cg = DICTOOL->getIntValue_json(options, P_BgColorG,150); + int cb = DICTOOL->getIntValue_json(options, P_BgColorB,100); - int scr = DICTOOL->getIntValue_json(options, P_BgStartColorR); - int scg = DICTOOL->getIntValue_json(options, P_BgStartColorG); - int scb = DICTOOL->getIntValue_json(options, P_BgStartColorB); + int scr = DICTOOL->getIntValue_json(options, P_BgStartColorR,255); + int scg = DICTOOL->getIntValue_json(options, P_BgStartColorG, 255); + int scb = DICTOOL->getIntValue_json(options, P_BgStartColorB, 255); - int ecr = DICTOOL->getIntValue_json(options, P_BgEndColorR); - int ecg = DICTOOL->getIntValue_json(options, P_BgEndColorG); - int ecb = DICTOOL->getIntValue_json(options, P_BgEndColorB); + int ecr = DICTOOL->getIntValue_json(options, P_BgEndColorR,150); + int ecg = DICTOOL->getIntValue_json(options, P_BgEndColorG,200); + int ecb = DICTOOL->getIntValue_json(options, P_BgEndColorB,255); float bgcv1 = DICTOOL->getFloatValue_json(options, P_VectorX); - float bgcv2 = DICTOOL->getFloatValue_json(options, P_VectorY); + float bgcv2 = DICTOOL->getFloatValue_json(options, P_VectorY,-0.5); panel->setBackGroundColorVector(Vec2(bgcv1, bgcv2)); - int co = DICTOOL->getIntValue_json(options, P_BgColorOpacity); + int co = DICTOOL->getIntValue_json(options, P_BgColorOpacity,100); - int colorType = DICTOOL->getIntValue_json(options, P_ColorType); + int colorType = DICTOOL->getIntValue_json(options, P_ColorType,1); panel->setBackGroundColorType(Layout::BackGroundColorType(colorType)); panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb)); panel->setBackGroundColor(Color3B(cr, cg, cb)); @@ -229,8 +229,8 @@ namespace cocostudio { float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX); float cy = DICTOOL->getFloatValue_json(options, P_CapInsetsY); - float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth); - float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight); + float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth,1); + float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight,1); panel->setBackGroundImageCapInsets(Rect(cx, cy, cw, ch)); } diff --git a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp index ccbaf98dc3..0870898954 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp @@ -66,10 +66,10 @@ namespace cocostudio ListView* listView = static_cast(widget); - int direction = DICTOOL->getFloatValue_json(options, P_Direction); + int direction = DICTOOL->getFloatValue_json(options, P_Direction,2); listView->setDirection((ScrollView::Direction)direction); - ListView::Gravity gravity = (ListView::Gravity)DICTOOL->getIntValue_json(options, P_Gravity); + ListView::Gravity gravity = (ListView::Gravity)DICTOOL->getIntValue_json(options, P_Gravity,3); listView->setGravity(gravity); float itemMargin = DICTOOL->getFloatValue_json(options, P_ItemMargin); diff --git a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp index f07f37babb..3c09400c96 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp @@ -117,23 +117,25 @@ namespace cocostudio bool scale9Enable = DICTOOL->getBooleanValue_json(options, P_Scale9Enable); loadingBar->setScale9Enabled(scale9Enable); - if (scale9Enable) - { - float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX); - float cy = DICTOOL->getFloatValue_json(options, P_CapInsetsY); - float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth); - float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight); - + + float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX); + float cy = DICTOOL->getFloatValue_json(options, P_CapInsetsY); + float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth,1); + float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight,1); + + if (scale9Enable) { loadingBar->setCapInsets(Rect(cx, cy, cw, ch)); - - float width = DICTOOL->getFloatValue_json(options, P_Width); - float height = DICTOOL->getFloatValue_json(options, P_Height); - loadingBar->setSize(Size(width, height)); + } + + float width = DICTOOL->getFloatValue_json(options, P_Width); + float height = DICTOOL->getFloatValue_json(options, P_Height); + loadingBar->setSize(Size(width, height)); + /**/ loadingBar->setDirection(LoadingBar::Direction(DICTOOL->getIntValue_json(options, P_Direction))); - loadingBar->setPercent(DICTOOL->getIntValue_json(options, P_Percent)); + loadingBar->setPercent(DICTOOL->getIntValue_json(options, P_Percent,100)); WidgetReader::setColorPropsFromJsonDictionary(widget, options); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp index 639e0a9912..6f03951944 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp @@ -72,10 +72,10 @@ namespace cocostudio ScrollView* scrollView = static_cast(widget); - float innerWidth = DICTOOL->getFloatValue_json(options, P_InnerWidth); - float innerHeight = DICTOOL->getFloatValue_json(options, P_InnerHeight); + float innerWidth = DICTOOL->getFloatValue_json(options, P_InnerWidth,200); + float innerHeight = DICTOOL->getFloatValue_json(options, P_InnerHeight,200); scrollView->setInnerContainerSize(Size(innerWidth, innerHeight)); - int direction = DICTOOL->getFloatValue_json(options, P_Direction); + int direction = DICTOOL->getFloatValue_json(options, P_Direction,1); scrollView->setDirection((ScrollView::Direction)direction); scrollView->setBounceEnabled(DICTOOL->getBooleanValue_json(options, P_BounceEnable)); diff --git a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp index 0e83191bd3..a4531be2e8 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp @@ -145,25 +145,24 @@ namespace cocostudio slider->setPercent(DICTOOL->getIntValue_json(options, P_Percent)); - bool bt = DICTOOL->checkObjectExist_json(options, P_BarFileName); - float barLength = DICTOOL->getFloatValue_json(options, P_Length); - if (bt) - { - const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, P_BarFileNameData); - int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, P_ResourceType); - std::string imageFileName = this->getResourcePath(imageFileNameDic, P_Path, (Widget::TextureResType)imageFileNameType); - slider->loadBarTexture(imageFileName, (Widget::TextureResType)imageFileNameType); +// bool bt = DICTOOL->checkObjectExist_json(options, P_BarFileName); + float barLength = DICTOOL->getFloatValue_json(options, P_Length,290); + const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, P_BarFileNameData); + int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, P_ResourceType); + std::string imageFileName = this->getResourcePath(imageFileNameDic, P_Path, (Widget::TextureResType)imageFileNameType); + slider->loadBarTexture(imageFileName, (Widget::TextureResType)imageFileNameType); - if (barTextureScale9Enable) - { - slider->setContentSize(Size(barLength, slider->getContentSize().height)); - } + + + if (barTextureScale9Enable) + { + slider->setContentSize(Size(barLength, slider->getContentSize().height)); } //loading normal slider ball texture const rapidjson::Value& normalDic = DICTOOL->getSubDictionary_json(options, P_BallNormalData); int normalType = DICTOOL->getIntValue_json(normalDic, P_ResourceType); - std::string imageFileName = this->getResourcePath(normalDic, P_Path, (Widget::TextureResType)normalType); + imageFileName = this->getResourcePath(normalDic, P_Path, (Widget::TextureResType)normalType); slider->loadSlidBallTextureNormal(imageFileName, (Widget::TextureResType)normalType); diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp index c6530a56ec..b4ff2c7561 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp @@ -101,34 +101,37 @@ namespace cocostudio std::string jsonPath = GUIReader::getInstance()->getFilePath(); TextAtlas* labelAtlas = static_cast(widget); - bool sv = DICTOOL->checkObjectExist_json(options, P_StringValue); - bool cmf = DICTOOL->checkObjectExist_json(options, P_CharMapFile); - bool iw = DICTOOL->checkObjectExist_json(options, P_ItemWidth); - bool ih = DICTOOL->checkObjectExist_json(options, P_ItemHeight); - bool scm = DICTOOL->checkObjectExist_json(options, P_StartCharMap); - if (sv && cmf && iw && ih && scm) +// bool sv = DICTOOL->checkObjectExist_json(options, P_StringValue); +// bool cmf = DICTOOL->checkObjectExist_json(options, P_CharMapFile); +// bool iw = DICTOOL->checkObjectExist_json(options, P_ItemWidth); +// bool ih = DICTOOL->checkObjectExist_json(options, P_ItemHeight); +// bool scm = DICTOOL->checkObjectExist_json(options, P_StartCharMap); + + const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, P_CharMapFileData); + int cmfType = DICTOOL->getIntValue_json(cmftDic, P_ResourceType); + switch (cmfType) { - const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, P_CharMapFileData); - int cmfType = DICTOOL->getIntValue_json(cmftDic, P_ResourceType); - switch (cmfType) + case 0: { - case 0: - { - std::string tp_c = jsonPath; - const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, P_Path); - const char* cmf_tp = tp_c.append(cmfPath).c_str(); - labelAtlas->setProperty(DICTOOL->getStringValue_json(options, P_StringValue),cmf_tp,DICTOOL->getIntValue_json(options, P_ItemWidth),DICTOOL->getIntValue_json(options,P_ItemHeight), DICTOOL->getStringValue_json(options, P_StartCharMap)); - break; - } - case 1: - CCLOG("Wrong res type of LabelAtlas!"); - break; - default: - break; + std::string tp_c = jsonPath; + const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, P_Path); + const char* cmf_tp = tp_c.append(cmfPath).c_str(); + labelAtlas->setProperty(DICTOOL->getStringValue_json(options, P_StringValue,"12345678"), + cmf_tp, + DICTOOL->getIntValue_json(options, P_ItemWidth,24), + DICTOOL->getIntValue_json(options,P_ItemHeight,32), + DICTOOL->getStringValue_json(options, P_StartCharMap)); + break; } + case 1: + CCLOG("Wrong res type of LabelAtlas!"); + break; + default: + break; } + WidgetReader::setColorPropsFromJsonDictionary(widget, options); } } diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp index e58eb6b0c3..99c6f3735a 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp @@ -98,7 +98,7 @@ namespace cocostudio break; } - const char* text = DICTOOL->getStringValue_json(options, P_Text); + const char* text = DICTOOL->getStringValue_json(options, P_Text,"Text Label"); labelBMFont->setString(text); diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp index 2c5c01686e..ae5dc10d37 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp @@ -94,19 +94,15 @@ namespace cocostudio bool ph = DICTOOL->checkObjectExist_json(options, P_PlaceHolder); if (ph) { - textField->setPlaceHolder(DICTOOL->getStringValue_json(options, P_PlaceHolder)); - } - textField->setText(DICTOOL->getStringValue_json(options, P_Text)); - bool fs = DICTOOL->checkObjectExist_json(options, P_FontSize); - if (fs) - { - textField->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize)); - } - bool fn = DICTOOL->checkObjectExist_json(options, P_FontName); - if (fn) - { - textField->setFontName(DICTOOL->getStringValue_json(options, P_FontName)); + textField->setPlaceHolder(DICTOOL->getStringValue_json(options, P_PlaceHolder,"input words here")); } + textField->setText(DICTOOL->getStringValue_json(options, P_Text,"text Field")); + + textField->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize,20)); + + + textField->setFontName(DICTOOL->getStringValue_json(options, P_FontName,"微软雅黑")); + bool tsw = DICTOOL->checkObjectExist_json(options, P_TouchSizeWidth); bool tsh = DICTOOL->checkObjectExist_json(options, P_TouchSizeHeight); if (tsw && tsh) @@ -125,14 +121,14 @@ namespace cocostudio if (maxLengthEnable) { - int maxLength = DICTOOL->getIntValue_json(options, P_MaxLength); + int maxLength = DICTOOL->getIntValue_json(options, P_MaxLength,10); textField->setMaxLength(maxLength); } bool passwordEnable = DICTOOL->getBooleanValue_json(options, P_PasswordEnable); textField->setPasswordEnabled(passwordEnable); if (passwordEnable) { - textField->setPasswordStyleText(DICTOOL->getStringValue_json(options, P_PasswordStyleText)); + textField->setPasswordStyleText(DICTOOL->getStringValue_json(options, P_PasswordStyleText,"*")); } diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp index 9eba52b56f..d0b021582d 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp @@ -95,20 +95,15 @@ namespace cocostudio Text* label = static_cast(widget); bool touchScaleChangeAble = DICTOOL->getBooleanValue_json(options, P_TouchScaleEnable); label->setTouchScaleChangeEnabled(touchScaleChangeAble); - const char* text = DICTOOL->getStringValue_json(options, P_Text); + const char* text = DICTOOL->getStringValue_json(options, P_Text,"Text Label"); label->setString(text); - bool fs = DICTOOL->checkObjectExist_json(options, P_FontSize); - if (fs) - { - label->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize)); - } - bool fn = DICTOOL->checkObjectExist_json(options, P_FontName); - if (fn) - { - std::string fontName = DICTOOL->getStringValue_json(options, P_FontName); - std::string fontFilePath = jsonPath.append(fontName); - label->setFontName(fontFilePath); - } + + label->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize,20)); + + std::string fontName = DICTOOL->getStringValue_json(options, P_FontName, "微软雅黑"); + std::string fontFilePath = jsonPath.append(fontName); + label->setFontName(fontFilePath); + bool aw = DICTOOL->checkObjectExist_json(options, P_AreaWidth); bool ah = DICTOOL->checkObjectExist_json(options, P_AreaHeight); if (aw && ah) diff --git a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp index 14d5ca743a..06478699ae 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp @@ -113,11 +113,9 @@ namespace cocostudio void WidgetReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) { - bool ignoreSizeExsit = DICTOOL->checkObjectExist_json(options, P_IgnoreSize); - if (ignoreSizeExsit) - { - widget->ignoreContentAdaptWithSize(DICTOOL->getBooleanValue_json(options, P_IgnoreSize)); - } + + widget->ignoreContentAdaptWithSize(DICTOOL->getBooleanValue_json(options, P_IgnoreSize,false)); + widget->setSizeType((Widget::SizeType)DICTOOL->getIntValue_json(options, P_SizeType)); widget->setPositionType((Widget::PositionType)DICTOOL->getIntValue_json(options, P_PositionType)); @@ -151,21 +149,15 @@ namespace cocostudio float x = DICTOOL->getFloatValue_json(options, P_X); float y = DICTOOL->getFloatValue_json(options, P_Y); widget->setPosition(Vec2(x,y)); - bool sx = DICTOOL->checkObjectExist_json(options, P_ScaleX); - if (sx) - { - widget->setScaleX(DICTOOL->getFloatValue_json(options, P_ScaleX)); - } - bool sy = DICTOOL->checkObjectExist_json(options, P_ScaleY); - if (sy) - { - widget->setScaleY(DICTOOL->getFloatValue_json(options, P_ScaleY)); - } - bool rt = DICTOOL->checkObjectExist_json(options, P_Rotation); - if (rt) - { - widget->setRotation(DICTOOL->getFloatValue_json(options, P_Rotation)); - } + + widget->setScaleX(DICTOOL->getFloatValue_json(options, P_ScaleX,1.0)); + + + widget->setScaleY(DICTOOL->getFloatValue_json(options, P_ScaleY,1.0)); + + + widget->setRotation(DICTOOL->getFloatValue_json(options, P_Rotation,0)); + bool vb = DICTOOL->checkObjectExist_json(options, P_Visbile); if (vb) { diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index 1cbbd901c0..90b65063ca 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -623,7 +623,6 @@ bool TextField::isPasswordEnabled()const void TextField::setPasswordStyleText(const char *styleText) { _textFieldRenderer->setPasswordStyleText(styleText); - _passwordStyleText = styleText; setText(getStringValue());