当前位置: 首页>>代码示例>>C++>>正文


C++ Statistic::getStatistic方法代码示例

本文整理汇总了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;
}
开发者ID:tecton,项目名称:HexGame,代码行数:42,代码来源:achievements.cpp

示例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);
}
开发者ID:tecton,项目名称:HexGame,代码行数:36,代码来源:achievements.cpp


注:本文中的Statistic::getStatistic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。