Пример #1
0
int ClockwGallery::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 10)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 10;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = screenOn(); break;
        case 1: *reinterpret_cast< bool*>(_v) = appearAnimation(); break;
        case 2: *reinterpret_cast< bool*>(_v) = disappearAnimation(); break;
        case 3: *reinterpret_cast< bool*>(_v) = moveAnimation(); break;
        case 4: *reinterpret_cast< bool*>(_v) = rotateAnimation(); break;
        case 5: *reinterpret_cast< int*>(_v) = spawnTime(); break;
        case 6: *reinterpret_cast< int*>(_v) = appearTime(); break;
        case 7: *reinterpret_cast< int*>(_v) = range(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setScreenOn(*reinterpret_cast< bool*>(_v)); break;
        case 1: setAppearAnimation(*reinterpret_cast< bool*>(_v)); break;
        case 2: setDisappearAnimation(*reinterpret_cast< bool*>(_v)); break;
        case 3: setMoveAnimation(*reinterpret_cast< bool*>(_v)); break;
        case 4: setRotateAnimation(*reinterpret_cast< bool*>(_v)); break;
        case 5: setSpawnTime(*reinterpret_cast< int*>(_v)); break;
        case 6: setAppearTime(*reinterpret_cast< int*>(_v)); break;
        case 7: setRange(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Пример #2
0
void ReputationOrb::update(float dt)
{
    if(orbStatus == APPEAR)
    {
        appearAnimation(dt);
    }
    else if(orbStatus == DISAPPEAR)
    {
        disappearAnimation(dt);
    }
    else
    {
        if(!stopAnimation && (!TutorialManager::getThis()->active || (TutorialManager::getThis()->miniDragon != NULL && !TutorialManager::getThis()->miniDragon->dropToken)))
        {
            if(!disappear)
            {
                if(cumulativeTime >= triggerTime)
                {
                    cumulativeTime = 0;
                    disappear = true;
                }
            }
            else
            {
                x_frameno = 0;
                
                frameWidth = 64;
                frameHeight = 128;
                
                CCSprite* rawSprite = CCSprite::createWithSpriteFrameName("disappear.png");
                orbTexture = rawSprite->getTexture();
                
                // orbTexture = CCTextureCache::sharedTextureCache()->addImage("disappear.png");
                x_maxframeno = 8;
                orbRect.setRect(0, ((int)(x_frameno / 4)) * frameHeight, frameWidth, frameHeight);
                
                orbSprite->setTexture(orbTexture);
                orbSprite->setTextureRect(orbRect);
                
                collected = true;
                stopAnimation = true;
                
                orbStatus = DISAPPEAR;
                delay_curr = delay_animFrame;
            }
            cumulativeTime += dt;
        }
        
        if (opacity == 0)
        {
            if (orbSprite)
            {
                orbSprite = NULL;
            }
            
            if (orbTexture)
            {
                orbTexture = NULL;
            }
        }
        else
        {
            if (!collected)
            {
                if (delay_curr > 0)
                {
                    delay_curr -= dt;
                }
                else
                {
                    ++x_frameno;
                    if (x_frameno >= x_maxframeno)
                    {
                        x_frameno = 0;
                    }
                    orbRect.setRect(x_frameno * frameWidth, y_offset * frameHeight, frameWidth, frameHeight);
                    orbSprite->setTextureRect(orbRect);
                    
                    delay_curr = delay_animFrame;
                }
            }
            
        }
    }
}