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


PHP game类代码示例

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


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

示例1: index

	function index(){
		if (!$this->sub){
			return array(
			'name'=>'微游戏',
			'subkeywords'=>1,
			'sublinks'=>1,
			);
		}else {
			$game=new game();
			$items=M('Games')->where(array('token'=>$this->token))->select();
			$arr=array(
			'name'=>'微游戏',
			'subkeywords'=>array(
			),
			'sublinks'=>array(
			),
			);
			if ($items){
				foreach ($items as $v){
					$link=$game->getLink($v,'{wechat_id}');
					$arr['subkeywords'][$v['id']]=array('name'=>$v['title'],'keyword'=>$v['keyword']);
					$arr['sublinks'][$v['id']]=array('name'=>$v['title'],'link'=>$link);
				}
			}
			return $arr;
		}
		
	}
开发者ID:kevicki,项目名称:pig,代码行数:28,代码来源:FunctionLibrary_game.class.php

示例2: process

 public function process()
 {
     $user = user::getInstance();
     $db = db::getInstance();
     include './models/game.class.php';
     include './models/grid.class.php';
     // récupérer le gameid
     $this->gameid = isset($_REQUEST['gameid']) ? intval($_REQUEST['gameid']) : false;
     if ($this->gameid === false) {
         trigger_error('Game not found', E_USER_ERROR);
     }
     // lecture de l'objet game
     $game = new game();
     $game->read($this->gameid);
     // création d'une nouvelle grille
     $gridtype = GRIDTYPE_ALLWORDS;
     $grid = new grid();
     $gridid = $grid->create($gridtype);
     // ajout de la grille au game
     $game->assign_grid($gridid);
     $game->start_grid($gridid);
     // enrichissement du retour json
     $res = $grid->get();
     $res->gameid = $this->gameid;
     $res->gametype = GAMETYPE_PRACTICE_ALLWORDS;
     header('Content-Type: application/json');
     echo json_encode($res);
     die;
 }
开发者ID:ryu38000,项目名称:Magic-Word-game,代码行数:29,代码来源:game.launch.practice.allwords.class.php

示例3: index

 public function index()
 {
     $thisItem = $this->item;
     $game = new game();
     $link = $game->getLink($thisItem, $this->wechat_id);
     return array(array(array($thisItem['title'], $thisItem['intro'], $thisItem['picurl'], $link)), 'news');
 }
开发者ID:node-rookie,项目名称:bdg,代码行数:7,代码来源:GameReply.class.php

示例4: myDynamic

	public function myDynamic()
	{
		$vhost = 'http://www.meihua.com';
		$wxinfo = M('Wxuser')->where(array('uid' => intval(session('uid')), 'token' => $this->token))->find();
		$PData = array('uname' => $this->token, 'domain' => $_SERVER['HTTP_HOST'], 'email' => $wxinfo['qq'], 'gzh' => $wxinfo['wxid'], 'gzhname' => $wxinfo['wxname']);
		$key = 'Y@2T&9i3l#m8u';
		$tmp = array();

		foreach ($PData as $kk => $vv) {
			$tmp[] = md5($kk . trim($vv) . $key);
		}

		$game = new game();
		$key = base64_encode(implode('_', $tmp));
		$PData['key'] = $key;
		$request_url = $vhost . '/index.php?m=Index&c=login&a=verifyUser';
		$tmpdata = $game->api_notice_increment($request_url, $PData, 'POST');

		if ($tmpdata == '') {
			$tmpdata = $game->api_notice_increment($request_url, $PData, 'POST');
		}

		$type = $this->_get('type', 'trim');
		unset($_GET['token']);
		$iframeUrl = $vhost . '/index.php?m=Index&c=login&a=loginNoPwd&logkey=' . $tmpdata . '&' . http_build_query($_GET);
		$this->assign('iframeUrl', $iframeUrl);
		$this->display();
	}
开发者ID:kevicki,项目名称:pig,代码行数:28,代码来源:CustomTmplsAction.class.php

