void CCSReader::setPropsForLabelFromJsonDictionary(CocoWidget*widget,cs::CSJsonDictionary* options) { this->setPropsForWidgetFromJsonDictionary(widget, options); CocoLabel* label = (CocoLabel*)widget; bool touchScaleChangeAble = DICTOOL->getBooleanValue_json(options, "touchSacleEnable"); 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; label->setTextColor(cr, cg, cb); label->setFlipX(DICTOOL->getBooleanValue_json(options, "flipX")); label->setFlipY(DICTOOL->getBooleanValue_json(options, "flipY")); this->setColorPropsForWidgetFromJsonDictionary(widget,options); int gravity = DICTOOL->getIntValue_json(options, "gravity"); label->setGravity(gravity); }
void CCSReader::setPropsForLabelFromCCDictionary(CocoWidget*widget,cocos2d::CCDictionary* options) { this->setPropsForWidgetFromCCDictionary(widget, options); CocoLabel* label = (CocoLabel*)widget; bool touchScaleChangeAble = DICTOOL->getBooleanValue(options, "touchSacleEnable"); label->setTouchScaleChangeAble(touchScaleChangeAble); const char* text = DICTOOL->getStringValue(options, "text"); label->setText(text); CCObject* fs = DICTOOL->checkObjectExist(options, "fontSize"); if (fs) { label->setFontSize(DICTOOL->objectToIntValue(fs)); } CCObject* fn = DICTOOL->checkObjectExist(options, "fontName"); if (fn) { label->setFontName(DICTOOL->objectToStringValue(fn)); } CCObject* cro = DICTOOL->checkObjectExist(options, "colorR"); CCObject* cgo = DICTOOL->checkObjectExist(options, "colorG"); CCObject* cbo = DICTOOL->checkObjectExist(options, "colorB"); int cr = cro?DICTOOL->objectToIntValue(cro):255; int cg = cgo?DICTOOL->objectToIntValue(cgo):255; int cb = cbo?DICTOOL->objectToIntValue(cbo):255; ccColor3B tc = ccc3(cr, cg, cb); label->setColor(tc); label->setFlipX(DICTOOL->getBooleanValue(options, "flipX")); label->setFlipY(DICTOOL->getBooleanValue(options, "flipY")); this->setColorPropsForWidgetFromCCDictionary(widget, options); int gravity = DICTOOL->getIntValue(options, "gravity"); label->setGravity((LabelGravity)gravity); }