public function getWinner(\model\Player $winner) { if ($winner->getName() != "Computer") { $this->winner = "<p>Congratulations " . $winner->getName() . "! You won this round.</p>"; } else { if ($winner->getName() === "Computer") { $this->winner = "<p>Sorry, the " . $winner->getName() . " won this round.</p>"; } else { $this->winner = null; } } }
public function getTableInfo($player) { $info = array(); $info['tid'] = $this->tableId; $info['baseSc'] = Constants::BASE_SOCRE; $info['tableSt'] = $this->tableStatus; $info['multiple'] = $this->multiple; $info['lUid'] = $this->landlordUid; $info['currOpUid'] = $this->currOpUid; $info['lastOpUid'] = $this->lastOpUid; $info['lastCardNos'] = $this->lastCardNos; $info['playerSt'] = $this->playerStatus; $info['selfCardNos'] = array_values($this->playerCards[$player->uid]); $info['threeCards'] = $this->threeCards; $info['uids'] = $this->uids; $info['rTime'] = $this->recordTime; $cardNums = array(); foreach ($this->uids as $_uid) { if (!GameDao::isInGame($_uid)) { //牌局建立失败 return false; } if ($player->uid != $_uid) { $cardNums[$_uid] = count($this->playerCards[$_uid]); } } $info['cardNums'] = $cardNums; $playerInfos = Player::getPlayerInfos($this->uids, $player); if (!$playerInfos) { return false; } $info['playerInfos'] = $playerInfos; return $info; }