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


PHP Globals::getGameInfo方法代码示例

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


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

示例1: array

<?php

$defaultEnd = TIME + 2 * 31 * 86400;
//3 months
$template->assign('DefaultEnd', $defaultEnd);
$template->assign('GameTypes', array('Default', 'Semi Wars', 'Draft', 'Newbie', 'FFA'));
//get information
$container = create_container('1.6/universe_create_save_processing.php', '1.6/universe_create_galaxies.php');
$template->assign('CreateGalaxiesHREF', SmrSession::getNewHREF($container));
$container['body'] = '1.6/universe_create_sectors.php';
$template->assign('EditGameHREF', SmrSession::getNewHREF($container));
if ($account->hasPermission(PERMISSION_EDIT_STARTED_GAMES)) {
    $games = Globals::getGameInfo();
} else {
    $games = array();
    $db->query('SELECT game_id FROM game WHERE start_date > ' . $db->escapeNumber(TIME) . ' ORDER BY end_date DESC');
    while ($db->nextRecord()) {
        $games[$db->getInt('game_id')] = Globals::getGameInfo($db->getInt('game_id'));
    }
}
$template->assignByRef('EditGames', $games);
开发者ID:smrealms,项目名称:smrv2.0,代码行数:21,代码来源:universe_create.php

示例2: array

<?php

$template->assign('PageTopic', 'Send Message');
if (isset($_REQUEST['game_id'])) {
    SmrSession::updateVar('SendGameID', $_REQUEST['game_id']);
}
$gameID = $var['SendGameID'];
// check if we know the game yet
if (empty($gameID)) {
    $template->assign('AdminMessageChooseGameFormHref', SmrSession::getNewHREF(create_container('skeleton.php', 'admin_message_send.php')));
    $template->assignByRef('Games', Globals::getGameInfo());
} else {
    $container = create_container('admin_message_send_processing.php');
    $container['SendGameID'] = $gameID;
    $template->assign('AdminMessageSendFormHref', SmrSession::getNewHREF($container));
    $template->assign('MessageGameID', $gameID);
    $template->assign('ExpireTime', 1);
    if ($gameID != 20000) {
        $gamePlayers = array();
        $db->query('SELECT account_id,player_id,player_name FROM player WHERE game_id = ' . $db->escapeNumber($gameID) . ' ORDER BY player_name');
        while ($db->nextRecord()) {
            $gamePlayers[] = array('AccountID' => $db->getField('account_id'), 'PlayerID' => $db->getField('player_id'), 'Name' => $db->getField('player_name'));
        }
        $template->assignByRef('GamePlayers', $gamePlayers);
    }
    if (isset($var['preview'])) {
        $template->assign('Preview', $var['preview']);
        $template->assign('ExpireTime', $var['expire']);
    }
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:30,代码来源:admin_message_send.php

示例3: foreach

    }
    ?>
					</td>
				</tr><?php 
} else {
    ?>
				<tr>
					<td align="right" class="bold">Player Name:</td>
					<td><input type="text" name="player_name" id="InputFields" size="20"></td>
				</tr>
				<tr>
					<td align="right" class="bold">Game:</td>
					<td>
						<select name="game_id" size="1" id="InputFields">
							<option value="0">All Games</option><?php 
    $Games =& Globals::getGameInfo();
    foreach ($Games as &$Game) {
        ?>
<option value="<?php 
        echo $Game['ID'];
        ?>
"><?php 
        echo $Game['GameName'];
        ?>
</option><?php 
    }
    unset($Game);
    ?>
						</select>
					</td>
				</tr><?php 
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:account_edit.php

示例4:

<?php

$game =& Globals::getGameInfo($var['game_id']);
$template->assignByRef('Game', $game);
// do we need credits for this game?
if ($game['GameCreditsRequired'] > 0) {
    // do we have enough
    if ($account->getTotalSmrCredits() < $game['GameCreditsRequired']) {
        create_error('Sorry you do not have enough SMR Credits to play this game.<br />To get SMR credits you need to donate to SMR.');
    }
}
// is the game already full?
if (SmrGame::getGame($var['game_id'])->getTotalPlayers() >= $game['GameMaxPlayers']) {
    create_error('The maximum number of players in that game is reached!');
}
//if (TIME < $game['StartDate'])
//	create_error('You want to join a game that hasn\'t started yet?');
if (TIME > $game['EndDate']) {
    create_error('You want to join a game that is already over?');
}
$template->assign('PageTopic', 'Join Game');
$raceInfo =& Globals::getRaces();
$raceDescriptions = '';
$first = true;
foreach ($raceInfo as $race) {
    if ($first) {
        $raceDescriptions .= '\'' . str_replace('\'', '\\\'"', $race['Description']) . '\'';
        $first = false;
    } else {
        $raceDescriptions .= ', \'' . str_replace('\'', '\\\'', $race['Description']) . '\'';
    }
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:game_join.php


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