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


PHP Type::getGroupID方法代码示例

本文整理汇总了PHP中Type::getGroupID方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::getGroupID方法的具体用法?PHP Type::getGroupID怎么用?PHP Type::getGroupID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Type的用法示例。


在下文中一共展示了Type::getGroupID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getBestTeamForActivity

 /**
  * Gets the best compatible Team for the activity and Type. 
  * Bonuses are ranked as material bonus > time bonus > cost bonus
  * 
  * @param int $activityID the ID of the activity to get Team for
  * @param Type $type It's always the final output item that needs to be given. This means that for manufacturing, 
  * its the Blueprint product; for copying its the Blueprint itself; for invention it is the product of the 
  * invented blueprint.
  *
  * @return Team|null
  */
 public function getBestTeamForActivity($activityID, Type $type)
 {
     $bestTeam = null;
     $bestModifier = null;
     try {
         //get available teams for the wanted activity
         $teams = $this->getTeamsForActivity($activityID);
     } catch (Exceptions\ActivityIdNotFoundException $e) {
         return null;
     }
     foreach ($teams as $candidateTeam) {
         //skip teams incompatible with output groupID
         if (!$candidateTeam->isGroupIDCompatible($type->getGroupID())) {
             continue;
         } elseif (is_null($bestTeam)) {
             $bestTeam = $candidateTeam;
             $bestModifier = $candidateTeam->getModifiersForGroupID($type->getGroupID());
         } else {
             $candidateModifier = $candidateTeam->getModifiersForGroupID($type->getGroupID());
             //Modifiers are ranked with priority order for material, time then cost modifiers (lower is better!)
             if ($bestModifier['m'] < $candidateModifier['m']) {
                 continue;
             } elseif ($bestModifier['m'] > $candidateModifier['m']) {
                 $bestTeam = $candidateTeam;
                 $bestModifier = $candidateModifier;
             } elseif ($bestModifier['t'] < $candidateModifier['t']) {
                 continue;
             } elseif ($bestModifier['t'] > $candidateModifier['t']) {
                 $bestTeam = $candidateTeam;
                 $bestModifier = $candidateModifier;
             } elseif ($bestModifier['c'] < $candidateModifier['c']) {
                 continue;
             } elseif ($bestModifier['c'] > $candidateModifier['c']) {
                 $bestTeam = $candidateTeam;
                 $bestModifier = $candidateModifier;
             }
         }
     }
     return $bestTeam;
 }
开发者ID:draivsolregard,项目名称:lmeve-ci,代码行数:51,代码来源:IndustryModifier.php

示例2: isTypeCompatible

 /**
  * Checks if the Team gives bonus to given Type
  * 
  * @param \iveeCore\Type $type to be checked
  * 
  * @return bool
  */
 public function isTypeCompatible(Type $type)
 {
     return $this->isGroupIDCompatible($type->getGroupID());
 }
开发者ID:draivsolregard,项目名称:lmeve-ci,代码行数:11,代码来源:Team.php

示例3: isTypeCompatible

 /**
  * Checks if a Type is compatible with the AssemblyLine. The passed Type should be the final product of the process. 
  * This means that for manufacturing, its the Blueprint product; for copying its the Blueprint itself; for invention 
  * it is the product of the invented blueprint.
  * 
  * @param Type $type the item to be checked
  * 
  * @return bool
  */
 public function isTypeCompatible(Type $type)
 {
     //the type is compatible if its groupID or categoryID is listet in the modifiers array
     return isset($this->groupModifiers[$type->getGroupID()]) or isset($this->categoryModifiers[$type->getCategoryID()]);
 }
开发者ID:draivsolregard,项目名称:lmeve-ci,代码行数:14,代码来源:AssemblyLine.php


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