버그 수정, 사령부 UI 복구
This commit is contained in:
+10
-9
@@ -103,18 +103,18 @@ $sel[$type] = "selected";
|
|||||||
대상장수 :
|
대상장수 :
|
||||||
<select name=gen size=1>
|
<select name=gen size=1>
|
||||||
<?php
|
<?php
|
||||||
|
$orderBy = '';
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
default:
|
default:
|
||||||
case 0: $query = "select no,name,npc from general where nation='{$me['nation']}' order by turntime desc"; break;
|
case 0: $orderBy = 'order by turntime desc'; break;
|
||||||
case 1: $query = "select no,name,npc from general where nation='{$me['nation']}' order by recwar desc"; break;
|
case 1: $orderBy = 'order by recwar desc'; break;
|
||||||
case 2: $query = "select no,name,npc from general where nation='{$me['nation']}' order by npc,binary(name)"; break;
|
case 2: $orderBy = 'order by npc,binary(name)'; break;
|
||||||
case 3: $query = "select no,name,npc from general where nation='{$me['nation']}' order by warnum desc"; break;
|
case 3: $orderBy = 'order by warnum desc'; break;
|
||||||
}
|
}
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
|
||||||
$gencount = MYDB_num_rows($result);
|
$generals = $db->query('SELECT no,name,npc FROM general WHERE nation = %i %l', $me['nation'], $orderBy);
|
||||||
$npc = 0;
|
$npc = 0;
|
||||||
for ($i=0; $i < $gencount; $i++) {
|
foreach($generals as $general){
|
||||||
$general = MYDB_fetch_array($result);
|
|
||||||
// 선택 없으면 맨 처음 장수
|
// 선택 없으면 맨 처음 장수
|
||||||
if ($gen == 0) {
|
if ($gen == 0) {
|
||||||
$gen = $general['no'];
|
$gen = $general['no'];
|
||||||
@@ -130,6 +130,7 @@ for ($i=0; $i < $gencount; $i++) {
|
|||||||
<option value={$general['no']}>{$general['name']}</option>";
|
<option value={$general['no']}>{$general['name']}</option>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$showGeneral = General::createGeneralObjFromDB($gen);
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<input type=submit name=btn value='조회하기'>
|
<input type=submit name=btn value='조회하기'>
|
||||||
@@ -143,7 +144,7 @@ for ($i=0; $i < $gencount; $i++) {
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td valign=top>
|
<td valign=top>
|
||||||
<?php generalInfo($gen); generalInfo2($gen); ?>
|
<?php generalInfo($showGeneral); generalInfo2($showGeneral); ?>
|
||||||
</td>
|
</td>
|
||||||
<td valign=top>
|
<td valign=top>
|
||||||
<?=getGeneralHistoryAll($gen)?>
|
<?=getGeneralHistoryAll($gen)?>
|
||||||
|
|||||||
+74
-66
@@ -17,7 +17,9 @@ $userID = Session::getUserID();
|
|||||||
<title><?=UniqueConst::$serverName?>: 사령부</title>
|
<title><?=UniqueConst::$serverName?>: 사령부</title>
|
||||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||||
|
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
|
||||||
<?=WebUtil::printJS('js/common.js')?>
|
<?=WebUtil::printJS('js/common.js')?>
|
||||||
|
<?=WebUtil::printJS('js/chiefCenter.js')?>
|
||||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||||
<?=WebUtil::printCSS('css/common.css')?>
|
<?=WebUtil::printCSS('css/common.css')?>
|
||||||
@@ -29,74 +31,80 @@ var maxChiefTurn = <?=GameConst::$maxChiefTurn?>;
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
<div id='container' class='tb_layout bg0' style='width:1000px;margin:auto;border:solid 1px #888888;'>
|
||||||
<tr><td>사 령 부<input id='refreshChiefTurn' type=button value='갱신'><br><?=backButton()?></td></tr>
|
<div class='tb_layout bg0'>사 령 부<button type='button' id='reloadTable'>갱신</button><br>
|
||||||
</table>
|
<?=backButton()?></div>
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
<div style='background-color:skyblue;text-align:center;'>수뇌부 일정</div>
|
||||||
<thead><tr><td colspan=10 align=center bgcolor=skyblue>수뇌부 일정</td></tr></thead>
|
<div class="chiefSubTable" style='height:<?=22*(GameConst::$maxChiefTurn+1)?>px;'
|
||||||
<tbody>
|
><div class='chiefTurnIdxPanel'
|
||||||
<tr>
|
><div class='bg1 chiefTurnIdx'>.</div
|
||||||
<td class='bg1 center'>.</td>
|
<?php foreach(range(1, 12) as $idx):?>
|
||||||
<td colspan=2 class='bg1 chiefNamePlate level12'>- :</td>
|
><div class='bg0 chiefTurnIdx'><?=$idx?></div
|
||||||
<td colspan=2 class='bg1 chiefNamePlate level10'>- :</td>
|
|
||||||
<td colspan=2 class='bg1 chiefNamePlate level8'>- :</td>
|
|
||||||
<td colspan=2 class='bg1 chiefNamePlate level6'>- :</td>
|
|
||||||
<td class='bg1 center'>.</td>
|
|
||||||
</tr>
|
|
||||||
<?php foreach([12, 10, 8, 6] as $turnIdx): ?>
|
|
||||||
<tr class='turnIdx<?=$turnIdx?>'>
|
|
||||||
<td class='bg0 center turnIdxHeader'><?=($turnIdx+1)?></td>
|
|
||||||
<td class='chiefTurnTime level12'></td>
|
|
||||||
<td class='chiefTurnText level12 bg2'>-</td>
|
|
||||||
<td class='chiefTurnTime level10'></td>
|
|
||||||
<td class='chiefTurnText level10 bg2'>-</td>
|
|
||||||
<td class='chiefTurnTime level8'></td>
|
|
||||||
<td class='chiefTurnText level8 bg2'>-</td>
|
|
||||||
<td class='chiefTurnTime level6'></td>
|
|
||||||
<td class='chiefTurnText level6 bg2'>-</td>
|
|
||||||
<td class='bg0 center turnIdxHeader'><?=($turnIdx+1)?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<tr>
|
></div
|
||||||
<td colspan="5" style='text-align:right;'>
|
<?php foreach([12, 10, 8, 6] as $chiefIdx): ?>
|
||||||
<?=chiefTurnTable()?>
|
><div class='bg2 chiefPlate' style='flex-grow:1;' id='chief_<?=$chiefIdx?>'
|
||||||
</td>
|
><div class='bg1 chiefNamePlate'><span class='chiefLevelText'>-</span> : <span class='chiefName'> </span></div
|
||||||
<td colspan="5" style='text-align:left;'>
|
<?php foreach(range(1, GameConst::$maxChiefTurn) as $turnIdx): ?>
|
||||||
<input id='turnPush' type='hidden' style=background-color:<?=GameConst::$basecolor2?>;color:white;width:58px;font-size:13px; value='미루기▼' onclick='turn(0)'>
|
><div class='chiefTurnBox turn<?=$turnIdx?>'
|
||||||
<input id='turnPull' type='hidden' style=background-color:<?=GameConst::$basecolor2?>;color:white;width:58px;font-size:13px; value='▲당기기' onclick='turn(1)'>
|
><div class='chiefTurnTime level<?=$chiefIdx?>'> </div
|
||||||
<br>
|
><div class='chiefTurnText level<?=$chiefIdx?>'> </div
|
||||||
<?=chiefCommandTable()?>
|
></div
|
||||||
<input id='setCommand' type='hidden' style='background-color:<?=GameConst::$basecolor2?>;color:white;width:55px;font-size:13px;' value='실 행'>
|
<?php endforeach; ?>
|
||||||
</td>
|
></div
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class='bg1 center'>.</td>
|
|
||||||
<td colspan=2 class='bg1 chiefNamePlate level12'>- :</td>
|
|
||||||
<td colspan=2 class='bg1 chiefNamePlate level10'>- :</td>
|
|
||||||
<td colspan=2 class='bg1 chiefNamePlate level8'>- :</td>
|
|
||||||
<td colspan=2 class='bg1 chiefNamePlate level6'>- :</td>
|
|
||||||
<td class='bg1 center'>.</td>
|
|
||||||
</tr>
|
|
||||||
<?php foreach([11, 9, 7, 5] as $turnIdx): ?>
|
|
||||||
<tr class='turnIdx<?=$turnIdx?>'>
|
|
||||||
<td class='bg0 center turnIdxHeader'><?=($turnIdx+1)?></td>
|
|
||||||
<td class='chiefTurnTime level11'></td>
|
|
||||||
<td class='chiefTurnText level11 bg2'>-</td>
|
|
||||||
<td class='chiefTurnTime level9'></td>
|
|
||||||
<td class='chiefTurnText level9 bg2'>-</td>
|
|
||||||
<td class='chiefTurnTime level7'></td>
|
|
||||||
<td class='chiefTurnText level7 bg2'>-</td>
|
|
||||||
<td class='chiefTurnTime level5'></td>
|
|
||||||
<td class='chiefTurnText level5 bg2'>-</td>
|
|
||||||
<td class='bg0 center turnIdxHeader'><?=($turnIdx+1)?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
><div class='chiefTurnIdxPanel tail'
|
||||||
</table>
|
><div class='bg1 chiefTurnIdx'>.</div
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
<?php foreach(range(1, GameConst::$maxChiefTurn) as $idx):?>
|
||||||
<tr><td><?=backButton()?></td></tr>
|
><div class='bg0 chiefTurnIdx'><?=$idx?></div
|
||||||
<tr><td><?=banner()?></td></tr>
|
<?php endforeach; ?>
|
||||||
</table>
|
></div
|
||||||
|
></div
|
||||||
|
><div id='controlPlate' style='display:flex;flex-flow:row wrap;justify-content:center;'
|
||||||
|
><div style='width:400px;text-align:right;'
|
||||||
|
><?=chiefTurnTable()
|
||||||
|
?></div
|
||||||
|
><div style='width:400px;display: flex;justify-content: center;flex-direction: column;'
|
||||||
|
><div
|
||||||
|
><input type='button' id='turnPush' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='미루기▼' onclick='turn(0)'
|
||||||
|
><input type='button' id='turnPull' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='▲당기기' onclick='turn(1)'
|
||||||
|
></div
|
||||||
|
><div
|
||||||
|
><?=chiefCommandTable()
|
||||||
|
?><input type='button' id='setCommand' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='실 행'
|
||||||
|
></div
|
||||||
|
></div
|
||||||
|
></div
|
||||||
|
><div class="chiefSubTable" style='height:<?=22*(GameConst::$maxChiefTurn+1)?>px;'
|
||||||
|
><div class='chiefTurnIdxPanel'
|
||||||
|
><div class='bg1 chiefTurnIdx'>.</div
|
||||||
|
<?php foreach(range(1, GameConst::$maxChiefTurn) as $idx):?>
|
||||||
|
><div class='bg0 chiefTurnIdx'><?=$idx?></div
|
||||||
|
<?php endforeach; ?>
|
||||||
|
></div
|
||||||
|
<?php foreach([11, 9, 7, 5] as $chiefIdx): ?>
|
||||||
|
><div class='bg2 chiefPlate' style='flex-grow:1;' id='chief_<?=$chiefIdx?>'
|
||||||
|
><div class='bg1 chiefNamePlate'><span class='chiefLevelText'>-</span> : <span class='chiefName'> </span></div
|
||||||
|
<?php foreach(range(1, GameConst::$maxChiefTurn) as $turnIdx): ?>
|
||||||
|
><div class='chiefTurnBox turn<?=$turnIdx?>'
|
||||||
|
><div class='chiefTurnTime level<?=$chiefIdx?>'> </div
|
||||||
|
><div class='chiefTurnText level<?=$chiefIdx?>'> </div
|
||||||
|
></div
|
||||||
|
<?php endforeach; ?>
|
||||||
|
></div
|
||||||
|
<?php endforeach; ?>
|
||||||
|
><div class='chiefTurnIdxPanel tail'
|
||||||
|
><div class='bg1 chiefTurnIdx'>.</div
|
||||||
|
<?php foreach(range(1, 12) as $idx):?>
|
||||||
|
><div class='bg0 chiefTurnIdx'><?=$idx?></div
|
||||||
|
<?php endforeach; ?>
|
||||||
|
></div
|
||||||
|
></div
|
||||||
|
><div
|
||||||
|
><?=backButton()
|
||||||
|
?><?=banner()
|
||||||
|
?></div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -41,6 +41,7 @@ if($troops){
|
|||||||
'SELECT no,name,picture,imgsvr,turntime,city,troop FROM general WHERE no IN %li',
|
'SELECT no,name,picture,imgsvr,turntime,city,troop FROM general WHERE no IN %li',
|
||||||
array_keys($troops)
|
array_keys($troops)
|
||||||
);
|
);
|
||||||
|
$generalTurnList = [];
|
||||||
|
|
||||||
foreach($db->queryAllLists(
|
foreach($db->queryAllLists(
|
||||||
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
|
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
|
||||||
@@ -151,7 +152,7 @@ foreach ($troops as $troopNo=>$troop) {
|
|||||||
<td rowspan=2><?=$troopLeader['turnText']?></td>
|
<td rowspan=2><?=$troopLeader['turnText']?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align=center><font size=2>【턴】 <?=substr($troopLeader['turntime'], 14)?></font></td>
|
<td align=center><font size=2>【턴】 <?=substr($troopLeader['turntime'], 14, 5)?></font></td>
|
||||||
<td align=center><font size=1><?=$troopLeader['name']?></font></td></tr>
|
<td align=center><font size=1><?=$troopLeader['name']?></font></td></tr>
|
||||||
<tr><td colspan=5>
|
<tr><td colspan=5>
|
||||||
|
|
||||||
@@ -177,7 +178,7 @@ foreach ($troops as $troopNo=>$troop) {
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td align=center><font size=2>【턴】 <?=substr($troopLeader['turntime'], 14)?></font></td>
|
<tr><td align=center><font size=2>【턴】 <?=substr($troopLeader['turntime'], 14, 5)?></font></td>
|
||||||
<td align=center><font size=1><?=$troopLeader['name']?></font></td></tr>
|
<td align=center><font size=1><?=$troopLeader['name']?></font></td></tr>
|
||||||
<tr><td colspan=5></td></tr>
|
<tr><td colspan=5></td></tr>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
|
|||||||
+36
-13
@@ -1,5 +1,12 @@
|
|||||||
@charset "UTF-8";
|
@charset "UTF-8";
|
||||||
|
|
||||||
|
.chiefSubTable{
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row wrap;
|
||||||
|
justify-content: flex-start;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
#chiefTurnSelector{
|
#chiefTurnSelector{
|
||||||
width:50px;
|
width:50px;
|
||||||
color:white;
|
color:white;
|
||||||
@@ -7,18 +14,30 @@
|
|||||||
font-size:13px;
|
font-size:13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chiefTurnIdx{
|
||||||
.chiefTurnTable{
|
flex-grow:1;
|
||||||
display:flex;
|
border-top:solid 0.67px #888888;
|
||||||
flex-flow:row nowrap;
|
line-height:21px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chiefTurnTable .flexDisplay{
|
.chiefTurnIdxPanel{
|
||||||
justify-content: center;
|
width:18px;display:flex;flex-flow:column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chiefTurnIdxPanel.tail{
|
||||||
|
border-left:solid 0.67px #888888;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chiefPlate{
|
||||||
|
display:flex;
|
||||||
|
flex-flow:column;
|
||||||
|
border-left:solid 0.67px #888888;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chiefTurnBox{
|
.chiefTurnBox{
|
||||||
width:240px;
|
flex-grow: 1;
|
||||||
|
display:flex;
|
||||||
|
flex-flow: row;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chiefTurnBox .turnHeader{
|
.chiefTurnBox .turnHeader{
|
||||||
@@ -26,14 +45,12 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chiefTurnBox .turnList{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.chiefNamePlate{
|
.chiefNamePlate{
|
||||||
|
border-top:solid 0.67px #888888;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
flex-grow: 1;
|
||||||
|
line-height:21px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.turnIdxHeader{
|
.turnIdxHeader{
|
||||||
@@ -43,13 +60,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.chiefTurnTime{
|
.chiefTurnTime{
|
||||||
|
border-top:solid 0.67px #888888;
|
||||||
|
border-right:solid 0.67px #888888;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background: black;
|
background: black;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width:43px;
|
width:44px;
|
||||||
|
line-height:21px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chiefTurnText{
|
.chiefTurnText{
|
||||||
|
border-top:solid 0.67px #888888;
|
||||||
table-layout: fixed;
|
table-layout: fixed;
|
||||||
width:192px;
|
width:192px;
|
||||||
|
line-height:21px;
|
||||||
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
+1
-1
@@ -490,7 +490,7 @@ function chiefCommandTable() {
|
|||||||
if($citySupply == 0) { $valid = 0; }
|
if($citySupply == 0) { $valid = 0; }
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
<select name=commandtype size=1 style='height:20px;color:white;background-color:black;font-size:13px;'>";
|
<select name=commandtype size=1 style='height:20px;color:white;background-color:black;font-size:13px;display:inline-block;'>";
|
||||||
commandGroup("====== 휴 식 ======");
|
commandGroup("====== 휴 식 ======");
|
||||||
addCommand("휴 식", 99);
|
addCommand("휴 식", 99);
|
||||||
commandGroup("", 1);
|
commandGroup("", 1);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ increaseRefresh("사령부", 1);
|
|||||||
$me = $db->queryFirstRow('SELECT no,nation,level,con,turntime,belong,penalty,permission FROM general WHERE owner=%i', $userID);
|
$me = $db->queryFirstRow('SELECT no,nation,level,con,turntime,belong,penalty,permission FROM general WHERE owner=%i', $userID);
|
||||||
|
|
||||||
$nationLevel = $db->queryFirstField('SELECT level FROM nation WHERE nation = %i', $me['nation']);
|
$nationLevel = $db->queryFirstField('SELECT level FROM nation WHERE nation = %i', $me['nation']);
|
||||||
|
$nationID = $me['nation'];
|
||||||
$con = checkLimit($me['con']);
|
$con = checkLimit($me['con']);
|
||||||
if($con >= 2) {
|
if($con >= 2) {
|
||||||
Json::die([
|
Json::die([
|
||||||
@@ -49,7 +49,7 @@ $lv = getNationChiefLevel($nationLevel);
|
|||||||
$turn = [];
|
$turn = [];
|
||||||
|
|
||||||
$generals = [];
|
$generals = [];
|
||||||
foreach($db->query('SELECT no,name,turntime,npc,city,nation,level FROM general WHERE nation = %i AND level >= 5') as $rawGeneral){
|
foreach($db->query('SELECT no,name,turntime,npc,city,nation,level FROM general WHERE nation = %i AND level >= 5',$nationID) as $rawGeneral){
|
||||||
$generals[$rawGeneral['level']] = new General($rawGeneral, null, $year, $month, false);
|
$generals[$rawGeneral['level']] = new General($rawGeneral, null, $year, $month, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ foreach($nationTurnList as $level=>$turnList){
|
|||||||
}
|
}
|
||||||
$nationTurnBrief[$level] = [
|
$nationTurnBrief[$level] = [
|
||||||
'name'=>$general->getName(),
|
'name'=>$general->getName(),
|
||||||
'turnTime'=>$general->getTurnTime($general::TURNTIME_HM),
|
'turnTime'=>$general->getTurnTime($general::TURNTIME_FULL),
|
||||||
'levelText'=>getLevelText($general->getVar('level'), $nationLevel),
|
'levelText'=>getLevelText($general->getVar('level'), $nationLevel),
|
||||||
'npcType'=>$general->getVar('npc'),
|
'npcType'=>$general->getVar('npc'),
|
||||||
'turn'=>getNationTurnBrief($general, $turnList)
|
'turn'=>getNationTurnBrief($general, $turnList)
|
||||||
@@ -91,5 +91,6 @@ Json::die([
|
|||||||
'reason'=>'success',
|
'reason'=>'success',
|
||||||
'date'=>$date,
|
'date'=>$date,
|
||||||
'nationTurnBrief'=>$nationTurnBrief,
|
'nationTurnBrief'=>$nationTurnBrief,
|
||||||
'isChief'=>($me['level'] > 4)
|
'isChief'=>($me['level'] > 4),
|
||||||
|
'turnTerm'=>$turnterm
|
||||||
]);
|
]);
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
var filledChiefList = {};
|
||||||
|
|
||||||
|
var chiefTableObj = {};
|
||||||
|
|
||||||
|
function clearTable(){
|
||||||
|
$('.chiefLevelText').html('-');
|
||||||
|
$('.chiefTurnTime, .chiefTurnText, .chiefName').html(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
function genChiefTableObj(){
|
||||||
|
var objTable = {
|
||||||
|
btns: $('#turnPush,#turnPull,#setCommand')
|
||||||
|
};
|
||||||
|
|
||||||
|
for(var chiefIdx = 5; chiefIdx <= 12; chiefIdx++){
|
||||||
|
var $plate = $('#chief_{0}'.format(chiefIdx));
|
||||||
|
var $levelText = $plate.find('.chiefLevelText');
|
||||||
|
var $name = $plate.find('.chiefName');
|
||||||
|
var turn = [];
|
||||||
|
for(var turnIdx=0;turnIdx<maxChiefTurn;turnIdx++){
|
||||||
|
var $turn = $plate.find('.turn{0}'.format(turnIdx+1));
|
||||||
|
var $turnTime = $turn.find('.chiefTurnTime');
|
||||||
|
var $turnText = $turn.find('.chiefTurnText');
|
||||||
|
turn.push({turnTime:$turnTime,turnText:$turnText});
|
||||||
|
}
|
||||||
|
objTable[chiefIdx] = {
|
||||||
|
levelText: $levelText,
|
||||||
|
name: $name,
|
||||||
|
turn: turn
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return objTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function clearChief(chiefIdx){
|
||||||
|
var $plate = $('#chief_{0}'.format(chiefIdx));
|
||||||
|
$plate.find('.chiefLevelText').html('-');
|
||||||
|
$plate.find('.chiefTurnTime, .chiefTurnText, .chiefName').html(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadTable(){
|
||||||
|
$.post({
|
||||||
|
url:'j_getChiefTurn.php',
|
||||||
|
dataType:'json',
|
||||||
|
}).then(function(data){
|
||||||
|
if(!data.result){
|
||||||
|
alert(data.reason);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var turnTerm = data.turnTerm;
|
||||||
|
var tmpFilledChiefList = {};
|
||||||
|
|
||||||
|
if(data.isChief){
|
||||||
|
chiefTableObj.btns.css('visibility', 'visible');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
chiefTableObj.btns.css('visibility', 'hidden');
|
||||||
|
}
|
||||||
|
$.each(data.nationTurnBrief, function(chiefIdx, chiefInfo){
|
||||||
|
tmpFilledChiefList[chiefIdx] = true;
|
||||||
|
filledChiefList[chiefIdx] = true;
|
||||||
|
|
||||||
|
var plateObj = chiefTableObj[chiefIdx];
|
||||||
|
var $name = $('<span>{0}</span>'.format(chiefInfo.name));
|
||||||
|
var nameColor = getNpcColor(chiefInfo.npcType);
|
||||||
|
if(nameColor){
|
||||||
|
$name.css('color',nameColor);
|
||||||
|
}
|
||||||
|
plateObj.levelText.text(chiefInfo.levelText);
|
||||||
|
plateObj.name.html($name);
|
||||||
|
|
||||||
|
var turnTimeObj = moment(chiefInfo.turnTime);
|
||||||
|
var turnList = plateObj.turn;
|
||||||
|
$.each(chiefInfo.turn, function(turnIdx, turnText){
|
||||||
|
turnTimeObj = turnTimeObj.add(turnTerm, 'minute');
|
||||||
|
turnList[turnIdx].turnTime.text(turnTimeObj.format('hh:mm'));
|
||||||
|
turnList[turnIdx].turnText.text(turnText);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
for(var idx=5;idx<=12;idx++){
|
||||||
|
if(idx in tmpFilledChiefList){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(idx in filledChiefList){
|
||||||
|
clearChief(chiefIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filledChiefList = tmpFilledChiefList;
|
||||||
|
}, errUnknown);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
jQuery(function($){
|
||||||
|
chiefTableObj= genChiefTableObj();
|
||||||
|
$('#reloadTable').click(reloadTable);
|
||||||
|
reloadTable();
|
||||||
|
})
|
||||||
+11
-1
@@ -327,4 +327,14 @@ function nl2br(text){
|
|||||||
function br2nl (text) {
|
function br2nl (text) {
|
||||||
return text.replace(/<\s*\/?br\s*[\/]?>/gi, '\n');
|
return text.replace(/<\s*\/?br\s*[\/]?>/gi, '\n');
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function getNpcColor(npcType){
|
||||||
|
if(npcType >= 2){
|
||||||
|
return 'cyan';
|
||||||
|
}
|
||||||
|
if(npcType == 1){
|
||||||
|
return 'skyblue';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user