Exemplo n.º 1
0
void PropSpeedupView::initSliderBar(){
    auto m_sliderBg = CCLoadSprite::createScale9Sprite("huadongtiao3.png");
    m_sliderBg->setInsetBottom(5);
    m_sliderBg->setInsetLeft(5);
    m_sliderBg->setInsetRight(5);
    m_sliderBg->setInsetTop(5);
    m_sliderBg->setAnchorPoint(ccp(0.5,0.5));
    m_sliderBg->setPosition(ccp(304/2, 25));
    m_sliderBg->setContentSize(CCSize(304,18));
    
    auto bgSp = CCLoadSprite::createSprite("huadongtiao4.png");
    bgSp->setVisible(false);
    auto proSp = CCLoadSprite::createSprite("huadongtiao4.png");
    auto thuSp = CCLoadSprite::createSprite("huadongtiao1.png");
    
    m_trainSlider = CCSliderBar::createSlider(m_sliderBg, proSp, thuSp);
    m_trainSlider->setMinimumValue(0.0f);
    m_trainSlider->setMaximumValue(1.0f);
    m_trainSlider->setProgressScaleX(300/proSp->getContentSize().width);
    m_trainSlider->setTag(1);
    m_trainSlider->setLimitMoveValue(25);
//    m_trainSlider->setTouchPriority(0);
    m_trainSlider->addTargetWithActionForControlEvents(this, cccontrol_selector(PropSpeedupView::sliderCallBack), CCControlEventValueChanged);
    m_sliderContainer->addChild(m_trainSlider, 1);
    
    auto editSize = m_editBoxNode->getContentSize();
    auto editpic =CCLoadSprite::createScale9Sprite("frame_3.png");
    editpic->setContentSize(editSize);
    editpic->setInsetBottom(1);
    editpic->setInsetTop(1);
    editpic->setInsetRight(1);
    editpic->setInsetLeft(1);
    m_editBox = CCEditBox::create(editSize,editpic );
    m_editBox->setInputMode(kEditBoxInputModeNumeric);
    m_editBox->setText("0");
    m_editBox->setDelegate(this);
    //m_editBox->setTouchPriority(0);
    m_editBox->setMaxLength(12);
    m_editBox->setReturnType(kKeyboardReturnTypeDone);
    m_editBox->setPosition(ccp(editSize.width/2, editSize.height/2));
    m_editBoxNode->addChild(m_editBox);
//    m_lblBtn->setString(_lang("102137"));
    setButtonTitle(m_useBtn, _lang("102137").c_str());//使用
//    m_addBtn->setTouchPriority(0);
//    m_subBtn->setTouchPriority(0);
    setButtonTitle(m_useBtnPart2, _lang("135015").c_str());//批量使用
    setButtonTitle(m_upBtn1, _lang("135013").c_str());//普通加速
    setButtonTitle(m_upBtn2, _lang("135014").c_str());//批量加速
}
Exemplo n.º 2
0
void LotteryRotateView::addRewardsNodeBg(){
    m_rewardsContainer->removeAllChildren();
    auto spBg = CCLoadSprite::createScale9Sprite("huadongtiao3.png");
    spBg->setInsetBottom(5);//设置非拉伸区域与底部的距离
    spBg->setInsetLeft(5);
    spBg->setInsetRight(5);
    spBg->setInsetTop(5);
    spBg->setAnchorPoint(ccp(0.5,0.5));
    //    spBg->setPosition(ccp(290/2, 25));
    spBg->setContentSize(CCSize(550,200));
    
    m_rewardsContainer->addChild(spBg);
}
Exemplo n.º 3
0
void Self::onHandlePropTypeFloat(cocos2d::Node* node_, cocos2d::Node* parent,
                                 const char* name_, float value,
                                 cocosbuilder::CCBReader* reader) {
    auto node = dynamic_cast<Widget*>(node_);
    std::string name(name_);
    if (name == property::inset_left) {
        return node->setInsetLeft(value);
    }
    if (name == property::inset_top) {
        return node->setInsetTop(value);
    }
    if (name == property::inset_right) {
        return node->setInsetRight(value);
    }
    if (name == property::inset_bottom) {
        node->setInsetBottom(value);
        node->magicEnabled_ = true;
        return;
    }
    Super::onHandlePropTypeFloat(node_, parent, name_, value, reader);
}