本文整理汇总了PHP中Match::enterMatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::enterMatch方法的具体用法?PHP Match::enterMatch怎么用?PHP Match::enterMatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::enterMatch方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enter
/**
* {@inheritdoc}
*/
public function enter($form)
{
$firstTeam = $form->get('first_team');
$secondTeam = $form->get('second_team');
$serverInfo = $this->getServerInfo($form->get('server_address'));
$match = \Match::enterMatch($firstTeam->get('team')->getData()->getId(), $secondTeam->get('team')->getData()->getId(), $firstTeam->get('score')->getData(), $secondTeam->get('score')->getData(), $form->get('duration')->getData(), $this->me->getId(), $form->get('time')->getData(), $this->getPlayerList($firstTeam), $this->getPlayerList($secondTeam), $serverInfo[0], $serverInfo[1], null, $form->get('map')->getData()->getId());
return $match;
}
示例2: enter
/**
* {@inheritdoc}
*/
public function enter($form)
{
$firstTeam = $form->get('first_team');
$secondTeam = $form->get('second_team');
$firstId = $firstTeam->get('team')->getData()->getId();
$secondId = $secondTeam->get('team')->getData()->getId();
$official = $form->get('type')->getData() === \Match::OFFICIAL;
$match = \Match::enterMatch($official ? $firstId : null, $official ? $secondId : null, $firstTeam->get('score')->getData(), $secondTeam->get('score')->getData(), $form->get('duration')->getData(), $this->me->getId(), $form->get('time')->getData(), $this->getPlayerList($firstTeam), $this->getPlayerList($secondTeam), $form->get('server_address')->getData(), null, $form->get('map')->getData()->getId(), $form->get('type')->getData(), $official ? null : $firstId, $official ? null : $secondId);
return $match;
}
示例3: enter
/**
* {@inheritDoc}
*/
public function enter($form)
{
$firstTeam = $form->get('first_team');
$secondTeam = $form->get('second_team');
$firstPlayers = array_map($this->getModelToID(), $firstTeam->get('participants')->getData());
$secondPlayers = array_map($this->getModelToID(), $secondTeam->get('participants')->getData());
$serverInfo = explode(':', $form->get('server_address')->getData());
if (!isset($serverInfo[1])) {
$serverInfo[1] = 5154;
}
$match = \Match::enterMatch($firstTeam->get('team')->getData()->getId(), $secondTeam->get('team')->getData()->getId(), $firstTeam->get('score')->getData(), $secondTeam->get('score')->getData(), $form->get('duration')->getData(), $this->me->getId(), $form->get('time')->getData(), $firstPlayers, $secondPlayers, $serverInfo[0], $serverInfo[1]);
return $match;
}
示例4:
has been providing inspiration and will be providing inspiration for years to come, sparking
interesting matches, clever matching techniques, and even spin-offs of a similar style.
However, match goers have remained attached to toast's simple yet powerful layout, taking
advantage of all the improbable possibilities, bringing enjoyment to all kinds of BZFlag
players around the globe.
TOAST
);
echo "\nAdding matches...";
Match::enterMatch($reptitles->getId(), $gsepar->getId(), 1, 9000, 17, $kierra->getId(), "now", [], [], null, null, null, $six->getId());
Match::enterMatch($olfm->getId(), $lweak->getId(), 0, 0, 20, $blast->getId(), "now", [], [], null, null, null, $toast->getId());
Match::enterMatch($fflood->getId(), $lweak->getId(), 1, 15, 20, $autoreport->getId(), "now", [], [], null, null, null, $six->getId());
Match::enterMatch($gsepar->getId(), $fradis->getId(), 8, 23, 30, $kierra->getId(), "now", [], [], null, null, null, $toast->getId());
Match::enterMatch($olfm->getId(), $lweak->getId(), 5, 4, 20, $kierra->getId());
Match::enterMatch($reptitles->getId(), $gsepar->getId(), 1, 1500, 20, $autoreport->getId(), "now", [], [], null, null, null, $monocati->getId());
Match::enterMatch($olfm->getId(), $lweak->getId(), 1, 1, 30, $autoreport->getId(), "now", [], [], null, null, null, $monocati->getId());
Match::enterMatch($fradis->getId(), $gsepar->getId(), 1, 2, 20, $kierra->getId(), "now", [], [], null, null, null, $monocati->getId());
echo " done!";
echo "\nUpdating teams...";
$reptitles->update("activity", 9000);
$fflood->update("activity", -18);
$fradis->update("activity", 3.141592653589793);
echo " done!";
echo "\nAdding servers...";
Server::addServer("Wingfights Fountains", "helit.tech", 5154, 151, $alezakos->getId());
Server::addServer("BZPro Public HiX Rabbit Chase", "bzpro.net", 5155, 227, $tw1sted->getId());
echo " done!";
echo "\nAdding messages...";
$conversation = Conversation::createConversation("New blog", $snake->getId(), $allPlayers);
for ($i = 0; $i <= 10; ++$i) {
Conversation::createConversation("Extra test {$i}", $alezakos->getId(), $allPlayers)->sendMessage($allejo, "This is a test conversation");
}
示例5: matchReportAction
public function matchReportAction(Logger $log, Request $request)
{
$log->addNotice("Match data received from " . $request->getClientIp());
$teamOneBZIDs = $this->params->get('teamOnePlayers');
$teamTwoBZIDs = $this->params->get('teamTwoPlayers');
$teamOnePlayers = $this->bzidsToIdArray($teamOneBZIDs);
$teamTwoPlayers = $this->bzidsToIdArray($teamTwoBZIDs);
$teamOne = $this->getTeam($teamOnePlayers);
$teamTwo = $this->getTeam($teamTwoPlayers);
// If we fail to get the the team ID for either the teams or both reported teams are the same team, we cannot
// report the match due to it being illegal.
// An invalid team could be found in either or both teams, so we need to check both teams and log the match
// failure respectively.
$error = true;
if (!$teamOne->isValid()) {
$log->addNotice("The BZIDs ({$teamOneBZIDs}) were not found on the same team. Match invalidated.");
} elseif (!$teamTwo->isValid()) {
$log->addNotice("The BZIDs ({$teamTwoBZIDs}) were not found on the same team. Match invalidated.");
} else {
$error = false;
}
if ($error) {
throw new ForbiddenException("An invalid player was found during the match. Please message a referee to manually report the match.");
}
if ($teamOne->getId() == $teamTwo->getId()) {
$log->addNotice("The '" . $teamOne->getName() . "' team played against each other in an official match. Match invalidated.");
throw new ForbiddenException("Holy sanity check, Batman! The same team can't play against each other in an official match.");
}
$match = Match::enterMatch($teamOne->getId(), $teamTwo->getId(), $this->params->get('teamOneWins'), $this->params->get('teamTwoWins'), $this->params->get('duration'), null, $this->params->get('matchTime'), $teamOnePlayers, $teamTwoPlayers, $this->params->get('server'), $this->params->get('port'), $this->params->get('replayFile'), $this->params->get('mapPlayed'));
$log->addNotice("Match reported automatically", array('winner' => array('name' => $match->getWinner()->getName(), 'score' => $match->getScore($match->getWinner())), 'loser' => array('name' => $match->getLoser()->getName(), 'score' => $match->getScore($match->getLoser())), 'eloDiff' => $match->getEloDiff()));
// Output the match stats that will be sent back to BZFS
return $match->getName();
}
示例6: testMiscMethods
public function testMiscMethods()
{
$old_matches = Match::getMatches();
$this->match = Match::enterMatch($this->team_a->getId(), $this->team_b->getId(), 5, 2, 30, $this->player_a->getId());
$this->match_b = Match::enterMatch($this->team_a->getId(), $this->team_b->getId(), 5, 2, 20, $this->player_b->getId());
$this->assertEquals("now", $this->match->getTimestamp()->diffForHumans());
$this->assertEquals($this->player_a->getId(), $this->match->getEnteredBy()->getId());
$this->assertEquals(5, $this->match->getScore($this->team_a->getId()));
$this->assertEquals(2, $this->match->getOpponentScore($this->team_a->getId()));
$this->assertEquals($this->team_a->getId(), $this->match->getOpponent($this->team_b->getId())->getId());
$matches = Match::getMatches();
$this->assertArrayContainsModel($this->match, $matches);
$this->assertArrayContainsModel($this->match_b, $matches);
$this->assertEquals(2, count($matches) - count($old_matches));
}
示例7: playsAMatchAgainstWithScore
/**
* @Given :team1 plays a match against :team2 with score :score1 - :score2
*/
public function playsAMatchAgainstWithScore($team1, $team2, $score1, $score2)
{
Match::enterMatch(Team::getFromName($team1)->getId(), Team::getFromName($team2)->getId(), $score1, $score2, 30, $this->getUserId());
}
示例8: array
echo " done!";
echo "\nAdding members to teams...";
$lweak->addMember($autoreport->getId());
$fflood->addMember($blast->getId());
$fradis->addMember($alezakos->getId());
$reptitles->addMember($brad->getId());
echo " done!";
echo "\nAdding matches...";
Match::enterMatch($reptitles->getId(), $gsepar->getId(), 1, 9000, 17, $kierra->getId());
Match::enterMatch($olfm->getId(), $lweak->getId(), 0, 0, 20, $blast->getId());
Match::enterMatch($fflood->getId(), $lweak->getId(), 1, 15, 20, $autoreport->getId());
Match::enterMatch($gsepar->getId(), $fradis->getId(), 8, 23, 30, $kierra->getId());
Match::enterMatch($olfm->getId(), $lweak->getId(), 5, 4, 20, $kierra->getId());
Match::enterMatch($reptitles->getId(), $gsepar->getId(), 1, 1500, 20, $autoreport->getId());
Match::enterMatch($olfm->getId(), $lweak->getId(), 1, 1, 30, $autoreport->getId());
Match::enterMatch($fradis->getId(), $gsepar->getId(), 1, 2, 20, $kierra->getId());
echo " done!";
echo "\nUpdating teams...";
$reptitles->update("activity", 9000, "i");
$fflood->update("activity", -18, "i");
$fradis->update("activity", 3.141592653589793, "d");
echo " done!";
echo "\nAdding servers...";
Server::addServer("BZPro Public HiX FFA", "bzpro.net:5154", 227, $tw1sted->getId());
Server::addServer("BZPro Public HiX Rabbit Chase", "bzpro.net:5155", 227, $tw1sted->getId());
echo " done!";
echo "\nAdding messages...";
$group_to = Group::createGroup("New blog", $snake->getId(), array($alezakos->getId(), $allejo->getId(), $ashvala->getId(), $autoreport->getId(), $blast->getId(), $kierra->getId(), $mdskpr->getId(), $snake->getId(), $tw1sted->getId()));
$event = new GroupRenameEvent($group_to, "New message", "New blorg", $snake);
GroupEvent::storeEvent($group_to->getId(), $event, Events::GROUP_RENAME);
$event = new GroupRenameEvent($group_to, "New blorg", "New blog", $snake);
示例9: testMatches
public function testMatches()
{
$this->team = Team::createTeam("Sample Team", $this->player->getId(), "Avatar", "Description");
$otherPlayer = $this->getNewPlayer();
$otherTeam = Team::createTeam("Sample Team 2", $otherPlayer->getId(), "Avatar", "Description");
$match_a = Match::enterMatch($this->team->getId(), $otherTeam->getId(), 5, 2, 30, $this->player->getId());
$match_b = Match::enterMatch($this->team->getId(), $otherTeam->getId(), 5, 2, 20, $this->player->getId());
$team = Team::get($this->team->getId());
$this->assertEquals(2, $team->getNumTotalMatches());
$this->assertArraysHaveEqualValues(array($match_a, $match_b), $team->getMatches());
$this->wipe($match_a, $match_b, $otherTeam, $otherPlayer);
}