示例5: link

	public function link()
	{
		$id = $this->_get("id");
		$wecha_id = $this->wecha_id;
		$siteUrl = $this->_get("siteurl");
		$item = M("Games")->where(array("id" => $id))->find();

		if ($item) {
			$game = new game();
			$url = $game->getLink($item, $wecha_id, $siteUrl);
			header("Location:" . $url);
		}
	}
开发者ID:kevicki,项目名称:pig,代码行数:13,代码来源:GameAction.class.php

示例6: process

 public function process()
 {
     $db = db::getInstance();
     $user = user::getInstance();
     include './models/game.class.php';
     // récupérer le gameid si il existe
     $game = false;
     $this->gameid = isset($_REQUEST['gameid']) ? intval($_REQUEST['gameid']) : false;
     if ($this->gameid !== false) {
         $game = new game();
         if (!$game->read($this->gameid)) {
             $this->gameid = false;
             trigger_error('Game not found!', E_USER_ERROR);
         }
         if (!isset($game->userids[$user->id])) {
             $this->gameid = false;
             trigger_error('Not your game!', E_USER_ERROR);
         }
     }
     /*// fermer toute grille en cours pour cet utilisateur
     		$sql = 'UPDATE gamesstatus
     					SET gridstatus = ' . intval(GRIDSTATUS_FINISHED) . '
     					WHERE userid = ' . intval($user->id) . '
     						AND gridstatus = ' . intval(GRIDSTATUS_STARTED);
     		$db->query($sql);*/
     // déterminer le type de partie à partir du mode
     $gametype = false;
     switch ($this->mode) {
         case 'game.launch.practice.allwords':
             $gametype = GAMETYPE_PRACTICE_ALLWORDS;
             break;
         case 'game.launch.practice.longest':
             $gametype = GAMETYPE_PRACTICE_LONGEST;
             break;
         case 'game.launch.practice.constraints':
             $gametype = GAMETYPE_PRACTICE_CONSTRAINTS;
             break;
         case 'game.launch.practice.full':
             $gametype = GAMETYPE_PRACTICE_FULL;
             break;
     }
     // créer une nouvelle partie
     if (!$this->gameid) {
         $userids = array($user->id);
         $game = new game();
         $this->gameid = $game->create($userids, $gametype, $user->get_lang());
     }
     return $this->display();
 }
开发者ID:ryu38000,项目名称:Magic-Word-game,代码行数:49,代码来源:game.launch.practice.main.class.php

