コード例 #1
0
 /**
  * @return array
  */
 public function toArray()
 {
     return ['seatIndex' => $this->player->getSeat()->getSeatIndex(), 'hands' => $this->player->getSeat()->getHands()->map(function (HandBetPair $hand) {
         return ['hand' => ['value' => $hand->getHand()->getValue(), 'cards' => $hand->getHand()->getCards()->map(function (Card $card) {
             return ['rank' => $card->getRank(), 'suit' => $card->getSuit()];
         })->elements()], 'bet' => $hand->getBet()];
     })->elements()];
 }
コード例 #2
0
 public function toArray()
 {
     return ['seatIndex' => $this->player->getSeat()->getSeatIndex(), 'name' => $this->player->getName()];
 }
コード例 #3
0
 public function kickPlayer(Player $player, $reason)
 {
     if ($player instanceof ServerPlayer) {
         $this->removePlayerFromSeat($player->getSeat());
     } elseif ($player instanceof SocketPlayer) {
         $this->enqueueMessage($player, new KickedMessage($reason))->always(function () use($player) {
             $player->getConnection()->getSocket()->close();
         });
     }
 }
コード例 #4
0
ファイル: Table.php プロジェクト: proof/blackjack-php-server
 public function ensurePlayerActive(Player $player, $value = null)
 {
     if ($player->getSeat() === null || $player->getTable() !== $this) {
         return \React\Promise\reject(new \RuntimeException('Player left table'));
     }
     return \React\Promise\resolve($value);
 }
コード例 #5
0
 /**
  * @return array
  */
 public function toArray()
 {
     return ['seatIndex' => $this->player->getSeat()->getSeatIndex(), 'handIndex' => $this->findHandIndex(), 'card' => $this->serializeCard()];
 }
コード例 #6
0
 /**
  * @return array
  */
 public function toArray()
 {
     return ['seatIndex' => $this->player->getSeat()->getSeatIndex(), 'handIndex' => $this->findHandIndex(), 'result' => $this->getResult()];
 }
コード例 #7
0
 /**
  * @return array
  */
 public function toArray()
 {
     return ['seatIndex' => $this->player->getSeat()->getSeatIndex(), 'betAmount' => $this->betAmount, 'money' => $this->player->getChips()->getAmount()];
 }