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


PHP Booster::generate方法代码示例

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


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

示例1: begin

 public function begin()
 {
     // Launch first step for tournament (draft, build ...)
     // DB
     shuffle($this->players);
     // Give random numbers to players
     foreach ($this->players as $i => $player) {
         $player->insert($i);
     }
     // And store them now we're sure to start
     // TS3
     if ($this->observer->ts3) {
         ts3_co();
         $cid = ts3_chan('Tournament ' . $this->id, $this->name);
         // Create chan
         ts3_invite($this->players, $cid);
         // Move each tournament's player to chan
         ts3_disco();
     }
     // Unicity
     $upool = array();
     // All cards in current tournament's players pools
     //that comes from a "uniq" extension
     switch ($this->format) {
         case 'draft':
             $number = 0;
             foreach ($this->data->boosters as $ext) {
                 $number++;
                 // Number of current booster in draft for player
                 //$booster = null ;
                 foreach ($this->players as $player) {
                     //if ( ( $booster == null ) || ! $this->data->clone_sealed ) {
                     $booster = new Booster($this, $player->order, $number);
                     $booster->generate($ext, $upool);
                     /*} else {
                     			$boost = new Booster($this, $player->order, $number) ;
                     			$boost->get_content($booster->content) ;
                     			$boost->insert() ;
                     		}*/
                     $this->boosters[] = $booster;
                 }
             }
             $this->set_status(3);
             $this->timer_goon(Tournament::draft_time());
             $this->log('', 'draft', '');
             break;
         case 'sealed':
             foreach ($this->data->boosters as $ext) {
                 $ext_obj = Extension::get($ext);
                 if ($ext_obj == null) {
                     $this->say("Extension {$ext} not found in sealed generation");
                     continue;
                 }
                 $booster = null;
                 foreach ($this->players as $player) {
                     if ($booster == null || !$this->data->clone_sealed) {
                         $booster = $ext_obj->booster($upool);
                     }
                     // Only need object in memory for sealed
                     foreach ($booster as $card) {
                         $player->pick($card);
                     }
                 }
             }
             foreach ($this->players as $player) {
                 $player->summarize(true);
             }
             $this->build();
             break;
         default:
             $this->start();
     }
 }
开发者ID:OlivierLamiraux,项目名称:mtgas,代码行数:73,代码来源:ws_tournament.php


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