本文整理汇总了PHP中Card类的典型用法代码示例。如果您正苦于以下问题:PHP Card类的具体用法?PHP Card怎么用?PHP Card使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Card类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: checkTemposCard
public function checkTemposCard(Card $card)
{
$tcard = $this->getTemposCard();
if (!is_null($tcard)) {
return $tcard->getId() == $card->getId();
}
}
开发者ID:jfesquet,项目名称:tempos,代码行数:7,代码来源:myUser.class.php
示例2: testCard
public function testCard()
{
$Card = new Card(0, '♦');
$cardstring = $Card->getCardEvalString();
$this->assertEquals('Ad', $cardstring);
$value = $Card->getValue();
$isRoyal = $Card->isRoyal();
$label = $Card->getCardPrintLabel();
$this->assertEquals(14, $value);
$this->assertTrue(!$isRoyal);
$this->assertEquals('A♦', $label);
$Card = new Card(10, '♣');
$label = $Card->getCardPrintLabel();
$isRoyal = $Card->isRoyal();
$cardstring = $Card->getCardEvalString();
$this->assertEquals('Jc', $cardstring);
$this->assertTrue($isRoyal);
$this->assertEquals('J♣', $label);
$Card = new Card(9, '♥');
$label = $Card->getCardPrintLabel();
$isRoyal = $Card->isRoyal();
$cardstring = $Card->getCardEvalString();
$this->assertEquals('Th', $cardstring);
$this->assertTrue(!$isRoyal);
$this->assertEquals('10♥', $label);
$Card = new Card(8, '♠');
$label = $Card->getCardPrintLabel();
$isRoyal = $Card->isRoyal();
$cardstring = $Card->getCardEvalString();
$this->assertEquals('9s', $cardstring);
$this->assertTrue(!$isRoyal);
$this->assertEquals('9♠', $label);
}
开发者ID:dfredriksen,项目名称:ZeetoChallenge,代码行数:33,代码来源:CardTest.php
示例3: delete_card
public function delete_card($card_id = 0)
{
$card = new Card($card_id);
$deck_id = $card->deck_id;
$card->delete();
/*
$ref = $_SERVER['HTTP_REFERER'];
redirect($ref);
*/
redirect('/admin/cards/list_cards/' . $deck_id);
}
开发者ID:MaxMillion,项目名称:CardsAgainstHumanityRemix,代码行数:11,代码来源:cards.php
示例4: addCard
/**
* Add a card to the deck
* If the card already exists, increase the count
*
* @param Card $card
*
* @return self
*/
public function addCard(Card $card)
{
$hash = $card->getHash();
if (array_key_exists($hash, $this->cards)) {
$this->cards[$hash]['count']++;
} else {
$this->cards[$hash] = ['count' => 1, 'details' => $card];
}
$this->sortCards();
return $this;
}
开发者ID:TiDJ,项目名称:deck,代码行数:19,代码来源:Deck.php
示例5: addCard
public function addCard()
{
try {
$db = new DB();
$card = new Card($_POST["name"], $_POST["description"], $_GET["list"]);
$sql = "INSERT INTO card(name,description,list_id) VALUES (:name,:description,:list_id)";
$q = $db->getConnection()->prepare($sql);
$q->execute(array(':name' => $card->getName(), ':description' => $card->getDescription(), ':list_id' => $card->getListId()));
} catch (PDOException $e) {
echo $e->getMessage();
}
}
开发者ID:Skaelv,项目名称:tcd-WT-trello-clone,代码行数:12,代码来源:BoardCtrl.php
示例6: carte_et_scoreOracle
private function carte_et_scoreOracle()
{
include './sys/load_iso.php';
require_once './controllers/update_score_coeff.php';
if (!isset($_SESSION["timeOutOracle"])) {
// récupération d'enregistrementID pour récupérer l'id de l'Oracle et l'id de la carte
//connexion à la BD
$db = db::getInstance();
//Récupération de enregistrementID
$sql = 'SELECT enregistrementID FROM parties WHERE idDevin="' . $this->diviner . '" ORDER BY tpsDevin DESC LIMIT 1 ';
$res1 = $db->query($sql);
$this->res2 = mysqli_fetch_assoc($res1);
// récupération de l'id de l'oracle et de la carte grâce à enregistrementID
$sql = 'SELECT idOracle,carteID,OracleLang
FROM enregistrement WHERE enregistrementID=' . $this->res2['enregistrementID'] . '';
$res1 = $db->query($sql);
$res3 = mysqli_fetch_assoc($res1);
$this->oracle = $res3['idOracle'];
// récupération du contenu de la carte avec carteID
$carte = new Card($res3['carteID']);
$this->res = $carte->dirtify();
// Requête de modification des scores de l'Oracle qui a fait une description non trouvée par le devin
updateScoreOracleDevinEchec($this->oracle, $iso[$res3["OracleLang"]], $this->res2['enregistrementID']);
//~ //récupération du score précédent;
//~ $sql = 'SELECT `scoreGlobal`,`scoreOracle` FROM `score` WHERE `userid`="'.$this->oracle.'" AND langue="'.$iso[$res3["OracleLang"]].'"';
//~ $result=$db->query($sql);
//~ $res5= mysqli_fetch_assoc($result);
//~ $this->previousSGO= $res5['scoreGlobal'];
//~ $this->previousSO= $res5['scoreOracle'];
//~
//~ //maj des variables de scores: le score ne doit jamais être négatif.
//~ $points = $this->points*0.5;
//~ $_SESSION["pointsCoef"] = $points;
//~
//~ if($this->previousSO >= $points)
//~ {
//~ $this->previousSGO = $this->previousSGO - $points;
//~ $this->previousSO = $this->previousSO - $points;
//~ }
//~ //maj du score dans la BD
//~ $sql = 'UPDATE score
//~ SET scoreGlobal='.$db->escape((string) $this->previousSGO) . ', ' .
//~ 'scoreOracle='.$db->escape((string) $this->previousSO) . '
//~ WHERE userid='.$this->oracle.' AND langue="'.$iso[$res3["OracleLang"]].'"';
//~
//~ $db->query($sql);
$_SESSION["timeOutOracle"] = true;
return false;
} else {
header('Location: index.php?page.home.html');
return false;
}
}
开发者ID:benabri,项目名称:GameOfWord,代码行数:53,代码来源:diviner.timeout.class.php
示例7: generate
public function generate()
{
$serial = new Serial();
$serial->serial = $this->serial;
$serial->duration = $this->duration;
$serial->save();
for ($number = 1; $number <= $this->quantity; $number++) {
$card = new Card();
$card->serial_id = $serial->id;
$card->number = $number;
$card->save();
}
}
开发者ID:sedpro,项目名称:test_starcode,代码行数:13,代码来源:GeneratorForm.php
示例8: updateCard
public function updateCard(Card $card)
{
$inputs = ['color' => Input::get('color'), 'content' => Input::get('content'), 'comment' => Input::get('comment'), 'worker_id' => Input::get('worker_id')];
$valid = Validator::make($inputs, Card::$rules);
if ($valid->passes()) {
$card->color = $inputs['color'];
$card->content = $inputs['content'];
$card->comment = $inputs['comment'];
$card->worker_id = $inputs['worker_id'];
$card->save();
return Redirect::route('card.list')->with('success', Lang::choice('messages.Cards', 1) . ' ' . trans('is updated'));
} else {
return Redirect::back()->withErrors($valid)->withInput();
}
}
开发者ID:rituzy,项目名称:iblog,代码行数:15,代码来源:CardController.php
示例9: run
public function run()
{
DB::table('sides')->delete();
DB::table('cards')->delete();
$cid = Card::create(array())['id'];
echo $cid;
Side::create(array('card_id' => $cid, 'descriptor' => 'front', 'text' => 'front'));
Side::create(array('card_id' => $cid, 'descriptor' => 'back', 'text' => 'back'));
/*
Card::create(array('front' => 'hello',
'back' => 'back of card',
'count' => 10));
Card::create(array('front' => 'hello',
'back' => 'konnichiha',
'count' => 10));
*/
/*
for ($i=0; $i<1000; $i++) {
Card::create(array('front' => 'hello',
'back' => 'konnichiha',
'count' => 10));
}
*/
/*
*/
}
开发者ID:russjohnson09,项目名称:russgvsu-php,代码行数:27,代码来源:CardTableSeeder.php
示例10: __construct
public function __construct($deck = null)
{
if (is_string($deck)) {
$reg_comment = '/^\\s*\\/\\/(.*)/';
$reg_empty = "/^\\s*\n\$/";
$reg_side = '/^SB:(.*)$/';
$reg_card_mwd = '/(\\d+)\\s*\\[(.*)\\]\\s*(.+)$/';
$reg_card_apr = '/(\\d+)\\s*(.+)$/';
$lines = explode("\n", $deck);
// Cut file content in lines
$notfound = 0;
foreach ($lines as $value) {
// Parse lines one by one
// Not a card line
if (preg_match($reg_comment, $value, $matches)) {
// Comment line
continue;
}
if (preg_match($reg_empty, $value, $matches)) {
// Empty line
continue;
}
// Sideboard
if ($side = preg_match($reg_side, $value, $matches)) {
$value = $matches[1];
}
// Search
$card = null;
if (preg_match($reg_card_mwd, $value, $matches)) {
// MWS
list($line, $nb, $ext, $name) = $matches;
$card = Card::get(trim($name), $ext);
} else {
if (preg_match($reg_card_apr, $value, $matches)) {
// Aprentice
list($line, $nb, $name) = $matches;
$card = Card::get(trim($name));
}
}
// (not) Found
if ($card == null) {
if (++$notfound > 3) {
echo "Too many cards not found, deck parsing canceled\n";
return false;
}
} else {
if ($notfound > 0) {
$notfound--;
}
for ($i = 0; $i < $nb; $i++) {
if ($side) {
$this->side[] = $card;
} else {
$this->main[] = $card;
}
}
}
}
}
}
开发者ID:OlivierLamiraux,项目名称:mtgas,代码行数:60,代码来源:deck.php
示例11: __construct
public function __construct()
{
foreach (Card::getSuits() as $suit) {
foreach (Card::getValues() as $value) {
$this->cards[] = new Card($suit, $value);
}
}
}
开发者ID:hkxnyc,项目名称:php_poker,代码行数:8,代码来源:Deck.php
示例12: community_cards
public function community_cards($game = NULL)
{
if (is_a($game, 'Game')) {
return $game->render_community_cards();
} else {
return Card::render_card_space() . Card::render_card_space() . Card::render_card_space() . Card::render_card_space() . Card::render_card_space();
}
}
开发者ID:shinichi81,项目名称:laravel-pkr,代码行数:8,代码来源:render.php
示例13: setCardsAttribute
public function setCardsAttribute($cards)
{
if (count($cards) > 0) {
foreach ($cards as $card) {
Card::create((array) $card);
}
}
}
开发者ID:NukaCode,项目名称:Magic,代码行数:8,代码来源:Series.php
示例14: get_content
public function get_content($content)
{
global $db_cards;
$this->fullcontent = array();
foreach ($content as $card) {
$this->fullcontent[] = Card::get($card->name, $card->ext, property_exists($card, 'nb') ? $card->nb : 0);
}
$this->summarize();
}
开发者ID:OlivierLamiraux,项目名称:mtgas,代码行数:9,代码来源:ws_booster.php
示例15: render
public function render () {
global $config;
echo $this->card . '...';
$card = $this->card;
$settings = $this->getSettings();
$costColors = Card::getCostColors($card->cost);
$white = '255,255,255';
$canvas = imagecreatetruecolor(1050, 736);
// Art image.
$this->drawArt($canvas, $card->artFileName, $settings['art.top'], $settings['art.left'], $settings['art.bottom'], $settings['art.right'], !$config['art.keep.aspect.ratio']);
echo '.';
// Background image.
$bgImage = @imagecreatefrompng('images/plane/plane.png');
imagecopy($canvas, $bgImage, 0, 0, 0, 0, 1050, 736);
echo '.';
// Set and rarity.
$rarityLeft = $this->drawRarity($canvas, $card->rarity, $card->set, $settings['rarity.right'], $settings['rarity.center.y'], $settings['rarity.height'], $settings['rarity.width'], false);
// Card title.
$this->drawText($canvas, $settings['title.x'], $settings['title.y'], null, $card->getDisplayTitle(), $this->font('title'));
echo '.';
// Type.
$this->drawText($canvas, $settings['type.x'], $settings['type.y'], null, $card->type, $this->font('type'));
//Chaos Symbol
$this->drawSymbol($canvas, 632, 115, 50, 'C', null);
// Legal text.
if (!preg_match('/(.*\n)(.*?)$/s', $card->legal, $matches)) error('Missing chaos ability from legal text: ' . $card->title);
$this->drawLegalAndFlavorText($canvas, $settings['text.top'], $settings['text.left'], $settings['text.bottom'], $settings['text.right'], $matches[1], null, $this->font('text'), 0);
$this->drawLegalAndFlavorText($canvas, $settings['chaos.top'], $settings['chaos.left'], $settings['chaos.bottom'], $settings['chaos.right'], $matches[2], null, $this->font('text'), 0);
// Artist and copyright.
// The artist color is white if the frame behind it is black.
$footerColor = '255,255,255';
if ($card->artist) {
if ($settings['card.artist.gears']) {
$artistSymbol = '{gear}';
} else {
$artistSymbol = '{brush}';
}
$this->drawText($canvas, $settings['artist.x'], $settings['artist.y'], null, $artistSymbol . $card->artist, $this->font('artist', 'color:' . $footerColor));
}
if ($card->copyright) $this->drawText($canvas, $settings['copyright.x'], $settings['copyright.y'], null, $card->copyright, $this->font('copyright', 'color:' . $footerColor));
echo "\n";
return $canvas;
}
开发者ID:GarikRC,项目名称:arcane,代码行数:57,代码来源:PlaneRenderer.php
示例16: __construct
function __construct()
{
parent::__construct();
foreach (Card::get_ranks() as $rank) {
foreach (Card::get_suits() as $suit) {
$this->add(new Card($rank, $suit));
}
}
}
开发者ID:shinichi81,项目名称:laravel-pkr,代码行数:9,代码来源:deck.php
示例17: GetEntries
private function GetEntries()
{
require_once "Records/card.php";
require_once "Records/entry.php";
$s = Card::GetAllCardsQuery()
->join(array("e" => Entry::$TABLE), "e.card = ca.id", array())
->where("e.cube = ?", $this->id);
$r = DB::zdb()->fetchAll($s);
$this->cards = array();
foreach ( $r as $rr )
$this->cards[] = new Card($rr);
}
开发者ID:ryanknu,项目名称:Cuber,代码行数:12,代码来源:cube.php
示例18: render_cards
public function render_cards($game_id, $face_down = false)
{
if ($face_down) {
$count = $this->cards[$game_id]->count();
if ($count == 2) {
return Card::render_card_back() . Card::render_card_back();
} elseif ($count == 1) {
return Card::render_card_back() . Card::render_card_space();
} else {
return Card::render_card_space() . Card::render_card_space();
}
} else {
return $this->cards[$game_id]->render(2);
}
}
开发者ID:shinichi81,项目名称:laravel-pkr,代码行数:15,代码来源:player.php
示例19: actionCreate
public function actionCreate()
{
$model = new ConsumerLog();
$model->unsetAttributes();
if ($_POST['ConsumerLog']) {
$model->attributes = $_POST['ConsumerLog'];
if ($model->validate()) {
$model->setAttribute('fee', $model->price / $model->total);
if ($model->save() && Card::model()->updateByPk($model->card_id, ['used_num' => $model->used + 1])) {
Yii::app()->user->setFlash('ConsumerLog', '提交成功');
}
}
}
$stores = Store::model()->getName();
$this->render('create', ['model' => $model, 'stores' => $stores]);
}
开发者ID:kl0428,项目名称:admin,代码行数:16,代码来源:ConsumerLogController.php
示例20: cardInfo
public function cardInfo($params = array())
{
extract($params);
if (isset($type_id)) {
$num = isset($num) && $num > 0 ? $num : 1;
$result = Card::model()->getCards($type_id, $num);
if ($result) {
$ret = $this->notice('OK', 0, '成功', $result);
} else {
$ret = $this->notice('OK', 0, '成功', []);
}
} else {
$ret = $this->notice('ERR', 301, '缺少参数', []);
}
return $ret;
}
开发者ID:kl0428,项目名称:urtime,代码行数:16,代码来源:CardService.php
注:本文中的Card类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论