서버에서 자율행동란에 시간 추가, tooltip에 copyable_info 추가

This commit is contained in:
2019-09-25 02:14:49 +09:00
parent 8c6afee7c9
commit 8f107b56b3
4 changed files with 59 additions and 42 deletions
+11
View File
@@ -166,6 +166,17 @@ a.samButton.disabled {
content:'】'
}
.tooltip_copyable_info .tooltiptext{
display: inline;
color: rgba(0,0,0,0);
font-size: 0;
}
.tooltiptext {
display: none;
}
.hidden_but_copyable{
color: rgba(0,0,0,0);
font-size: 0;
}
+11
View File
@@ -192,10 +192,21 @@ div.bar_out div.bar_in{
font-family: '맑은 고딕';
}
.tooltip_copyable_info .tooltiptext{
display: inline;
color: rgba(0,0,0,0);
font-size: 0;
}
.tooltiptext {
display: none;
}
.hidden_but_copyable{
color: rgba(0,0,0,0);
font-size: 0;
}
.btn-group-xs > .btn, .btn-xs {
padding : .25rem .4rem;
font-size : .875rem;
+34 -39
View File
@@ -3,6 +3,38 @@ namespace sammo;
include "lib.php";
$templates = new \League\Plates\Engine(__dir__.'/templates');
function getAutorunInfo($autorunOption){
global $templates;
$auto_info = [];
foreach($autorunOption['options'] as $auto_option => $value){
assert($value);
switch($auto_option){
case 'develop': $auto_info['내정'] = '내정'; break;
case 'warp': $auto_info['순간이동'] = '순간이동'; break;
case 'recruit': $auto_info['징병'] = $auto_info['징병']??'징병'; break;
case 'recruit_high': $auto_info['징병'] = '모병'; break;
case 'train': $auto_info['훈사'] = '훈련/사기진작'; break;
case 'battle': $auto_info['출병'] = '출병'; break;
}
}
$limit = Util::toInt($autorunOption['limit_minutes']);
if($limit % 60 == 0){
$auto_info['제한'] = ($limit/60).'시간 유효';
}
else{
$auto_info['제한'] = ($limit).'분 유효';
}
$auto_info = join(', ', array_values($auto_info));
return $templates->render('tooltip', [
'text'=>'자율행동',
'info'=>$auto_info,
'style'=>'text-decoration:underline',
'copyable_info'=>true
]);
}
$session = Session::requireLogin([
'game'=>null,
'me'=>null
@@ -16,7 +48,6 @@ if(!class_exists('\\sammo\\DB')){
]);
}
$templates = new \League\Plates\Engine(__dir__.'/templates');
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -41,24 +72,7 @@ if(file_exists(__dir__.'/.htaccess')){
}
if($options['autorun_user']['limit_minutes']??false){
$auto_info = [];
foreach($options['autorun_user']['options'] as $auto_option => $value){
assert($value);
switch($auto_option){
case 'develop': $auto_info['내정'] = '내정'; break;
case 'warp': $auto_info['순간이동'] = '순간이동'; break;
case 'recruit': $auto_info['징병'] = $auto_info['징병']??'징병'; break;
case 'recruit_high': $auto_info['징병'] = '모병'; break;
case 'train': $auto_info['훈사'] = '훈련/사기진작'; break;
case 'battle': $auto_info['출병'] = '출병'; break;
}
}
$auto_info = join(', ', array_values($auto_info));
$otherTextInfo[] = $templates->render('tooltip', [
'text'=>'자율행동',
'info'=>$auto_info,
'style'=>'text-decoration:underline'
]);
$otherTextInfo[] = getAutorunInfo($options['autorun_user']);
}
if(!$otherTextInfo){
@@ -117,27 +131,8 @@ if($admin['join_mode'] == 'onlyRandom'){
$otherTextInfo[] = '랜덤 임관 전용';
}
if($admin['autorun_user']['limit_minutes']??false){
$auto_info = [];
foreach($admin['autorun_user']['options'] as $auto_option => $value){
assert($value);
switch($auto_option){
case 'develop': $auto_info['내정'] = '내정'; break;
case 'warp': $auto_info['순간이동'] = '순간이동'; break;
case 'recruit': $auto_info['징병'] = $auto_info['징병']??'징병'; break;
case 'recruit_high': $auto_info['징병'] = '모병'; break;
case 'train': $auto_info['훈사'] = '훈련/사기진작'; break;
case 'battle': $auto_info['출병'] = '출병'; break;
}
}
$auto_info = join(', ', array_values($auto_info));
$otherTextInfo[] = $templates->render('tooltip', [
'text'=>'자율행동',
'info'=>$auto_info,
'style'=>'text-decoration:underline'
]);
$otherTextInfo[] = getAutorunInfo($admin['autorun_user']);
}
if(!$otherTextInfo){
+3 -3
View File
@@ -1,6 +1,6 @@
<span class="obj_tooltip" data-toggle="tooltip" data-placement="top"
<span class="obj_tooltip <?=(isset($copyable_info)&&$copyable_info)?'tooltip_copyable_info':''?>" data-toggle="tooltip" data-placement="top"
><span <?=isset($style)?"style=\"$style\"":''?>><?=$text??''?></span
><span class="tooltiptext"
><?=$info??''
?></span
><span class="hidden_but_copyable">[</span><?=$info??''?><span class="hidden_but_copyable">]</span
></span
></span>