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


PHP Game::loadGame方法代码示例

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


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

示例1: index

 /**
  * PAGE: index
  * This method handles what happens when you move to http://yourproject/home/index (which is the default page btw)
  */
 public function index()
 {
     $redirected = false;
     //check if there is an error
     if ($_GET['error'] != '') {
         //load error page!
         die("<h1>Whoops, something went wrong, you can refresh to see if it fixes it otherwise check back later.</h1>");
     }
     if (isset($_GET['appSource'])) {
         $redirected = true;
         $appSource = (int) $_GET['appSource'];
     }
     if (!$redirected) {
         if (isset($_GET['id']) && $_GET['id'] != "") {
             $extraParameters['id'] = $_GET['id'];
         }
         if (isset($_GET['fbSource'])) {
             $extraParameters['appSource'] = $_GET['appSource'];
         }
         if (isset($_GET['traffic_source']) && $_GET['traffic_source'] != '') {
             $extraParameters['traffic_source'] = $_GET['traffic_source'];
         }
     }
     $signedRequest = null;
     if (isset($_POST['signed_request'])) {
         $signedRequest = self::parseSignedRequest($_POST['signed_request']);
     }
     Log::add('Signed request: ' . $signedRequest);
     //check if user_id
     if ($signedRequest === null) {
         //we need to get one!
         $url = Config::get('facebook.appurl') . "?" . http_build_query($_GET);
         header("location: " . $url);
         exit;
     }
     if (!isset($signedRequest['user_id']) || $signedRequest['user_id'] == '') {
         $redirectUrl = self::buildUrl($extraParameters);
         $oAuthUrl = "https://www.facebook.com/dialog/oauth?";
         $oAuthUrl .= http_build_query(array_filter(array('client_id' => Config::Get('facebook.appid'), 'redirect_uri' => self::buildUrl($extraParameters), 'scope' => 'user_friends,email')));
         die("<script>top.location.href = '" . $oAuthUrl . "';</script>");
     }
     $fbCurlReq = new Curl();
     $fbCurlReq->setOpt(CURLOPT_SSL_VERIFYPEER, false);
     $fbCurlReq->get('https://graph.facebook.com/me?access_token=' . $signedRequest['oauth_token']);
     if ($fbCurlReq->error) {
         Log::add('Error fb user profile ' . $fbCurlReq->error_code . ': ' . $fbCurlReq->error_message);
     } else {
         $dataArray = $fbCurlReq->response;
     }
     Log::add('dataArray = ' . print_r($dataArray, true));
     //check too see if this is a post :)
     $game = new Game();
     $game->loadGame((array) $dataArray, 'facebook', $extraParameters);
 }
开发者ID:sherdog,项目名称:wnd,代码行数:58,代码来源:home.php

示例2: index

 public function index()
 {
     list($loggedIn, $userData) = self::isSignedIn($_GET);
     //load! else redir.
     if ($loggedIn) {
         $dataArray['first_name'] = $userData['gamerName'];
         $dataArray['platform'] = 'yahoo';
         $dataArray['last_name'] = '';
         $dataArray['profileImg'] = $userData['userAvatar'];
         $dataArray['id'] = $userData['userId'];
         $dataArray['apiToken'] = $userData['apiToken'];
         $dataArray['userToken'] = $_GET['usertoken'];
         $game = new Game();
         $game->loadGame($dataArray, 'yahoo', $_GET);
     } else {
         $getParams = http_build_query($_GET);
         //well lets log them in.
         include APP_PATH . 'views/yahoo-login.php';
         die;
     }
 }
开发者ID:sherdog,项目名称:wnd,代码行数:21,代码来源:yahoo.php

示例3: Exception

<?php

require_once "lib/load.php";
if (!require_params("id", "action")) {
    die;
}
$action = $_REQUEST["action"];
$game = Game::loadGame($_REQUEST["id"]);
switch ($action) {
    case 'up':
    case 'down':
    case 'left':
    case 'right':
        echo json_encode($game->move($action));
        break;
    default:
        throw new Exception("Unknown action.");
        break;
}
开发者ID:shylux,项目名称:TheLegendOfROOT,代码行数:19,代码来源:api.php


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