void LayerTransferMoney::valueChanged(CCObject *sender, CCControlEvent controlEvent){ CCControlSlider* pSlider = (CCControlSlider*)sender; float percent =pSlider->getValue()-pSlider->getMinimumValue(); float max = pSlider->getMaximumValue() - pSlider->getMinimumValue(); float delta = max; float posX =pSlider->getPositionX(); float sliderWidth =pSlider->getContentSize().width; spriteMoney->setPosition(ccp(posX+percent*(sliderWidth/delta), spriteMoney->getPositionY())); lblMoney->setString( CCString::createWithFormat("%s chips", mUtils::convertMoneyEx(ceil(pSlider->getValue())).c_str() )->getCString() ); }
void LayerBet_TomCuaCa::valueChanged(CCObject *sender, CCControlEvent controlEvent){ CCControlSlider* pSlider = (CCControlSlider*)sender; float percent =pSlider->getValue()-pSlider->getMinimumValue(); float max = pSlider->getMaximumValue() - pSlider->getMinimumValue(); float delta = max; float posX =pSlider->getPositionX(); float sliderWidth =pSlider->getContentSize().width; spriteMoney->setPosition(ccp(posX+percent*(sliderWidth/delta), spriteMoney->getPositionY())); //lblMoney->setString( CCString::createWithFormat("%.0f xu", ceil(pSlider->getValue()))->getCString() ); float myTien = floor(pSlider->getValue()); float myTien2 = floor((myTien/1000)); lblMoney->setString( CCString::createWithFormat("%s xu", mUtils::convertMoneyEx(myTien2*1000).c_str())->getCString() ); CCLog("--%f",pSlider->getValue()); }
void LayerBet_BaCayChuong::valueChanged(CCObject *sender, CCControlEvent controlEvent){ CCControlSlider* pSlider = (CCControlSlider*)sender; float percent =pSlider->getValue()-pSlider->getMinimumValue(); float max = pSlider->getMaximumValue() - pSlider->getMinimumValue(); float delta = max; float posX =pSlider->getPositionX(); float sliderWidth =pSlider->getContentSize().width; spriteMoney->setPosition(ccp(posX+percent*(sliderWidth/delta), spriteMoney->getPositionY())); lblMoney->setString( CCString::createWithFormat("%s xu", mUtils::convertMoneyEx(ceil(pSlider->getValue())*1000).c_str())->getCString() ); // CCControlSlider* pSlider = (CCControlSlider*)sender; // float percent =pSlider->getValue()-pSlider->getMinimumValue(); // float max = pSlider->getMaximumValue() - pSlider->getMinimumValue(); // float delta = max; // float posX =pSlider->getPositionX(); // float sliderWidth =pSlider->getContentSize().width; // spriteMoney->setPosition(ccp(posX+percent*(sliderWidth/delta), spriteMoney->getPositionY())); // //HoangDD comment // lblMoney->setString( CCString::createWithFormat("%.0f xu", floor(pSlider->getValue())*1000)->getCString() ); }