Ejemplo n.º 1
0
void PatternMatrix::updateProgress()
{
	if(!mUpdateLogic)
            return;

	switch(gGameMode)
	{
		case Challenge:
		{
			float penergyPercent = mPatternClearTally / mPatternRequire;

			if (penergyPercent > 1.0)
				penergyPercent = 1.0;
			else if(penergyPercent <0.0)
				penergyPercent = 0.0;

			float vh = 326 * penergyPercent;
			
			mVisibleRect = CCRect(0, 326-vh, 18, vh);
			mProgressSpr->setTextureRect(mVisibleRect);

			if (penergyPercent == 1.0)
				showGameResult(true);

			break;
		}
		case Timer:
		{
			float penergyPercent = (mTimeTotal - mTimerTally) / mTimeTotal;

			if (penergyPercent > 1.0)
				penergyPercent = 1.0;
			else if(penergyPercent <0.0)
				penergyPercent = 0.0;

			float vw = 700 * penergyPercent;

			mVisibleRect = CCRect(0, 0, vw, 52);
			mProgressSpr->setTextureRect(mVisibleRect);

			if (penergyPercent == 0.0)
			{
				if(mPatternClearTally >= mPatternRequire)
					showGameResult(true);
				else
					showGameResult(false);
			}
			break;
		}
	}
}
Ejemplo n.º 2
0
void ArenaHandler::newGameResult(GameResult gameResult, bool arenaMatch)
{
    QTreeWidgetItem *item = showGameResult(gameResult, arenaMatch);

    if(arenaMatch && webUploader!=NULL)
    {
        QList<DeckCard> *deckCardList = deckHandler->getDeckComplete();
        bool uploadSuccess;
        if(deckCardList != NULL)    uploadSuccess=webUploader->uploadNewGameResult(gameResult,deckCardList);
        else                            uploadSuccess=webUploader->uploadNewGameResult(gameResult);

        if(uploadSuccess)
        {
            enableRefreshButton(false);
            currentArenaToWhite();
        }
        else                setRowColor(item, RED);
    }
}
Ejemplo n.º 3
0
void ArenaHandler::reshowGameResult(GameResult gameResult)
{
    if(arenaCurrent == NULL)    return;
    if(!isRowOk(arenaCurrent))  return;//Imposible

    for(int i=0; i<arenaCurrent->childCount(); i++)
    {
        QTreeWidgetItem *item = arenaCurrent->child(i);
        QColor statusColor = getRowColor(item);
        if((statusColor == RED || statusColor == WHITE || statusColor == TRANSPARENT) &&
            arenaCurrentGameList.at(i).enemyHero == gameResult.enemyHero &&
            arenaCurrentGameList.at(i).isFirst == gameResult.isFirst &&
            arenaCurrentGameList.at(i).isWinner == gameResult.isWinner)
        {
            setRowColor(item, GREEN);
            return;
        }
    }

    QTreeWidgetItem *item = showGameResult(gameResult, true);
    setRowColor(item, YELLOW);
}
Ejemplo n.º 4
0
void PatternMatrix::excludeDeadlock()
{
	if (isHasSolution() == false)
    {
        if (gGameMode == Timer)
        {
            for (int row=0; row < m_nMatrixRow; row++)
            {
                for (int col=0; col < m_nMatrixCol; col++)
				{
					mPatternBatchNode->removeChild(mPatternsSpr[row][col], true);
					addOnePattern(row, col);
				}
            }
			this->runAction(CCSequence::create(CCDelayTime::create(gPatternsFallTime + 0.1), CCCallFunc::create(this, callfunc_selector(PatternMatrix::detectionMatrix)), NULL));
        }
        else
        {
            onExit();
            showGameResult(false);
        }
    }
}