예제 #1
0
 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"));
     this->setColorPropsForWidgetFromJsonDictionary(widget,options);
 }
예제 #2
0
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"));
    
    cocos2d::CCObject* showProgressBarExist = DICTOOL->checkObjectExist(options, "showProgressBar");
    bool showProgressBar = false;
    if (showProgressBarExist)
    {
        showProgressBar = DICTOOL->getBooleanValue(options, "showProgressBar");
    }
    if (showProgressBar)
    {
        slider->setShowProgressBar(showProgressBar);
        slider->setProgressBarTextureScale9(DICTOOL->getStringValue(options, "progressBarFileName"), 0, 0, 0, 0, widget->getUseMergedTexture());
        slider->setProgressBarScale(barLength);
    }
    
    this->setColorPropsForWidgetFromCCDictionary(widget, options);
}