示例7: send_email

    /** Send en bestemt artikkel på e-post */
    protected function send_email($row)
    {
        $this->email->text('Hei,

Siden du ikke lengre er med i avisfirmaet "' . $row['ff_name'] . '" har din artikkel blitt slettet fordi den ikke tilhørte noen utgivelse. I tilfelle du kanskje ønsker å beholde teksten fra artikkelen, sender vi den på e-post.

Avisfirma: ' . $row['ff_name'] . ' <' . ess::$s['path'] . '/ff/?ff_id=' . $row['ff_id'] . '>

Tittel: ' . $row['ffna_title'] . '
Opprettet: ' . ess::$b->date->get($row['ffna_created_time'])->format(date::FORMAT_SEC) . ($row['ffna_updated_time'] ? '
Sist oppdatert: ' . ess::$b->date->get($row['ffna_updated_time'])->format(date::FORMAT_SEC) : '') . ($row['ffna_published'] ? '
Publisert: ' . ess::$b->date->get($row['ffna_published_time'])->format(date::FORMAT_SEC) : '') . '
Pris: ' . game::format_cash($row['ffna_price']) . '

Innhold:

-- START --
' . $row['ffna_text'] . '
-- SLUTT --

--
Kofradia.no
Denne e-posten er sendt til ' . $row['u_email'] . ' som ' . ($row['up_access_level'] == 0 ? 'tidligere tilhørte' : 'tilhører') . ' ' . $row['up_name'] . '
' . ess::$s['path']);
        $this->email->format();
        mailer::add_emails($this->email, $row['u_email'], "Din tidligere artikkel: {$row['ffna_title']} - Kofradia", true);
        putlog("CREWCHAN", "AVISARTIKKEL SLETTET: E-post planlagt for utsendelse. %c4Mailer scriptet må kjøres!");
    }
开发者ID:Kuzat,项目名称:kofradia,代码行数:29,代码来源:class.avis_slett_artikler.php

示例8: process

    public function process()
    {
        $db = db::getInstance();
        $user = user::getInstance();
        include './models/game.class.php';
        include './models/grid.class.php';
        // récupérer le gameid
        $this->gameid = isset($_REQUEST['gameid']) ? intval($_REQUEST['gameid']) : false;
        if ($this->gameid === false) {
            trigger_error('Game not found', E_USER_ERROR);
        }
        // lecture de l'objet game
        $game = new game();
        $game->read($this->gameid);
        // lire les grilles terminées pour trouver le prochain type de grille
        $sql = 'SELECT COUNT(gridid) AS count_gridid
					FROM gamesstatus
					WHERE gameid = ' . intval($this->gameid) . '
						AND userid = ' . intval($user->id) . '
						AND gridstatus = ' . intval(GRIDSTATUS_FINISHED);
        $result = $db->query($sql);
        $grid_count = ($row = $result->fetch_assoc()) ? intval($row['count_gridid']) : 0;
        // déterminer le prochain type de grille
        switch ($grid_count) {
            case 0:
                $gridtype = GRIDTYPE_ALLWORDS;
                break;
            case 1:
                $gridtype = GRIDTYPE_LONGEST;
                break;
            case 2:
                $gridtype = GRIDTYPE_CONSTRAINTS;
                break;
        }
        // création d'une nouvelle grille
        $grid = new grid();
        $gridid = $grid->create($gridtype);
        // ajout de la grille au game
        $game->assign_grid($gridid);
        $game->start_grid($gridid);
        $res = $grid->get();
        $res->gameid = $this->gameid;
        $res->gametype = GAMETYPE_PRACTICE_FULL;
        header('Content-Type: application/json');
        echo json_encode($res);
        die;
    }
开发者ID:ryu38000,项目名称:Magic-Word-game,代码行数:47,代码来源:game.launch.practice.full.class.php

示例9: test

 public function test()
 {
     $username = "howdy";
     $password = "123456";
     $email = "gg@gmail.com";
     $username2 = "bla2";
     $password2 = "pass2";
     $email2 = "gr@gmmail.com";
     user::create_new_user($username, $password, $email);
     $this->assertEquals(1, user::getNumberOfUsers(), "number of users is not correct after adding a new user");
     user::create_new_user($username2, $password2, $email2);
     $this->assertEquals(2, user::getNumberOfUsers(), "number of users is not correct after adding a new user");
     $user1ID = user::getUserByUsername($username)['id'];
     $user2ID = user::getUserByUsername($username2)['id'];
     $game_size = 6;
     $this->assertTrue(game::add_new_game($user1ID, $game_size, $user1ID, $user2ID), "failed to add a new game");
     $game_id1 = game::$last_inserted_id;
     $this->assertTrue(game::add_new_game($user2ID, $game_size, $user2ID, $user1ID), "failed to add a new game");
     $game_id2 = game::$last_inserted_id;
     //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
     //message::get_all_messages_for_game_id($game_id)
     //message::add_new_message($game_id,$user_id,$message)
     $message = "helllo";
     $this->assertNull(message::get_all_messages_for_game_id($game_id1), "null should be returned because no messages added for the given game_id [get_all_messages_for_game_id()]");
     $this->assertNull(message::get_all_messages_for_game_id("rr"), "null should be returned because an invalid game_id was passed [get_all_messages_for_game_id()]");
     $this->assertFalse(message::add_new_message("hhh", $user1ID, $message), "false should be reutnred because an invalid game_id was passed [add_new_message()]");
     $this->assertFalse(message::add_new_message($game_id1, "blla", $message), "false should be reutnred because an invalid user_id was passed [add_new_message()]");
     $this->assertTrue(message::add_new_message($game_id1, $user1ID, $message), "falied to add new message [add_new_message()]");
     $this->assertEquals(1, count(message::get_all_messages_for_game_id($game_id1)), "expecting to get an array with one message [get_all_messages_for_game_id()]");
     $messages = message::get_all_messages_for_game_id($game_id1);
     $this->assertEquals($message, $messages[0]['message_text'], "[add_new_message()]");
     $this->assertEquals($game_id1, $messages[0]['gameID'], "[add_new_message()]");
     $this->assertEquals($user1ID, $messages[0]['userID'], "[add_new_message()]");
     $this->assertTrue(message::add_new_message($game_id2, $user1ID, "yolooo"), "falied to add new message [add_new_message()]");
     $message2 = "where are you";
     $this->assertTrue(message::add_new_message($game_id1, $user2ID, $message2), "falied to add new message [add_new_message()]");
     $this->assertEquals(2, count(message::get_all_messages_for_game_id($game_id1)), "expecting to get an array with two messages [get_all_messages_for_game_id()]");
     //message::get_message_count($game_id)
     $this->assertEquals(2, message::get_message_count($game_id1), "[message::get_message_count()]");
     $this->assertEquals(-1, message::get_message_count("asdasdasd"), "providing an invalid game_id so it should be rejected[message::get_message_count()]");
     message::clear_table();
     $this->assertEquals(0, message::get_message_count($game_id1), "[message::get_message_count()]");
     $this->assertTrue(message::add_new_message($game_id1, $user1ID, $message), "falied to add new message [add_new_message()]");
     $this->assertTrue(message::add_new_message($game_id1, $user2ID, $message2), "falied to add new message [add_new_message()]");
     $this->assertTrue(message::add_new_message($game_id2, $user1ID, "yolooo"), "falied to add new message [add_new_message()]");
     $this->assertEquals(1, message::get_message_count($game_id2), "[message::get_message_count()]");
     $messages = message::get_all_messages_for_game_id($game_id1);
     //message::get_all_messages_after_given_date($game_id,$date)
     $this->assertNull(message::get_all_messages_after_given_date(0, 0), "get_all_messages_after_given_date()");
     $this->assertNull(message::get_all_messages_after_given_date($messages[1]['gameID'], $messages[1]['date']), "get_all_messages_after_given_date()");
     $this->assertEquals(1, count(message::get_all_messages_after_given_date($messages[0]['gameID'], $messages[0]['date'])), "get_all_messages_after_given_date()");
     $this->assertEquals(2, count(message::get_all_messages_after_given_date($messages[0]['gameID'], $messages[0]['date'] - 0.1)), "get_all_messages_after_given_date()");
     //message::delete_message($message_id)
     $this->assertFalse(message::delete_message("dddd"), "[delete_message()]");
     $this->assertTrue(message::delete_message($messages[0]['id']), "[delete_message()]");
     $this->assertEquals(1, count(message::get_all_messages_after_given_date($messages[0]['gameID'], $messages[0]['date'] - 0.1)), "get_all_messages_after_given_date()");
     //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 }
开发者ID:uunuu,项目名称:dot_boxes,代码行数:58,代码来源:table_messageTest.php

示例10: hangman

 /**
  * Purpose: default constructor
  * Preconditions: none
  * Postconditions: parent object started
  **/
 function hangman()
 {
     /**
      * instantiate the parent game class so this class
      * inherits all of the game class's attributes 
      * and methods
      **/
     game::start();
 }
开发者ID:MetalMor,项目名称:ExM7UF1,代码行数:14,代码来源:class.hangman.php

示例11: action_bestranker

 /**
  * Hent beste ranker siste 24 timer
  */
 public function action_bestranker()
 {
     $stats = new \Kofradia\Users\Stats();
     $players = $stats->getBestRankers();
     if (count($players) == 0) {
         return \Kofradia\View::forgeTwig('users/login/helpers/best_ranker', array("player" => null));
     }
     $player = reset($players);
     return \Kofradia\View::forgeTwig('users/login/helpers/best_ranker', array("player" => $player, "img" => \player::get_profile_image_static($player['up_profile_image_url']), "rank" => new \Kofradia\Game\Player\Rank($player['up_points'], $player['upr_rank_pos'], $player['up_access_level']), "profile_link" => \game::profile_link($player['up_id'], $player['up_name'], $player['up_access_level'])));
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:13,代码来源:Helpers.php

示例12: reload

 /**
  * Load settings and save to cache
  */
 public static function reload()
 {
     $result = \Kofradia\DB::get()->query("SELECT id, name, value FROM settings");
     \game::$settings = array();
     while ($row = $result->fetch()) {
         \game::$settings[$row['name']] = array("id" => $row['id'], "value" => $row['value']);
     }
     // keep for 1 hour
     \cache::store("settings", \game::$settings, 3600);
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:13,代码来源:Settings.php

示例13: counterFilter

 public function counterFilter($time, $redirect_to)
 {
     $rel = (string) $time;
     if ($redirect_to) {
         if ($redirect_to === true) {
             $rel .= ",refresh";
         } else {
             $rel .= "," . htmlspecialchars($redirect_to);
         }
     }
     return '<span class="counter" rel="' . $rel . '">' . \game::timespan($time, \game::TIME_FULL, 5) . '</span>';
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:12,代码来源:Counter.php

示例14: add_new_move

 public static function add_new_move($game_id, $x, $y, $edgePosition, $player_id)
 {
     $date = microtime(true);
     //TEST:
     //game_id is valid
     //player_id is valid
     //consistent $x and $y coordinates with the game size
     //valid edgePosition (it has to be one of the values: 1 (NORTH), 2 (SOUTH), 3 (EAST) , 4 (WEST) )
     //secure the input
     if (safe_input::is_number($game_id) && safe_input::is_number($x) && safe_input::is_number($y) && safe_input::is_number($edgePosition) && safe_input::is_number($player_id)) {
         //validate game_id
         $game_info = game::getGameById($game_id);
         if ($game_info == false) {
             return false;
             //no game exists with the given id
         }
         $other_player_id = -1;
         //check if player_id is a player in the game
         if ($player_id == $game_info['player1ID']) {
             $other_player_id = $game_info['player2ID'];
         } elseif ($player_id == $game_info['player2ID']) {
             $other_player_id = $game_info['player1ID'];
         } else {
             return false;
             //ERROR!! (player tring to play is not part of the game
         }
         //check if it is the player's turn
         if ($player_id != $game_info['currentTurnPlayerID']) {
             return false;
             //it is not the player's turn!
         }
         //check coordinates consistency
         if ($x > $game_info['size'] || $y > $game_info['size'] || $x < 1 || $y < 1) {
             return false;
             //invalid move coordinates
         }
         //check edigePosition
         if ($edgePosition != 1 && $edgePosition != 2 && $edgePosition != 3 && $edgePosition != 4) {
             return false;
             //invalid edgePosition value!
         }
         //add the move
         $db = new database();
         $query[] = "INSERT INTO `move` (`gameID`, `date`, `x`, `y`, `edgePosition`, `playerID`) VALUES ( '{$game_id}', '{$date}', '{$x}', '{$y}', '{$edgePosition}' , '{$player_id}');";
         $query[] = "UPDATE  `game` SET  `currentTurnPlayerID` =  '{$other_player_id}' , `lastActivityDate` = '{$date}' WHERE  `id` = '{$game_id}'";
         $res = $db->execute_transaction($query);
         return $res;
     } else {
         return false;
         //ERROR!!!! (invalid input!!)
     }
 }
开发者ID:uunuu,项目名称:dot_boxes,代码行数:52,代码来源:table_move.php

示例15: show_link

 function show_link()
 {
     $ret = array();
     for ($i = 0; $i < func_num_args(); $i++) {
         $arg = func_get_arg($i);
         if (!$this->exists($arg)) {
             trigger_error("Fant ikke elementet med ID {$arg}!", E_USER_ERROR);
         }
         $type = $this->types[$this->elms[$arg]['type']];
         // aktiv?
         $active = $this->active == $arg ? 1 : 0;
         $ret[] = '<a href="' . htmlspecialchars(game::address($this->address, $_GET, array($this->sort_name), array($this->sort_name => $arg))) . '" class="op50"><img src="' . $type[$active] . '" alt="' . htmlspecialchars($this->elms[$arg]['title']) . '" /></a>';
         #if ($active == 1) return end($ret);
     }
     return implode("", $ret);
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:16,代码来源:class.sorts.php


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