Esempio n. 1
0
void BossLottery::btnHandler()
{
    int cost = INSTANCE(SystemConfigRule)->getBossLotteryCost();
    if(times > 1){
        if(cost >= INSTANCE(UserData)->getCurrentMoney()){
            INSTANCE(MessageBoxFacade)->showMessageBox("元宝不足,是否充值?", INSTANCE(RechargeFacade), callfunc_selector(RechargeFacade::open),"充值");
            return;
        }
        INSTANCE(UserData)->costCurrentMoney(cost);
        INSTANCE(MoneyLayerManager)->createReduceMoney(cost);
    }
    
    CCNotificationCenter::sharedNotificationCenter()->postNotification(NoticeUpdateMoney);
    btn->setEnabled(false);
    closeBtn->setEnabled(false);
    int r = INSTANCE(SystemConfigRule)->getWheelMultiple();
    result = getMultiple(r);
    INSTANCE(BossLotteryFacade)->setBossMultiple(result);
    CCRotateBy *rotate = CCRotateBy::create(4.0f, 3600 + r * 60 - 30);
    CCEaseInOut *easeInOut = CCEaseInOut::create((CCActionInterval *)rotate->copy()->autorelease(), 1.5f);
    
    CCSequence *action = CCSequence::create(easeInOut,CCCallFunc::create(this, callfunc_selector(BossLottery::rotateComplete)),NULL);
    
    circle->setRotation(0);
    circle->runAction(action);
    
    costLabel->setString(CCString::createWithFormat("消耗%d元宝",cost)->getCString());
    INSTANCE(UserData)->addWheelTimes(1);
    
    times++;
}