本文整理汇总了C++中Statistic::changeStatistic方法的典型用法代码示例。如果您正苦于以下问题:C++ Statistic::changeStatistic方法的具体用法?C++ Statistic::changeStatistic怎么用?C++ Statistic::changeStatistic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statistic
的用法示例。
在下文中一共展示了Statistic::changeStatistic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: badMove
void EndlessGameWidget::badMove()
{
// Add sound effect
PublicGameSounds::addSound(PublicGameSounds::BadMove);
statistic.changeStatistic(Statistic::BadMoveCount, 1, true);
}
示例2: dealStableEliminate
void EndlessGameWidget::dealStableEliminate(Connections connections)
{
// Calculate the bonus
for (int i = 0;i < gameboardInfo->totalBallCounts();++i)
{
QVector<QVector<int> *>& connect = connections.connectionsOfIndex[i];
int connectionCountOfThePosition = 0;
for (int j = 0;j < 10;++j)
{
if (j == 3 || connect[j] == NULL)
continue;
++connectionCountOfThePosition;
}
if (connectionCountOfThePosition > 0)
effectPainter->highlightAt(i);
if (connectionCountOfThePosition > 1)
{
if (connectionCountOfThePosition >= 2)
effectPainter->flash();
if (connectionCountOfThePosition == 2)
{
// Add sound effect
PublicGameSounds::addSound(PublicGameSounds::GetFlame);
// Get a flame
flame->addOne();
statistic.changeStatistic(Statistic::FlameGetCount, 1, true);
}
if (connectionCountOfThePosition >= 3)
{
// Add sound effect
PublicGameSounds::addSound(PublicGameSounds::GetStar);
// Get a star
star->addOne();
statistic.changeStatistic(Statistic::StarGetCount, 1, true);
}
}
}
for (int i = 0;i < connections.connections.size();++i)
{
int size = connections.connections[i]->size();
QPointF pos1(gameboardInfo->positionOfIndex(connections.connections[i]->at(0)));
QPointF pos2(gameboardInfo->positionOfIndex(connections.connections[i]->at(size - 1)));
effectPainter->wordsAt(QPointF((pos1.x() + pos2.x()) / 2,
(pos1.y() + pos2.y()) / 2),
tr("%1").arg(size),
size);
if (size >= 4)
effectPainter->flash();
if (size == 4)
{
// Add sound effect
PublicGameSounds::addSound(PublicGameSounds::GetFlame);
// Get a flame
flame->addOne();
statistic.changeStatistic(Statistic::FlameGetCount, 1, true);
}
if (size >= 5)
{
// Add sound effect
PublicGameSounds::addSound(PublicGameSounds::GetStar);
// Get a star
star->addOne();
statistic.changeStatistic(Statistic::StarGetCount, 1, true);
}
}
}
示例3: dealReleased
void EndlessGameWidget::dealReleased(QPointF mousePos, Qt::MouseButton button)
{
if (itemAtPressPos != NULL)
{
if (itemAtPressPos == flame && flame->notEmpty())
{
int index = gameboardInfo->indexOfPosition(mousePos);
if (index != -1)
{
// Add sound effect
PublicGameSounds::addSound(PublicGameSounds::UseFlame);
// Tell the controller to eliminate the balls
controller->flameAt(index);
// Add effects to effect painter
effectPainter->explodeAt(index);
effectPainter->flash();
// Minus the value of the flame
flame->minusOne();
statistic.changeStatistic(Statistic::FlameUsedCount, 1, true);
}
}
else if (itemAtPressPos == star && star->notEmpty())
{
int index = gameboardInfo->indexOfPosition(mousePos);
if (index != -1)
{
// Add sound effect
PublicGameSounds::addSound(PublicGameSounds::UseStar);
// Tell the controller to eliminate the balls
controller->starAt(index);
// Add effects to effect painter
effectPainter->lightningAt(index);
effectPainter->flash();
// Minus the value of the flame
star->minusOne();
statistic.changeStatistic(Statistic::StarUsedCount, 1, true);
}
}
else if (itemAtPressPos == hint &&
hint->in(mousePos,
gameboardInfo->width(),
gameboardInfo->height()))
{
// Reduce the score
int score = qMax(progressBar->getCurrent() - 10,
progressBar->getMin());
progressBar->setCurrent(score);
// Show the hint
showHint();
}
else if (itemAtPressPos == resetItem &&
resetItem->in(mousePos,
gameboardInfo->width(),
gameboardInfo->height()))
{
// Create the reset widget
ResetWidget *w = new ResetWidget();
// Connect
connect(w, SIGNAL(confirm()), this, SLOT(reset()));
// Give control to it
emit giveControlTo(w, false);
}
else if (itemAtPressPos == exitItem &&
exitItem->in(mousePos,
gameboardInfo->width(),
gameboardInfo->height()))
{
// Quit game
quitGame();
return;
}
}
// Clear user moving elimination hints
effectPainter->clearUserMovingEliminationHints();
itemAtPressPos = NULL;
// Let the gesture controller to deal the release event
gestureController->dealReleased(mousePos);
}