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


PHP Game::updateRound方法代码示例

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


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

示例1: awardPoints

 public function awardPoints()
 {
     if (Game::findGame()->round > 0) {
         if (!isset($_SESSION["single"]) || $_SESSION["single"] != true) {
             $this->fillMissingAnswers();
         }
         usort($this->allAnswers, array("Answer", "sortMiles"));
         $totalPoints = count($this->allAnswers);
         foreach ($this->allAnswers as $key => $answer) {
             $answer->updateAnswer($totalPoints--);
         }
         Game::updateRound(-1 * $_SESSION["questionNumber"]);
     }
 }
开发者ID:theborland,项目名称:myhoot,代码行数:14,代码来源:Answer.php

示例2: createGame

 public static function createGame($replay, $game_idSet = null)
 {
     global $conn;
     $game_id = rand(10000, 99999);
     if ($game_idSet != null) {
         $game_id = 1111;
     }
     if ($replay == "yes") {
         $lastGame_ID = $_SESSION["game_id"];
     }
     date_default_timezone_set('America/New_York');
     //die (date("z"));
     $_SESSION["game_id"] = $game_id . str_pad(date("z"), 3, "0", STR_PAD_LEFT);
     //if ($single==true)
     if ($game_idSet != null) {
         $_SESSION["game_id"] = $game_id = 1111;
     }
     //   $_SESSION["game_id"]*=00;//, $single=false
     //$_SESSION["game_id"] =$_GET['game_id'];
     //$_SESSION["user_id"] =rand (0,111111111);
     $sql = "INSERT INTO `games` (`game_id`) VALUES ('{$_SESSION['game_id']}')";
     //echo $sql;
     $result = $conn->query($sql);
     $_SESSION["questionNumber"] = 0;
     Game::updateRound(-1);
     if ($replay == "yes") {
         //SOCKET SENDING MESSAGE
         $entryData = array('category' => "Game" . $lastGame_ID . "NextGame", 'title' => substr($_SESSION["game_id"], 0, 5));
         $context = new ZMQContext();
         $socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');
         $socket->connect("tcp://127.0.0.1:5555");
         $socket->send(json_encode($entryData));
         $entryData = array('category' => "Game" . $lastGame_ID . "Status", 'title' => substr($_SESSION["game_id"], 0, 5), 'type' => "NextGame");
         $socket->send(json_encode($entryData));
     }
 }
开发者ID:theborland,项目名称:myhoot,代码行数:36,代码来源:Game.php

示例3: __construct

 function __construct($type)
 {
     if ($type != null) {
         $_SESSION["questionNumber"]++;
         $this->type = $type;
         if ($type == "geo") {
             $this->getLocation($type);
         } else {
             if ($type == "weather") {
                 $this->getWeather();
             } else {
                 if ($type == "entertainment") {
                     $this->getEntertainment();
                 } else {
                     if ($type == "pt") {
                         $this->getPPT("pt");
                     } else {
                         if ($type == "places") {
                             $this->getPPT("places");
                         } else {
                             if ($type == "sports") {
                                 $this->getQuestion($type);
                             } else {
                                 if ($type == "science") {
                                     $this->getQuestion($type);
                                 } else {
                                     if ($type == "time") {
                                         $this->getTime();
                                     } else {
                                         if ($type == "facts") {
                                             $this->getFacts();
                                         } else {
                                             //if ($type=="rand")
                                             $this->getQuestion($type);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //if ($type=="user")
         //		$this->getUserQuestion();
         $this->addAnswer();
         //echo "in here again";
         Game::updateRound($_SESSION["questionNumber"], $this->type);
         if ($this->type == "time") {
             if ($this->answer < -200) {
                 $region = 0;
             } else {
                 if ($this->answer < 600) {
                     $region = 1;
                 } else {
                     if ($this->answer < 1200) {
                         $region = 2;
                     } else {
                         if ($this->answer < 1600) {
                             $region = 3;
                         } else {
                             $region = 4;
                         }
                     }
                 }
             }
             $this->alertUsers($_SESSION["questionNumber"], "WorldTime" . $region);
         } else {
             if ($this->type == "facts" && $this->max == -100) {
                 $this->alertUsers($_SESSION["questionNumber"], "factsPercent");
             } else {
                 if ($this->type == "facts" && $this->max == 100) {
                     $this->alertUsers($_SESSION["questionNumber"], "facts");
                 } else {
                     if ($this->type == "facts" && $this->max < 100) {
                         $this->alertUsers($_SESSION["questionNumber"], "factsMax");
                     } else {
                         if ($this->type == "facts" && $this->max > 0) {
                             $this->alertUsers($_SESSION["questionNumber"], "factsRand");
                         } else {
                             $this->alertUsers($_SESSION["questionNumber"], $this->type);
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:theborland,项目名称:myhoot,代码行数:88,代码来源:Question.php


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