ScrobblesWidget::ScrobblesWidget( QWidget* parent )
    :QWidget( parent ), ui( new Ui::ScrobblesWidget ), m_lastIndex( 0 )
{
    ui->setupUi( this );

    connect( ui->scrobbles, SIGNAL( trackClicked(TrackWidget&)), SLOT( onTrackClicked(TrackWidget&)));
    connect( ui->slidingWidget, SIGNAL( animationFinished()), SLOT(onMoveFinished()));

    ui->stackedWidget->setCurrentWidget( ui->scrobbles );
}
Beispiel #2
0
void Walker::moveOnePoint(float tab){
    if(m_movePositions.size()>m_moveIndex){
        mCurrentSeq = mTargetSeq;
        mTargetSeq = m_moveSeqs[m_moveIndex];
        CCPoint onePos = m_movePositions[m_moveIndex];
        CCPoint lastPos = m_point;
        if(m_moveIndex!=0){
            lastPos = m_movePositions[m_moveIndex-1];
        }
        
        CCSafeNotificationCenter::sharedNotificationCenter()->postNotification(MSG_CHECK_ZORDER, this);
        m_lastDirect = getDirection(lastPos,onePos);
        if(m_moveIndex != 0)
        {
            this->changeDirect(m_lastDirect);
        }
        m_status = WALKER_ACTION_MOVE;
        m_loopTimes = numeric_limits<int>::max();
        
        this->unschedule(schedule_selector(Walker::playAttack));
        if (m_armType == 1 || m_armType == 4 || m_armType == 3 || m_armType == 7)
        {
            this->schedule(schedule_selector(Walker::playAttack), 2);
            playAttack(0);
        }
        
        CCPoint gap = ccpSub(lastPos, onePos);
        float len = ccpLength(gap);
        float useTime = len/m_moveSpd;//len/120.0;
        CCSequence* sc = nullptr;
        Action* action = nullptr;
        if(useTime == 0)
        {
            sc = CCSequence::create(CCCallFunc::create(this, callfunc_selector(Walker::moveOnePoint)),NULL);
        }
        else
        {
            sc = CCSequence::create(CCMoveTo::create(useTime, onePos),CCCallFunc::create(this, callfunc_selector(Walker::moveOnePoint)),NULL);
            action = createAnimation();
        }
        //Action* action = createAnimation();
        if (action)
        {
            auto sp = Spawn::create(sc, action, NULL);
            m_iconSpr->runAction(sp);
        }
        else
        {
            m_iconSpr->runAction(sc);
        }
        m_moveIndex += 1;
        
    }else{
        /*
        m_status = WALKER_ACTION_STAND;
        this->changeDirect(m_lastDirect,true);
        CCSafeNotificationCenter::sharedNotificationCenter()->postNotification(MSG_SOLDIER_STOP, this);
        */
        onMoveFinished();
    }
}