forked from devsam/core
이동 초기 구현
This commit is contained in:
+4
-2
@@ -85,8 +85,9 @@ function closeButton() {
|
||||
}
|
||||
|
||||
|
||||
function printCitiesBasedOnDistance(int $cityNo, int $maxDistance=1) {
|
||||
function printCitiesBasedOnDistance(int $cityNo, int $maxDistance=1):string {
|
||||
$distanceList = searchDistance($cityNo, $maxDistance, true);
|
||||
$result = [];
|
||||
|
||||
for($dist = 1; $dist <= $maxDistance; $dist++){
|
||||
$cityList = array_map(function($cityID){
|
||||
@@ -101,8 +102,9 @@ function printCitiesBasedOnDistance(int $cityNo, int $maxDistance=1) {
|
||||
default: $color = "yellow"; break;
|
||||
}
|
||||
|
||||
echo "{$dist}칸 떨어진 도시 : <span style='color:{$color};font-weight:bold;'>{$cityStr}</span><br>";
|
||||
$result[] = "{$dist}칸 떨어진 도시 : <span style='color:{$color};font-weight:bold;'>{$cityStr}</span>";
|
||||
}
|
||||
return join("<br>\n", $result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
$(function(){
|
||||
var $target = $("#destNationID");
|
||||
reloadWorldMap({
|
||||
isDetailMap:false,
|
||||
clickableAll:true,
|
||||
neutralView:true,
|
||||
useCachedMap:true,
|
||||
selectCallback:function(city){
|
||||
$target.val(city.nationId);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
+7
-1
@@ -6,7 +6,7 @@ include "func.php";
|
||||
//로그인 검사
|
||||
|
||||
$commandType = Util::getReq('commandtype', 'string');
|
||||
$turn = Util::getReq('turn', 'array_int');
|
||||
$turnList = Util::getReq('turn', 'array_int');
|
||||
|
||||
if(!$turn || $commandtype === null){
|
||||
header('location:index.php', true, 303);
|
||||
@@ -77,7 +77,13 @@ foreach($cssList as $css){
|
||||
</td></tr></table>
|
||||
|
||||
<div class="tb_layout bg0" style="width:100px;margin:auto;">
|
||||
<form method='post' id='submitForm'>
|
||||
<input type='hidden' name='command' value='<?=$commandType?>'>
|
||||
<?php foreach($turnList as $turnIdx): ?>
|
||||
<input type=hidden name='turn[]' value=<?=$turnIdx?>>
|
||||
<?php endforeach; ?>
|
||||
<?=$commandObj->getForm()?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<table class="tb_layout bg0" style="width:1000px;margin:auto;">
|
||||
|
||||
@@ -133,5 +133,29 @@ class che_이동 extends Command\GeneralCommand{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function getJSFiles(): array
|
||||
{
|
||||
return [
|
||||
'js/defaultSelectCityByMap.js'
|
||||
];
|
||||
}
|
||||
|
||||
public function getForm(): string
|
||||
{
|
||||
$form = [];
|
||||
$form[] = \sammo\getMapHtml();
|
||||
|
||||
$form[] = <<<EOT
|
||||
선택된 도시로 이동합니다.<br>
|
||||
인접 도시로만 이동이 가능합니다.<br>
|
||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
||||
<select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
||||
EOT;
|
||||
$form[] = \sammo\optionsForCities();
|
||||
$form[] = '</select>';
|
||||
$form[] = '<input type=submit value="이동">';
|
||||
$form[] = printCitiesBasedOnDistance($this->generalObj->getCityID(), 1);
|
||||
|
||||
return join("\n",$form);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user