CocoSlider* CocoSlider::create() { CocoSlider* widget = new CocoSlider(); if (widget && widget->init()) { return widget; } CC_SAFE_DELETE(widget); return NULL; }
void CCSReader::setPropsForSliderFromJsonDictionary(CocoWidget*widget,cs::CSJsonDictionary* options) { this->setPropsForWidgetFromJsonDictionary(widget, options); CocoSlider* slider = (CocoSlider*)widget; bool barTextureScale9Enable = DICTOOL->getBooleanValue_json(options, "barTextureScale9Enable"); slider->setBarTextureScale9Enable(barTextureScale9Enable); bool bt = DICTOOL->checkObjectExist_json(options, "barFileName"); float barLength = DICTOOL->getFloatValue_json(options, "length"); if (bt) { if (barTextureScale9Enable) { slider->setBarTextureScale9(DICTOOL->getStringValue_json(options, "barFileName"), 0, 0, 0, 0,widget->getUseMergedTexture()); slider->setBarLength(barLength); } else { slider->setBarTexture(DICTOOL->getStringValue_json(options, "barFileName"),widget->getUseMergedTexture()); } } slider->setSlidBallTextures(DICTOOL->getStringValue_json(options, "ballNormal"), DICTOOL->getStringValue_json(options, "ballPressed"), DICTOOL->getStringValue_json(options, "ballDisabled"),widget->getUseMergedTexture()); slider->setSlidBallPercent(DICTOOL->getIntValue_json(options, "percent")); bool showProgressBarExist = DICTOOL->checkObjectExist_json(options, "showProgressBar"); bool showProgressBar = false; if (showProgressBarExist) { showProgressBar = DICTOOL->getBooleanValue_json(options, "showProgressBar"); } if (showProgressBar) { slider->setShowProgressBar(showProgressBar); slider->setProgressBarTextureScale9(DICTOOL->getStringValue_json(options, "progressBarFileName"), 0, 0, 0, 0, widget->getUseMergedTexture()); slider->setProgressBarScale(barLength); } this->setColorPropsForWidgetFromJsonDictionary(widget,options); }
void CCSReader::setPropsForSliderFromCCDictionary(CocoWidget*widget,cocos2d::CCDictionary* options) { this->setPropsForWidgetFromCCDictionary(widget, options); CocoSlider* slider = (CocoSlider*)widget; bool barTextureScale9Enable = DICTOOL->getBooleanValue(options, "barTextureScale9Enable"); slider->setBarTextureScale9Enable(barTextureScale9Enable); CCObject* bt = DICTOOL->checkObjectExist(options, "barFileName"); float barLength = DICTOOL->getFloatValue(options, "length"); if (bt) { if (barTextureScale9Enable) { slider->setBarTextureScale9(DICTOOL->objectToStringValue(bt), 0, 0, 0, 0,widget->getUseMergedTexture()); slider->setBarLength(barLength); }else{ slider->setBarTexture(DICTOOL->objectToStringValue(bt),widget->getUseMergedTexture()); } } slider->setSlidBallTextures(DICTOOL->getStringValue(options, "ballNormal"), DICTOOL->getStringValue(options, "ballPressed"), DICTOOL->getStringValue(options, "ballDisabled"),widget->getUseMergedTexture()); slider->setSlidBallPercent(DICTOOL->getIntValue(options, "percent")); this->setColorPropsForWidgetFromCCDictionary(widget, options); }