當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Game::newGame方法代碼示例

本文整理匯總了PHP中Game::newGame方法的典型用法代碼示例。如果您正苦於以下問題:PHP Game::newGame方法的具體用法?PHP Game::newGame怎麽用?PHP Game::newGame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Game的用法示例。


在下文中一共展示了Game::newGame方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: header

<?php

User::requireLoggedIn();
if (require_params("new")) {
    Game::newGame($_REQUEST["new"]);
}
if (require_params("reset_dungeon")) {
    $game = Game::load();
    $game->delete();
    header("Location: /game");
    die;
}
if (require_params("reset_messages")) {
    $_SESSION["user"]->json_data["read_messages"] = array();
    $_SESSION["user"]->save();
    header("Location: /game");
    die;
}
if (true) {
    $game = Game::load();
    ?>
<h2><?php 
    echo $game->name;
    ?>
</h2>
<a href="?reset_dungeon=true">Reset dungeon</a>
<a href="?reset_messages=true">Reset read messages</a>
<div id="game-container" class="game-tile"></div>

<script type="text/javascript">
TLOR.setup($('#game-container'), <?php 
開發者ID:shylux,項目名稱:TheLegendOfROOT,代碼行數:31,代碼來源:game.php

示例2: load

 public static function load()
 {
     $username = $_SESSION["user"]->name;
     if (!$GLOBALS["db"]->exists("games", array("username"), array("username" => $username))) {
         Game::newGame("origin");
     }
     $game_array = $GLOBALS["db"]->selectAll("games", array("username" => $username))[0];
     $game_unpacked = json_decode($game_array["json_data"]);
     $game = new Game();
     apply_arr($game_unpacked, $game);
     return $game;
 }
開發者ID:shylux,項目名稱:TheLegendOfROOT,代碼行數:12,代碼來源:class.game.php

示例3: header

<?php

require_once "config.php";
header("Content-Type: application/json");
$return = array();
if (empty($_POST['title']) or empty($_POST['description'])) {
    $return['status'] = 'error';
    $return['message'] = 'Missing Fields';
    echo json_encode($return);
    exit;
}
// Add userid to post for User::newUser
if (!isset($_SESSION['userid'])) {
    $return['status'] = 'error';
    $return['message'] = 'Must Be Logged In To Create Games';
    echo json_encode($return);
    exit;
}
$_POST['userid'] = $_SESSION['userid'];
$newGame = Game::newGame($_POST);
if ($newGame['status'] == 'success') {
    $return['status'] = 'success';
    $return['relocate'] = "view_deck.php?deckid=" . $_POST['deckid'];
} else {
    $return['status'] = $newUser['status'];
    $return['message'] = $newUser['message'];
}
echo json_encode($return);
開發者ID:PercyODI,項目名稱:copeappgames,代碼行數:28,代碼來源:new_game.php


注:本文中的Game::newGame方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。