Commit 3697e24a authored by hisuinohoshi's avatar hisuinohoshi

Update in-game newsinfo

新增:
- 在游戏内聊天框界面切换显示聊天讯息/进行状况的功能;
parent f01f4d15
......@@ -369,6 +369,19 @@ word-break:break-all;
overflow:auto;
position:relative;
}
#newslist{
MARGIN: 0px;
height:120px;
width:100%;
word-break:normal;
overflow:auto;
position:relative;
}
.newslist ul{
margin: 0;
padding: 2px;
padding-left: 20px;
}
#sendchat{
MARGIN: 0px;
padding:0px;
......
......@@ -44,6 +44,7 @@ unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
require GAME_ROOT.'./gamedata/system.php';
require GAME_ROOT.'./include/init.func.php';
require GAME_ROOT.'./include/news.func.php';
require GAME_ROOT.'./include/resources.func.php';
require GAME_ROOT.'./include/roommng.func.php';
require GAME_ROOT.'./include/game/revclubskills.func.php';
......
......@@ -375,7 +375,8 @@ function chat(mode,reftime) {
clearTimeout(refchat);
var oXmlHttp = zXmlHttp.createRequest();
var sBody = getRequestBody(document.forms['sendchat']);
oXmlHttp.open("post", "chat.php", true);
if(mode == 'news') oXmlHttp.open("post", "news.php", true);
else oXmlHttp.open("post", "chat.php", true);
oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
......@@ -389,7 +390,8 @@ function chat(mode,reftime) {
oXmlHttp.send(sBody);
if(mode == 'send'){$('chatmsg').value = '';$('sendmode').value = 'ref';}
rtime = reftime;
refchat = setTimeout("chat('ref',rtime)",rtime);
if(mode == 'news') refchat = setTimeout("chat('news',rtime)",rtime);
else refchat = setTimeout("chat('ref',rtime)",rtime);
}
......@@ -403,9 +405,12 @@ function showChatdata(jsonchat) {
newchat += chatdata['msg'][cid];
}
$('chatlist').innerHTML = newchat + $('chatlist').innerHTML;
}
}else{
$('newslist').innerHTML = jsonchat;
}
}
function openShutManager(oSourceObj,oTargetObj,shutAble,oOpenTip,oShutTip){
var sourceObj = typeof oSourceObj == "string" ? document.getElementById(oSourceObj) : oSourceObj;
var targetObj = typeof oTargetObj == "string" ? document.getElementById(oTargetObj) : oTargetObj;
......
......@@ -6,7 +6,7 @@ require './include/common.inc.php';
require './include/game.func.php';
//$t_s=getmicrotime();
//require_once GAME_ROOT.'./include/JSON.php';
require_once GAME_ROOT.'./include/news.func.php';
//require_once GAME_ROOT.'./include/news.func.php';
//include_once GAME_ROOT.'./include/system.func.php';
/*
......@@ -23,7 +23,15 @@ $last_newsinfo = nparse_news(0,50);
if(!isset($newsmode)){$newsmode = '';}
if($newsmode == 'last') {
if (isset($sendmode) && $sendmode == 'news') {//游戏页面查看进行状况的调用
//$lastnid = (int)$lastnid;
$newsinfo = nparse_news(0,$newslimit);
ob_clean();
//$jgamedata = gencode($newsinfo);
$jgamedata = $newsinfo;
echo $jgamedata;
ob_end_flush();
} elseif($newsmode == 'last') {
echo $last_newsinfo;
$newsdata['innerHTML']['newsinfo'] = ob_get_contents();
if(isset($error)){$newsdata['innerHTML']['error'] = $error;}
......
<table id="chat" border="0" width="720" cellspacing="0" cellpadding="0" style="valign:top">
<tr>
<td height="20px" width="100%" class="b1"><span>{lang chat}</span></td>
<td height="20px" width="100%" class="b1"><span id="chattitle">{lang chat}</span></td>
</tr>
<tr>
<td valign="top" class="b3" style="text-align: left" height="1px">
......@@ -9,6 +9,10 @@
$msg
<!--{/loop}-->
</div>
<div id="newslist" style="display:none" class="newslist">
<!--{eval $chat_news = nparse_news(0,$newslimit);}-->
$chat_news
</div>
</td>
</tr>
<tr>
......@@ -30,14 +34,39 @@
</select>
</span>
<input type="text" id="chatmsg" name="chatmsg" maxlength="60">
<input type="button" id="send"
onClick="document['sendchat']['sendmode'].value='send';chat('send',$chatrefresh);return false;"
<input type="button" id="send" onClick="
if($('sendmode').value=='ref')
{
document['sendchat']['sendmode'].value='send';
chat('send',$chatrefresh);
}
return false;"
value="{lang send}">
<input type="button" id="ref"
onClick="document['sendchat']['sendmode'].value='ref';chat('ref',$chatrefresh);return false;"
<input type="button" id="ref" onClick="
if($('sendmode').value=='news'){
chat('news',$chatrefresh);
}else{
document['sendchat']['sendmode'].value='ref';chat('ref',$chatrefresh);
}
return false;"
value="{lang refresh}">
<!-- 迷你进行状况 -->
<input type="button" id="switch" onClick="
if($('sendmode').value=='news'){
$('sendmode').value='ref';
$('chatlist').style.display='';
$('newslist').style.display='none';
$('chattitle').innerHTML='聊天讯息';
}else{
$('sendmode').value='news';
$('chatlist').style.display='none';
$('newslist').style.display='';
$('chattitle').innerHTML='进行状况';
}
chat($('sendmode').value,$chatrefresh);
return false;" value="{lang chatswitch}">
<!-- 表情 -->
<input type="button" id="embtn" value="表情">
<input type="button" id="embtn" value="{lang emoji}">
<div id="empanel" style="display:none;">
<!--{loop $emdata $em}-->
$em
......
......@@ -138,7 +138,7 @@ $language = array
'arb' => '防具',
'effect' => '攻击',
'cmd_choice' => '你想要做什么?',
'chat' => '息',
'chat' => '聊天讯息',
'moneyunit' => '元',
'wp' => '殴',
'wk' => '斩',
......@@ -154,6 +154,8 @@ $language = array
'end' => '游戏结束!',
'send' => '发送',
'refresh' => '刷新',
'emoji' => '表情',
'chatswitch' => '切换',
'maptitle' => '虚拟世界地图',
);
......
......@@ -17,7 +17,7 @@ if($command == 'info') {
init_playerdata();
init_profile();
} elseif($command == 'news') {
include GAME_ROOT.'./include/news.func.php';
//include GAME_ROOT.'./include/news.func.php';
$hnewsfile = GAME_ROOT."./gamedata/bak/{$gnum}_newsinfo.html";
if(file_exists($hnewsfile)){
$hnewsinfo = readover($hnewsfile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment