コード例 #1
0
<?php

require_once '../../lib/inclusion.php';
require_once_model('BattleRound');
$battleRoundConn = new BattleRoundDAO();
$battleId = $_POST["battleId"];
$roundId = $_POST["roundId"];
$battleRoundArr = $battleRoundConn->getBattleRound($battleId, $roundId);
$attackLog = explode("^_^", $battleRoundArr[3]);
$defendLog = explode("^_^", $battleRoundArr[4]);
?>

<span class="title">Defensor</span>
    <hr />
    <div id="defendLog" class="log">
<?php 
foreach ($defendLog as $attackMsg) {
    echo "<p>" . $attackMsg . "</p>";
}
?>
    </div>
    <span class="title">Atacante</span>
    <hr />
    <div id="attackLog" class="log" >
<?php 
foreach ($attackLog as $attackMsg) {
    echo "<p>" . $attackMsg . "</p>";
}
?>
    </div>
コード例 #2
0
<?php

require_once '../../lib/inclusion.php';
require_once '../../config/paths.php';
require_once '../../config/battle.cfg.php';
require_once_model('StaticData');
require_once_model('Division');
require_once_model('Unit');
require_once_model('Sector');
require_once_model('Battle');
require_once_model('BattleRound');
require_once_model('Player');
session_start();
$battleConn = new BattleDAO();
$battleRoundConn = new BattleRoundDAO();
$divisionConn = new DivisionDAO();
$player = $_SESSION['player'];
$staticData = $_SESSION['staticData'];
$allUnits = $staticData->getUnits();
$allPlayers = $staticData->getPlayers();
$allSectors = $staticData->getSectors();
$coordinateX = $_POST['coordinateX'];
$coordinateY = $_POST['coordinateY'];
if (isset($_POST['noView'])) {
    $noView = $_POST['noView'];
} else {
    $noView = false;
}
$sector = $allSectors[$coordinateX . "," . $coordinateY];
$battleArr = $battleConn->getBattleBySectorId($sector->getId());
$battle = new Battle($battleArr[0], 0, 0, $battleArr[2], $battleArr[3], $battleArr[4], $battleArr[5]);