메시지 시스템에 9자 닉네임 적용

This commit is contained in:
2018-06-04 01:03:05 +09:00
parent f9d90c38ef
commit 7367eb1c45
8 changed files with 55 additions and 18 deletions
+11
View File
@@ -35,6 +35,10 @@
background-color:#5d1e1a; background-color:#5d1e1a;
} }
.msg_plate_private.msg_plate_dest{
background-color:#5d461a;
}
.msg_plate_public{ .msg_plate_public{
background-color:#141c65; background-color:#141c65;
@@ -42,7 +46,14 @@
.msg_plate_national, .msg_plate_diplomacy{ .msg_plate_national, .msg_plate_diplomacy{
background-color:#00582c; background-color:#00582c;
}
.msg_plate_national.msg_plate_dest, .msg_plate_diplomacy.msg_plate_dest {
background-color:#704615;
}
.msg_plate_national.msg_plate_src, .msg_plate_diplomacy.msg_plate_src {
background-color:#70153b;
} }
.public_message{ .public_message{
+5 -5
View File
@@ -77,11 +77,11 @@ function allButton() {
$call = "설문조사"; $call = "설문조사";
} }
if(\file_exists("d_setting/templates/allButton.php")){ if(\file_exists(__dir__."/d_setting/templates/allButton.php")){
$templates = new \League\Plates\Engine('d_setting/templates'); $templates = new \League\Plates\Engine(__dir__.'/d_setting/templates');
} }
else{ else{
$templates = new \League\Plates\Engine('templates'); $templates = new \League\Plates\Engine(__dir__.'/templates');
} }
@@ -113,7 +113,7 @@ function commandButton() {
$bgColor = Util::array_get($nation['color'])?:'#000000'; $bgColor = Util::array_get($nation['color'])?:'#000000';
$fgColor = newColor($bgColor); $fgColor = newColor($bgColor);
$templates = new \League\Plates\Engine('templates'); $templates = new \League\Plates\Engine(__dir__.'/templates');
$showSecret = false; $showSecret = false;
if($me['level'] >= 2){ if($me['level'] >= 2){
$showSecret = true; $showSecret = true;
@@ -170,7 +170,7 @@ function formatName(string $name, int $npc): string{
function getMapHtml(){ function getMapHtml(){
//NOTE: 필요한가? //NOTE: 필요한가?
$templates = new \League\Plates\Engine('templates'); $templates = new \League\Plates\Engine(__dir__.'/templates');
return $templates->render('map'); return $templates->render('map');
} }
+4 -3
View File
@@ -11,8 +11,8 @@ $jsonPost = WebUtil::parseJsonPost();
$reqSequence = (int)Util::array_get($jsonPost['sequence'], 0); $reqSequence = (int)Util::array_get($jsonPost['sequence'], 0);
list($generalID, $nationID) = DB::db()->queryFirstList( list($generalID, $nationID, $generalName) = DB::db()->queryFirstList(
'select `no`, `nation` from `general` where owner = %i', 'select `no`, `nation`, `name` from `general` where owner = %i',
$userID $userID
); );
@@ -58,5 +58,6 @@ $result['diplomacy']= array_map(function(Message $msg)use (&$nextSequence){
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 10, 0)); }, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 10, 0));
$result['sequence'] = $nextSequence; $result['sequence'] = $nextSequence;
$result['nationID'] = $nationID;
$result['generalName'] = $generalName;
Json::die($result); Json::die($result);
+14
View File
@@ -134,7 +134,21 @@ function redrawMsg(deferred){
$('#last_contact').val(contactTarget).html(generalList[contactTarget].textName).show(); $('#last_contact').val(contactTarget).html(generalList[contactTarget].textName).show();
} }
msg.nationID = obj.nationID;
msg.generalName = obj.generalName;
msg.msgType = msgType; msg.msgType = msgType;
if(msg.src.nation_id == msg.dest.nation_id){
msg.nationType = 'local';
}
else if(msg.nationID == msg.src.nation_id){
msg.nationType = 'src';
}
else{
msg.nationType = 'dest';
}
msg.defaultIcon = pathConfig.sharedIcon+'/default.jpg'; msg.defaultIcon = pathConfig.sharedIcon+'/default.jpg';
var msgHtml = TemplateEngine(messageTemplate, msg); var msgHtml = TemplateEngine(messageTemplate, msg);
+18 -7
View File
@@ -1,10 +1,10 @@
<div <div
class="msg_plate msg_plate_<%msgType%>" class="msg_plate msg_plate_<%msgType%> msg_plate_<%nationType%>""
id="msg_<%id%>" id="msg_<%id%>"
data-id="<%id%>" data-id="<%id%>"
> >
<div class="msg_icon"> <div class="msg_icon">
<%if(src.icon) { %> <%if(src.icon){ %>
<img width='64' height='64' src="<%encodeURI(src.icon)%>"> <img width='64' height='64' src="<%encodeURI(src.icon)%>">
<%} else {%> <%} else {%>
<img width='64' height='64' src="<%encodeURI(defaultIcon)%>"> <img width='64' height='64' src="<%encodeURI(defaultIcon)%>">
@@ -13,15 +13,26 @@
<div class="msg_body"> <div class="msg_body">
<div class="msg_header"> <div class="msg_header">
<%if(msgType == 'private') {%> <%if(msgType == 'private') {%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span <%if(src.name == generalName){%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"></span
><span class="msg_from_to"></span ><span class="msg_from_to"></span
><span class="msg_target msg_<%dest.colorType%>" style="background-color:<%dest.color%>;"><%e(dest.name)%>:<%e(dest.nation)%></span> ><span class="msg_target msg_<%dest.colorType%>" style="background-color:<%dest.color%>;"><%e(dest.name)%>:<%e(dest.nation)%></span>
<%} else if(msgType == 'national' && src.nation_id == dest.nation_id){%> <%}else{%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span>
<%} else if(msgType == 'national' || msgType == 'diplomacy'){%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span <span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span
><span class="msg_from_to"></span ><span class="msg_from_to"></span
><span class="msg_target msg_<%dest.colorType%>" style="background-color:<%dest.color%>;"></span>
<%}%>
<%} else if(msgType == 'national' && src.nation_id == dest.nation_id){%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%></span>
<%} else if(msgType == 'national' || msgType == 'diplomacy'){%>
<%if(src.nation_id == nationID){%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%></span
><span class="msg_from_to"></span
><span class="msg_target msg_<%dest.colorType%>" style="background-color:<%dest.color%>;"><%e(dest.nation)%></span> ><span class="msg_target msg_<%dest.colorType%>" style="background-color:<%dest.color%>;"><%e(dest.nation)%></span>
<%}else{%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span
><span class="msg_from_to"></span>
<%}%>
<%} else {%> <%} else {%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span> <span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span>
<%} %> <%} %>
+1 -1
View File
@@ -37,7 +37,7 @@ function Error($message='', $url="")
} }
file_put_contents(__dir__."/logs/_db_bug.txt", "{\"url\":\"$url\",\"msg\":\"$message\"}\n", FILE_APPEND); file_put_contents(__dir__."/logs/_db_bug.txt", "{\"url\":\"$url\",\"msg\":\"$message\"}\n", FILE_APPEND);
$templates = new \League\Plates\Engine('templates'); $templates = new \League\Plates\Engine(__dir__.'/templates');
ob_get_flush(); ob_get_flush();
WebUtil::setHeaderNoCache(); WebUtil::setHeaderNoCache();
+1 -1
View File
@@ -9,7 +9,7 @@ function processWar($general, $city) {
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get(); $connect=$db->get();
$templates = new \League\Plates\Engine('templates'); $templates = new \League\Plates\Engine(__dir__.'/templates');
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
+1 -1
View File
@@ -6,7 +6,7 @@ require(__dir__.'/../vendor/autoload.php');
WebUtil::setHeaderNoCache(); WebUtil::setHeaderNoCache();
$session = Session::requireLogin()->setReadOnly(); $session = Session::requireLogin()->setReadOnly();
$templates = new \League\Plates\Engine('templates'); $templates = new \League\Plates\Engine(__dir__.'/templates');
$db = RootDB::db(); $db = RootDB::db();
$notice = $db->queryFirstField('SELECT `NOTICE` FROM `system` WHERE `NO`=1'); $notice = $db->queryFirstField('SELECT `NOTICE` FROM `system` WHERE `NO`=1');