void UIRollNum::clearEffect(){ for(unsigned int i = 0; i < numArray->count(); i++){ UINumber* pNumber = (UINumber*)numArray->objectAtIndex(i); this->removeChild(pNumber, true); } numArray->removeAllObjects(); for(int i = 0; i < m_maxCol; i++){ UINumber* pNumber = UINumber::numberWithStyle(style); numArray->addObject(pNumber); pNumber->setNumber(0); pNumber->setPosition(ccp(m_point.x - i * NUM_WIDTH, m_point.y)); pNumber->setAnchorPoint(ccp(1.0f, 0.5f)); this->addChild(pNumber, 100); } }
void UIRollNum::rebuildEffect(){ int i = 0; int num = m_nNumber; while(1){ if(num <= 0){ if(m_maxCol <= i && zeroFill){ break; } } int showNum = num % 10; UINumber* pNumber = (UINumber*)numArray->objectAtIndex(i); pNumber->setNumber(showNum); i++; num = num / 10; } }