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


PHP Game::get方法代码示例

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


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

示例1: getGroupedGames

 public function getGroupedGames()
 {
     // show all if in draft mode
     $mode = Versioned::get_reading_mode();
     if ($mode == 'Stage.Stage') {
         $items = GroupedList::create(Game::get()->filter(array('ParentID' => $this->getCurrentEvent()->ID))->sort('Session'));
     } else {
         $items = GroupedList::create(Game::get()->filter(array('ParentID' => $this->getCurrentEvent()->ID, 'Status' => true))->sort('Session'));
     }
     return $items;
 }
开发者ID:adrexia,项目名称:chimera,代码行数:11,代码来源:Page.php

示例2: getAllTags

 public function getAllTags($current = false)
 {
     if ($current) {
         $games = $this->getCurrentGames();
     } else {
         $games = Game::get();
     }
     $list = array();
     $result = new ArrayList();
     foreach ($games as $game) {
         $tags = $game->getGenresArray();
         for ($i = 0; $i < count($tags); $i++) {
             $list[$tags[$i]] = $tags[$i];
         }
     }
     asort($list);
     foreach ($list as $item) {
         $result->push(new ArrayData(array('Title' => $item)));
     }
     return $result;
 }
开发者ID:helpfulrobot,项目名称:adrexia-gamesevent,代码行数:21,代码来源:GameListingPage.php

示例3: addGame

 /**
  * Attempts to save a game
  *
  * @return Game|null
  */
 protected function addGame($form)
 {
     $siteConfig = SiteConfig::current_site_config();
     $member = Member::currentUser();
     $params = $this->request->allParams();
     $fields = $form->Fields();
     $id = $fields->dataFieldByName('ID')->Value();
     $game = Game::get()->byID($id);
     if (!$game) {
         $game = Game::create();
     }
     $form->saveInto($game);
     $game->FacilitatorID = $game->FacilitatorID ? $game->FacilitatorID : $member->ID;
     $game->ParentID = $siteConfig->CurrentEventID;
     try {
         $game->write();
     } catch (ValidationException $e) {
         $form->sessionMessage($e->getResult()->message(), 'bad');
         return;
     }
     return $game;
 }
开发者ID:helpfulrobot,项目名称:adrexia-gamesevent,代码行数:27,代码来源:SubmitGamePage.php

示例4: joined_duel

 public function joined_duel($id)
 {
     foreach ($this->joined_duels as $i => $duel) {
         if ($duel->id == $id) {
             return $duel;
         }
     }
     $duel = Game::get($id);
     if ($duel == null) {
         return false;
     }
     $duel->type = 'joineduel';
     $this->joined_duels[] = $duel;
     return $duel;
 }
开发者ID:OlivierLamiraux,项目名称:mtgas,代码行数:15,代码来源:ws_gameserver.php

示例5: addPlayerGame

 /**
  * Attempts to save a game
  *
  * @return Game|null
  */
 protected function addPlayerGame($data, $form)
 {
     $fields = $form->Fields();
     $event = $this->getCurrentEvent();
     $currentID = $event->ID;
     $prefNum = $event->PreferencesPerSession;
     $regID = $data['RegistrationID'];
     $reg = Registration::get()->byID($regID);
     if (!$reg) {
         return false;
     }
     // @todo - handle a proper 'change game' case
     if ($reg->PlayerGames()->Count() > 0) {
         foreach ($reg->PlayerGames() as $playerGame) {
             $reg->PlayerGames()->removeByID($playerGame->ID);
             $playerGame->delete();
         }
     }
     $favouriteID = $data["FavouriteID"];
     for ($session = 1; $session <= $event->NumberOfSessions; $session++) {
         $notPlay = $data["NotPlaying_" . $session];
         $games = Game::get()->filter(array('Session' => $session, 'ParentID' => $currentID, 'Status' => true));
         // Alter prefnumber so it stops when it encounters "not Playing"
         if ($notPlay != 0 && $notPlay < $prefNum) {
             $prefNum = $notPlay;
         }
         // if first choice is to not play, don't create any games
         if ($notPlay === 1) {
             continue;
         }
         foreach ($games as $game) {
             $gamePref = $data["GameID_" . $game->ID];
             // only store games with a preference higher than our threshold
             if ($gamePref > $prefNum || !isset($gamePref)) {
                 continue;
             }
             $playerGame = PlayerGame::create();
             $form->saveInto($playerGame);
             $playerGame->GameID = $game->ID;
             $playerGame->ParentID = $regID;
             $playerGame->Preference = $gamePref;
             if ($favouriteID == $game->ID) {
                 $playerGame->Favourite = true;
             }
             try {
                 $playerGame->write();
             } catch (ValidationException $e) {
                 $form->sessionMessage($e->getResult()->message(), 'bad');
                 return;
             }
         }
     }
     return $playerGame;
 }
开发者ID:helpfulrobot,项目名称:adrexia-gamesevent,代码行数:59,代码来源:GameSignupPage.php

示例6: doAssignTeams

 public function doAssignTeams($data, Form $form)
 {
     // assign teams to the game
     $game = Game::get()->filter('ID', $data['GameID'])->first();
     $teamsCount = $game->Teams()->count();
     if ($teamsCount < 2) {
         // add the teams
         $game->Teams->add($data['TeamOne']);
         $game->Teams->add($data['TeamTwo']);
     }
     $redirectLink = $this->Link() . '?success=1';
     return $this->redirect($redirectLink);
 }
开发者ID:jackmarchant,项目名称:foosfirst,代码行数:13,代码来源:GamesPage.php

示例7: getGroupedGames

 public function getGroupedGames()
 {
     return GroupedList::create(Game::get()->filter(array('ParentID' => $this->getCurrentEvent()->ID, 'Status' => true))->sort('Session'));
 }
开发者ID:adrexia,项目名称:medusa,代码行数:4,代码来源:Page.php

示例8: index

 /**
  * Display a listing of games
  *
  * @return Response
  */
 public function index()
 {
     $games['inProgress'] = Game::get();
     $games['completed'] = Game::onlyTrashed()->get();
     return View::make('games.index', compact('games'));
 }
开发者ID:orbitroom,项目名称:4isk,代码行数:11,代码来源:GamesController.php


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