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


PHP CR3DCQuery::CreateGame方法代码示例

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


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

示例1: elseif

///////////////////////////////////////////////////////////////////////
$bGameCreated = false;
//Create the chess game
if ($cmdCreateGame != "" && $my_color != "") {
    $bRTGame = false;
    if ($chkrealtime != "") {
        $bRTGame = true;
    }
    $bRTGamepass = false;
    if ($chkrealtimeposs != "") {
        $bRTGamepass = true;
    }
    if (trim($fen) != "") {
        // validate the fen
        if (preg_match('/^([rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/\\s[wb]{1}\\s[KQkq-]{1,4}\\s-\\s[0-9]{1,4}\\s[1-9]{1,4})$/', trim($fen))) {
            $txtgid = $oR3DCQuery->CreateGame($config, $_SESSION['sid'], $_SESSION['id'], $otherplayerid, $my_color, $fen, $move1, $time1, $move2, $time2, $bRTGame, 0, $bRTGamepass, $slctGameRating, $slctGameTime);
            $bGameCreated = true;
        } elseif (preg_match('/^([rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\/?[rnbqkpRNBQKP1-8]{1,8}\\s[wb]{1}\\s[KQkq-]{1,4}\\s-\\s[0-9]{1,4}\\s[1-9]{1,4})$/', trim($fen))) {
            list($part1, $part2, $part3, $part4, $part5) = explode(" ", $fen, 5);
            $fen = "{$part1}/ {$part2} {$part3} {$part4} {$part5}";
            $txtgid = $oR3DCQuery->CreateGame($config, $_SESSION['sid'], $_SESSION['id'], $otherplayerid, $my_color, $fen, $move1, $time1, $move2, $time2, $bRTGame, 0, $bRTGamepass, $slctGameRating, $slctGameTime);
            $bGameCreated = true;
        }
    } else {
        if (trim($fen) == "") {
            $txtgid = $oR3DCQuery->CreateGame($config, $_SESSION['sid'], $_SESSION['id'], $otherplayerid, $my_color, $fen, $move1, $time1, $move2, $time2, $bRTGame, $precreate, $bRTGamepass, $slctGameRating, $slctGameTime);
            $bGameCreated = true;
        }
    }
}
?>
开发者ID:robertohernando,项目名称:phpchess,代码行数:31,代码来源:chess_create_game_oc.php

示例2: unset

     // Real Time Game check
     if ($_GET['brealtimeposs'] == true && $_GET['brtGame'] == true) {
         $strErrorLine = $strErrorLine . "<ERROR>IDS_INVALID_VAR_BREALTIMEPOSS_AND_BRTGAME_BOTH_TRUE</ERROR>\n";
     }
     // Normal/Pasv game timeout check
     if (($_GET['brtGame'] == false && $_GET['brealtimeposs'] == true || $_GET['brtGame'] == false && $_GET['brealtimeposs'] == false) && $_GET['gametime'] != "C-Normal" && $_GET['gametime'] != "C-Blitz" && $_GET['gametime'] != "C-Short" && $_GET['gametime'] != "C-Slow" && $_GET['gametime'] != "C-Snail") {
         $strErrorLine = $strErrorLine . "<ERROR>IDS_INVALID_VAR_TIMEOUT_NORMAL_PASVRT_GAME</ERROR>\n";
     }
     // Active Real-time timeout check
     if ($_GET['brtGame'] == true && $_GET['brealtimeposs'] == false && $_GET['gametime'] != "RT-Custom" && $_GET['gametime'] != "RT-Blitz" && $_GET['gametime'] != "RT-Short" && $_GET['gametime'] != "RT-Normal" && $_GET['gametime'] != "RT-Slow") {
         $strErrorLine = $strErrorLine . "<ERROR>IDS_INVALID_VAR_TIMEOUT_ACTIVERT_GAME</ERROR>\n";
     }
     if ($strErrorLine == "") {
         //Instantiate theCR3DCQuery Class
         $oR3DCQuery = new CR3DCQuery($config);
         $txtgid = $oR3DCQuery->CreateGame($config, $xsid, $player_id, $_GET['oplayerid'], $_GET['mypiececolor'], $fen, $_GET['move1'], $_GET['time1'], $_GET['move2'], $_GET['time2'], $_GET['brtGame'], $precreate, $_GET['brealtimeposs'], $_GET['ratingtype'], $_GET['gametime']);
         $oR3DCQuery->Close();
         unset($oR3DCQuery);
         echo "<RESPONSE>\n";
         echo "<CREATEGAMECODE>" . $txtgid . "</CREATEGAMECODE>\n";
         echo "</RESPONSE>\n";
     } else {
         echo "<RESPONSE>\n";
         echo $strErrorLine;
         echo "</RESPONSE>\n";
     }
 } else {
     echo "<RESPONSE>\n";
     echo "<ERROR>IDS_SESSION_ID_INVALID</ERROR>\n";
     echo "</RESPONSE>\n";
 }
开发者ID:robertohernando,项目名称:phpchess,代码行数:31,代码来源:mobile.php

示例3: create_game

function create_game()
{
    $settings = $_POST['instance'];
    //$fen = $settings['board'];
    $fen = "";
    $wplayer = (int) $settings['w_player_id'];
    $bplayer = (int) $settings['b_player_id'];
    $fen = $settings['fen'];
    $rated = $settings['rated'] ? 'grated' : 'gunrated';
    $game_time = $settings['game_time'];
    if (!in_array($game_time, array('C-Blitz', 'C-Short', 'C-Normal', 'C-Slow', 'C-Snail'))) {
        return array('success' => FALSE, 'error' => 'validation_failed', 'validation_errors' => array('game_time' => array('type' => 'custom', 'error_msg' => 'Game time is invalid')));
    }
    $move1 = (int) $settings['tc']['move1'];
    $move2 = (int) $settings['tc']['move2'];
    $time1 = (int) $settings['tc']['time1'];
    $time2 = (int) $settings['tc']['time2'];
    if ($move1 == 0) {
        $move1 = NULL;
    }
    if ($move2 == 0) {
        $move2 = NULL;
    }
    if ($time1 == 0) {
        $time1 = NULL;
    }
    if ($time2 == 0) {
        $time2 = NULL;
    }
    if ($wplayer == $bplayer) {
        return array('success' => FALSE, 'error' => 'validation_failed', 'validation_errors' => array('w_player_id' => array('type' => 'custom', 'error_msg' => __l('Same person cannot play both sides'))));
    }
    $player_id = $wplayer != 0 ? $wplayer : $bplayer;
    // player id of 0 = ANYONE
    $other_player_id = $wplayer != 0 ? $bplayer : $wplayer;
    $my_color = $wplayer == $player_id ? 'w' : 'b';
    //echo "will pass: $player_id, $other_player_id, $my_color, $fen, $rated";
    $oR3DCQuery = new CR3DCQuery('../bin/config.php');
    $result = $oR3DCQuery->CreateGame(NULL, NULL, $player_id, $other_player_id, $my_color, $fen, $move1, $time1, $move2, $time2, TRUE, FALSE, TRUE, $rated, $game_time);
    //$oR3DCQuery->createGame(NULL, NULL, $player_id, $other_player_id, $my_color, $fen, $move1, $time1, $move2, $time2, $bRTGame, $precreate, $brealtimeposs, $Rating, $GameTime){
    if ($result) {
        return array('success' => TRUE);
    } else {
        return array('success' => FALSE, 'error' => __l('Unable to create game'));
    }
}
开发者ID:robertohernando,项目名称:phpchess,代码行数:46,代码来源:admin_game_list.php


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