새 메시지, 메시지 수락/거절 동작 방식 변경

This commit is contained in:
2018-02-21 22:37:54 +09:00
parent a0314dad47
commit 1450715c56
5 changed files with 63 additions and 25 deletions
+24
View File
@@ -249,6 +249,30 @@
}
],
"private":[
{
"id":1206,
"time":"2018-02-10 22:04:04",
"isSender":false,
"src":{
"id":21,
"nation_id":2,
"name":"Hide_Dx2",
"nation":"연구소2",
"color":"#ff0000"
},
"dest":{
"id":11,
"nation_id":1,
"name":"Hide_D",
"nation":"연구소",
"color":"#ffd700"
},
"text":"연구소2로 망명 권유 서신2",
"option":{
"used":false,
"action":"scout"
}
},
{
"id":1205,
"time":"2018-02-10 22:04:04",
+8 -1
View File
@@ -127,14 +127,21 @@ function redrawMsg(deferred){
var msgHtml = TemplateEngine(messageTemplate, msg);
//만약 이전 메시지가 변경된 것인가 확인한다.
//만약 이전 메시지와 같은 id가 온 경우 덮어씌운다.
//NOTE:현 프로세스 상에서는 같은 id가 와선 안된다.
var $existMsg = $('#msg_{0}'.format(msg.id));
var $msg = $(msgHtml);
if($existMsg.length){
console.log('메시지 충돌', $msg, $existMsg);
$existMsg.html($msg.html());
$msg = $existMsg;
}
if(msg.option && msg.option.parent){
//parent는 삭제.
$('#msg_{0}'.format(msg.option.parent)).detach();
}
$msg.find('button.prompt_yes').click(function(){
if(!confirm("수락하시겠습니까?")){
return false;
+1 -1
View File
@@ -29,7 +29,7 @@
</div>
<div class="msg_content"><%e(text)%></div>
<%if(this.option) {%>
<%if(this.option && this.option.action) {%>
<div class="msg_prompt">
<button class="prompt_yes btn_prompt">수락</button> <button class="prompt_no btn_prompt">거절</button>
</div>
+24 -20
View File
@@ -3,6 +3,30 @@
"server":"d1af658a-f094-4303-9496-9a27a8180b0b",
"sequence":1811,
"national":[
{
"id":1211,
"time":"2018-02-10 22:05:10",
"isSender":false,
"src":{
"id":11,
"nation_id":1,
"name":"Hide_D",
"icon":"pic_781.jpg",
"nation":"연구소",
"color":"#ffd700"
},
"dest":{
"id":9001,
"nation_id":1,
"nation":"연구소",
"color":"#ffd700"
},
"text":"외교를 거절해버렸당",
"opt":{
"parent":1209
}
},
{
"id":1210,
"time":"2018-02-10 22:05:09",
@@ -22,26 +46,6 @@
"color":"#ffd700"
},
"text":"새롭게 추가된 나의 텍스트!"
},
{
"id":1209,
"time":"2018-02-10 22:05:08",
"isSender":false,
"src":{
"id":11,
"nation_id":1,
"name":"Hide_D",
"icon":"pic_781.jpg",
"nation":"연구소",
"color":"#ffd700"
},
"dest":{
"id":9001,
"nation_id":1,
"nation":"연구소",
"color":"#ffd700"
},
"text":"외교를 거절해버렸당"
}
],
"public":[
+6 -3
View File
@@ -10,7 +10,7 @@
],
"private":[
{
"id":1205,
"id":1208,
"time":"2018-02-10 22:06:00",
"isSender":false,
"src":{
@@ -27,10 +27,13 @@
"nation":"연구소",
"color":"#ffd700"
},
"text":"연구소2로 망명 권유 서신을 거절"
"text":"연구소2로 망명 권유 서신을 거절",
"option":{
"parent":1205
}
},
{
"id":1206,
"id":1207,
"time":"2018-02-10 22:04:04",
"isSender":false,
"src":{