本文整理汇总了C++中Statistic::getStatistic方法的典型用法代码示例。如果您正苦于以下问题:C++ Statistic::getStatistic方法的具体用法?C++ Statistic::getStatistic怎么用?C++ Statistic::getStatistic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statistic
的用法示例。
在下文中一共展示了Statistic::getStatistic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
AbstractAchievementItem *Achievements::getAchievementItem
(AbstractAchievementItem::ItemType type, QPainter *painter)
{
AbstractAchievementItem *item = NULL;
switch (type)
{
case AbstractAchievementItem::FlameGet:
item = new FlameGetItem
(getAchievementLevel(AbstractAchievementItem::FlameGet),
statistic.getStatistic(Statistic::FlameGetCount),
painter);
break;
case AbstractAchievementItem::StarGet:
item = new StarGetItem
(getAchievementLevel(AbstractAchievementItem::StarGet),
statistic.getStatistic(Statistic::StarGetCount),
painter);
break;
case AbstractAchievementItem::RotateClassic:
item = new RotateClassicPointItem
(getAchievementLevel(AbstractAchievementItem::RotateClassic),
statistic.getStatistic(Statistic::RotateClassicPoint),
painter);
break;
case AbstractAchievementItem::Timing:
item = new TimingPointItem
(getAchievementLevel(AbstractAchievementItem::Timing),
qMax(statistic.getStatistic(Statistic::SwapTimingPoint),
statistic.getStatistic(Statistic::RotateTimingPoint)),
painter);
break;
case AbstractAchievementItem::RotatePuzzle:
item = new RotatePuzzleFinishedItem
(statistic.getStatistic(Statistic::RotatePuzzleFinished),
statistic.getStatistic(Statistic::RotatePuzzleTotal),
painter);
break;
default:
break;
}
return item;
}
示例2: getAchievementLevel
int Achievements::getAchievementLevel(AbstractAchievementItem::ItemType type,
int value)
{
if (value == -1)
{
switch (type)
{
case AbstractAchievementItem::FlameGet:
value = statistic.getStatistic(Statistic::FlameGetCount);
break;
case AbstractAchievementItem::StarGet:
value = statistic.getStatistic(Statistic::StarGetCount);
break;
case AbstractAchievementItem::RotateClassic:
value = statistic.getStatistic(Statistic::RotateClassicPoint);
break;
case AbstractAchievementItem::Timing:
value = qMax(statistic.getStatistic(Statistic::SwapTimingPoint),
statistic.getStatistic(Statistic::RotateTimingPoint));
break;
case AbstractAchievementItem::RotatePuzzle:
if (statistic.getStatistic(Statistic::RotatePuzzleFinished) == 0)
value = 0;
else if (statistic.getStatistic(Statistic::RotatePuzzleFinished) ==
statistic.getStatistic(Statistic::RotatePuzzleTotal))
value = 2;
else
value = 1;
break;
default:
return 0;
break;
}
}
return calculateLevel(type, value);
}