메시지 첫 동작
This commit is contained in:
@@ -66,6 +66,7 @@
|
|||||||
color:white;
|
color:white;
|
||||||
background-color:black;
|
background-color:black;
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
|
width:160px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.board_header{
|
.board_header{
|
||||||
|
|||||||
+29
-40
@@ -68,6 +68,7 @@ $scenario = $admin['scenario_text'];
|
|||||||
<script src="js/main.js"></script>
|
<script src="js/main.js"></script>
|
||||||
<script src="js/base_map.js"></script>
|
<script src="js/base_map.js"></script>
|
||||||
<script src="js/map.js"></script>
|
<script src="js/map.js"></script>
|
||||||
|
<script src="js/msg.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function(){
|
||||||
reloadWorldMap({
|
reloadWorldMap({
|
||||||
@@ -80,14 +81,15 @@ $(function(){
|
|||||||
<link href="css/common.css" rel="stylesheet">
|
<link href="css/common.css" rel="stylesheet">
|
||||||
<link href="css/main.css" rel="stylesheet">
|
<link href="css/main.css" rel="stylesheet">
|
||||||
<link href="css/map.css" rel="stylesheet">
|
<link href="css/map.css" rel="stylesheet">
|
||||||
|
<link href="css/msg.css" rel="stylesheet">
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="img_back">
|
<body class="img_back">
|
||||||
|
|
||||||
<div id="container">
|
<div id="container">
|
||||||
|
<div><?=allButton()?></div>
|
||||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 style=font-size:13px;word-break:break-all; id=bg0>
|
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 style=font-size:13px;word-break:break-all; id=bg0>
|
||||||
<tr><td colspan=5><?=allButton()?></td></tr>
|
|
||||||
<tr height=50>
|
<tr height=50>
|
||||||
<td colspan=5 align=center><font size=4>삼국지 모의전투 HiDCHe (<font color=cyan><?=$scenario?></font>)</font></td>
|
<td colspan=5 align=center><font size=4>삼국지 모의전투 HiDCHe (<font color=cyan><?=$scenario?></font>)</font></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -271,52 +273,39 @@ if ($session->userGrade >= 5) {
|
|||||||
<tr><td width=998 colspan=2 align=center id=bg1><b>중원 정세</b></td></tr>
|
<tr><td width=998 colspan=2 align=center id=bg1><b>중원 정세</b></td></tr>
|
||||||
<tr><td width=998 colspan=2><?=getWorldHistoryRecent(15)?></td></tr>
|
<tr><td width=998 colspan=2><?=getWorldHistoryRecent(15)?></td></tr>
|
||||||
</table>
|
</table>
|
||||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 style=font-size:13px;word-break:break-all; id=bg0>
|
<div class="message_input_form bg0">
|
||||||
<tr>
|
<select id="mailbox_list" size="1">
|
||||||
<td colspan=2>
|
|
||||||
<div class="message_input_form bg0">
|
|
||||||
<select id="mailbox_list" size="1">
|
|
||||||
|
|
||||||
<select name="genlist" size="1" style="color:white;background-color:black;font-size:13">
|
<select name="genlist" size="1" style="color:white;background-color:black;font-size:13">
|
||||||
</select>
|
|
||||||
<input type="textarea" id="msg_input" maxlength="99">
|
|
||||||
<button id="msg_submit">서신전달&갱신</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr><td colspan=2><?=allButton()?></td></tr>
|
|
||||||
<tr><td colspan=2>
|
|
||||||
<div id="message_board">
|
|
||||||
<div class="board_side">
|
|
||||||
<div class="board_header bg0">전체 메시지(최고99자)</div>
|
|
||||||
<section class="public_message">
|
|
||||||
|
|
||||||
</section>
|
|
||||||
<div class="board_header bg0">개인 메시지(최고99자)</div>
|
|
||||||
<section class="private_message">
|
|
||||||
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<div class="board_side">
|
|
||||||
<section class="diplomacy_message">
|
|
||||||
|
|
||||||
</section>
|
</select>
|
||||||
<div class="board_header bg0">국가 메시지(최고99자)</div>
|
<input type="textarea" id="msg_input" maxlength="99">
|
||||||
<section class="national_message">
|
<button id="msg_submit">서신전달&갱신</button>
|
||||||
|
</div>
|
||||||
|
<div id="message_board">
|
||||||
|
<div class="board_side">
|
||||||
|
<div class="board_header bg0">전체 메시지(최고99자)</div>
|
||||||
|
<section class="public_message">
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
<div class="board_header bg0">개인 메시지(최고99자)</div>
|
||||||
</div>
|
<section class="private_message">
|
||||||
</td></tr>
|
|
||||||
<tr><td colspan=2>
|
|
||||||
|
|
||||||
<?php
|
</section>
|
||||||
echo allButton();
|
</div>
|
||||||
echo banner();
|
<div class="board_side">
|
||||||
?>
|
<section class="diplomacy_message">
|
||||||
|
|
||||||
</td></tr>
|
</section>
|
||||||
</table>
|
<div class="board_header bg0">국가 메시지(최고99자)</div>
|
||||||
|
<section class="national_message">
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="clear:left;"><?=allButton()?><?=banner()?></div>
|
||||||
<?php PrintElapsedTime(); ?>
|
<?php PrintElapsedTime(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
+22
-16
@@ -8,7 +8,7 @@ $session = Session::requireGameLogin([])->setReadOnly();
|
|||||||
$userID = Session::getUserID();
|
$userID = Session::getUserID();
|
||||||
|
|
||||||
$jsonPost = WebUtil::parseJsonPost();
|
$jsonPost = WebUtil::parseJsonPost();
|
||||||
$reqSequence = Util::toInt(Util::array_get($jsonPost['sequence'], 0));
|
$reqSequence = (int)Util::array_get($jsonPost['sequence'], 0);
|
||||||
|
|
||||||
|
|
||||||
list($generalID, $nationID) = DB::db()->queryFirstList(
|
list($generalID, $nationID) = DB::db()->queryFirstList(
|
||||||
@@ -24,18 +24,24 @@ if($nationID === null){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::die([
|
$result = [];
|
||||||
'result'=>true,
|
$result['result'] = true;
|
||||||
'private'=>array_map(function(Message $msg){
|
|
||||||
return $msg->toArray();
|
$result['private'] = array_map(function(Message $msg){
|
||||||
}, Message::getMessagesFromMailBox($generalID, Message::MSGTYPE_PRIVATE, 10, $reqSequence)),
|
return $msg->toArray();
|
||||||
'public'=>array_map(function(Message $msg){
|
}, Message::getMessagesFromMailBox($generalID, Message::MSGTYPE_PRIVATE, 10, $reqSequence));
|
||||||
return $msg->toArray();
|
|
||||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, 20, $reqSequence)),
|
$result['public'] = array_map(function(Message $msg){
|
||||||
'national'=>array_map(function(Message $msg){
|
return $msg->toArray();
|
||||||
return $msg->toArray();
|
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, 20, $reqSequence));
|
||||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, 20, $reqSequence)),
|
|
||||||
'diplomacy'=>array_map(function(Message $msg){
|
$result['national'] = array_map(function(Message $msg){
|
||||||
return $msg->toArray();
|
return $msg->toArray();
|
||||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 10, 0)),
|
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, 20, $reqSequence));
|
||||||
]);
|
|
||||||
|
$result['diplomacy']= array_map(function(Message $msg){
|
||||||
|
return $msg->toArray();
|
||||||
|
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 10, 0));
|
||||||
|
|
||||||
|
|
||||||
|
Json::die($result);
|
||||||
+7
-6
@@ -48,7 +48,7 @@ function refreshMsg(){
|
|||||||
|
|
||||||
function fetchMsg(){
|
function fetchMsg(){
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
url: 'json_result.php',
|
url: 'j_msg_get_recent.php',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
@@ -221,7 +221,7 @@ function refreshMailboxList(obj){
|
|||||||
$.each(obj.nation, function(){
|
$.each(obj.nation, function(){
|
||||||
var nation = this;
|
var nation = this;
|
||||||
//console.log(nation);
|
//console.log(nation);
|
||||||
var $optgroup = $('<optgroup label="{0}"></optgroup>'.format(nation.nation));
|
var $optgroup = $('<optgroup label="{0}"></optgroup>'.format(nation.name));
|
||||||
$optgroup.css('background-color', nation.color);
|
$optgroup.css('background-color', nation.color);
|
||||||
|
|
||||||
if(myNation.mailbox == nation.mailbox){
|
if(myNation.mailbox == nation.mailbox){
|
||||||
@@ -238,7 +238,8 @@ function refreshMailboxList(obj){
|
|||||||
$.each(nation.general, function(){
|
$.each(nation.general, function(){
|
||||||
var generalID = this[0];
|
var generalID = this[0];
|
||||||
var generalName = this[1];
|
var generalName = this[1];
|
||||||
var isRuler = this.length>2;
|
var isNPC = !!(this[2] & 0x2);
|
||||||
|
var isRuler = !!(this[2] & 0x1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -358,13 +359,13 @@ function activateMessageForm(){
|
|||||||
jQuery(function($){
|
jQuery(function($){
|
||||||
|
|
||||||
//tmp_template.html은 추후 msg.js에 통합될 수 있음
|
//tmp_template.html은 추후 msg.js에 통합될 수 있음
|
||||||
var getTemplate = $.get('tmp_template.html',function(obj){
|
var getTemplate = $.get('js/templates/message.html',function(obj){
|
||||||
messageTemplate = obj;
|
messageTemplate = obj;
|
||||||
});
|
});
|
||||||
|
|
||||||
//basic_info.json은 세션값에 따라 동적으로 바뀌는 데이터임.
|
//basic_info.json은 세션값에 따라 동적으로 바뀌는 데이터임.
|
||||||
var basicInfo = $.ajax({
|
var basicInfo = $.ajax({
|
||||||
url:'basic_info.json',
|
url:'j_basic_info.php',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
@@ -375,7 +376,7 @@ jQuery(function($){
|
|||||||
|
|
||||||
//sender_list.json 은 서버측에선 캐시 가능한 데이터임.
|
//sender_list.json 은 서버측에선 캐시 가능한 데이터임.
|
||||||
var senderList = $.ajax({
|
var senderList = $.ajax({
|
||||||
url: 'sender_list.json',
|
url: 'j_msg_contact_list.php',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<div
|
||||||
|
class="msg_plate msg_plate_<%msgType%>"
|
||||||
|
id="msg_<%id%>"
|
||||||
|
data-id="<%id%>"
|
||||||
|
>
|
||||||
|
<div class="msg_icon">
|
||||||
|
<%if(src.icon) { %>
|
||||||
|
<img width='64' height='64' src="<%encodeURI(src.icon)%>">
|
||||||
|
<%} else {%>
|
||||||
|
<img width='64' height='64' src="<%encodeURI(defaultIcon)%>">
|
||||||
|
<%}%>
|
||||||
|
</div>
|
||||||
|
<div class="msg_body">
|
||||||
|
<div class="msg_header">
|
||||||
|
<%if(msgType == 'private') {%>
|
||||||
|
<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_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){%>
|
||||||
|
<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_from_to">▶</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_time"><<%e(time)%>></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="msg_content"><%e(text)%></div>
|
||||||
|
<%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>
|
||||||
|
<%} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -192,7 +192,7 @@ class Message
|
|||||||
* @param int $fromSeq 가져오고자 하는 위치. $fromSeq보다 '큰' seq만 가져온다. 따라서 0 이하이면 모두 가져옴.
|
* @param int $fromSeq 가져오고자 하는 위치. $fromSeq보다 '큰' seq만 가져온다. 따라서 0 이하이면 모두 가져옴.
|
||||||
* @return Message[]
|
* @return Message[]
|
||||||
*/
|
*/
|
||||||
protected static function getMessagesFromMailBox(int $mailbox, string $msgType, int $limit=30, int $fromSeq = 0)
|
public static function getMessagesFromMailBox(int $mailbox, string $msgType, int $limit=30, int $fromSeq = 0)
|
||||||
{
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user