Commit c52b8623 authored by Nemo Ma's avatar Nemo Ma Committed by GitHub

Merge pull request #133 from hikawiier/waaagh

Update in-game newsinfo
parents f01f4d15 3697e24a
...@@ -369,6 +369,19 @@ word-break:break-all; ...@@ -369,6 +369,19 @@ word-break:break-all;
overflow:auto; overflow:auto;
position:relative; 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{ #sendchat{
MARGIN: 0px; MARGIN: 0px;
padding:0px; padding:0px;
......
...@@ -44,6 +44,7 @@ unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect); ...@@ -44,6 +44,7 @@ unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
require GAME_ROOT.'./gamedata/system.php'; require GAME_ROOT.'./gamedata/system.php';
require GAME_ROOT.'./include/init.func.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/resources.func.php';
require GAME_ROOT.'./include/roommng.func.php'; require GAME_ROOT.'./include/roommng.func.php';
require GAME_ROOT.'./include/game/revclubskills.func.php'; require GAME_ROOT.'./include/game/revclubskills.func.php';
......
...@@ -375,7 +375,8 @@ function chat(mode,reftime) { ...@@ -375,7 +375,8 @@ function chat(mode,reftime) {
clearTimeout(refchat); clearTimeout(refchat);
var oXmlHttp = zXmlHttp.createRequest(); var oXmlHttp = zXmlHttp.createRequest();
var sBody = getRequestBody(document.forms['sendchat']); 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.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
oXmlHttp.onreadystatechange = function () { oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) { if (oXmlHttp.readyState == 4) {
...@@ -389,7 +390,8 @@ function chat(mode,reftime) { ...@@ -389,7 +390,8 @@ function chat(mode,reftime) {
oXmlHttp.send(sBody); oXmlHttp.send(sBody);
if(mode == 'send'){$('chatmsg').value = '';$('sendmode').value = 'ref';} if(mode == 'send'){$('chatmsg').value = '';$('sendmode').value = 'ref';}
rtime = reftime; 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) { ...@@ -403,9 +405,12 @@ function showChatdata(jsonchat) {
newchat += chatdata['msg'][cid]; newchat += chatdata['msg'][cid];
} }
$('chatlist').innerHTML = newchat + $('chatlist').innerHTML; $('chatlist').innerHTML = newchat + $('chatlist').innerHTML;
} }else{
$('newslist').innerHTML = jsonchat;
}
} }
function openShutManager(oSourceObj,oTargetObj,shutAble,oOpenTip,oShutTip){ function openShutManager(oSourceObj,oTargetObj,shutAble,oOpenTip,oShutTip){
var sourceObj = typeof oSourceObj == "string" ? document.getElementById(oSourceObj) : oSourceObj; var sourceObj = typeof oSourceObj == "string" ? document.getElementById(oSourceObj) : oSourceObj;
var targetObj = typeof oTargetObj == "string" ? document.getElementById(oTargetObj) : oTargetObj; var targetObj = typeof oTargetObj == "string" ? document.getElementById(oTargetObj) : oTargetObj;
......
...@@ -6,7 +6,7 @@ require './include/common.inc.php'; ...@@ -6,7 +6,7 @@ require './include/common.inc.php';
require './include/game.func.php'; require './include/game.func.php';
//$t_s=getmicrotime(); //$t_s=getmicrotime();
//require_once GAME_ROOT.'./include/JSON.php'; //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'; //include_once GAME_ROOT.'./include/system.func.php';
/* /*
...@@ -23,7 +23,15 @@ $last_newsinfo = nparse_news(0,50); ...@@ -23,7 +23,15 @@ $last_newsinfo = nparse_news(0,50);
if(!isset($newsmode)){$newsmode = '';} 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; echo $last_newsinfo;
$newsdata['innerHTML']['newsinfo'] = ob_get_contents(); $newsdata['innerHTML']['newsinfo'] = ob_get_contents();
if(isset($error)){$newsdata['innerHTML']['error'] = $error;} if(isset($error)){$newsdata['innerHTML']['error'] = $error;}
......
<table id="chat" border="0" width="720" cellspacing="0" cellpadding="0" style="valign:top"> <table id="chat" border="0" width="720" cellspacing="0" cellpadding="0" style="valign:top">
<tr> <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>
<tr> <tr>
<td valign="top" class="b3" style="text-align: left" height="1px"> <td valign="top" class="b3" style="text-align: left" height="1px">
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
$msg $msg
<!--{/loop}--> <!--{/loop}-->
</div> </div>
<div id="newslist" style="display:none" class="newslist">
<!--{eval $chat_news = nparse_news(0,$newslimit);}-->
$chat_news
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -30,14 +34,39 @@ ...@@ -30,14 +34,39 @@
</select> </select>
</span> </span>
<input type="text" id="chatmsg" name="chatmsg" maxlength="60"> <input type="text" id="chatmsg" name="chatmsg" maxlength="60">
<input type="button" id="send" <input type="button" id="send" onClick="
onClick="document['sendchat']['sendmode'].value='send';chat('send',$chatrefresh);return false;" if($('sendmode').value=='ref')
{
document['sendchat']['sendmode'].value='send';
chat('send',$chatrefresh);
}
return false;"
value="{lang send}"> value="{lang send}">
<input type="button" id="ref" <input type="button" id="ref" onClick="
onClick="document['sendchat']['sendmode'].value='ref';chat('ref',$chatrefresh);return false;" if($('sendmode').value=='news'){
chat('news',$chatrefresh);
}else{
document['sendchat']['sendmode'].value='ref';chat('ref',$chatrefresh);
}
return false;"
value="{lang refresh}"> 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;"> <div id="empanel" style="display:none;">
<!--{loop $emdata $em}--> <!--{loop $emdata $em}-->
$em $em
......
...@@ -138,7 +138,7 @@ $language = array ...@@ -138,7 +138,7 @@ $language = array
'arb' => '防具', 'arb' => '防具',
'effect' => '攻击', 'effect' => '攻击',
'cmd_choice' => '你想要做什么?', 'cmd_choice' => '你想要做什么?',
'chat' => '息', 'chat' => '聊天讯息',
'moneyunit' => '元', 'moneyunit' => '元',
'wp' => '殴', 'wp' => '殴',
'wk' => '斩', 'wk' => '斩',
...@@ -154,6 +154,8 @@ $language = array ...@@ -154,6 +154,8 @@ $language = array
'end' => '游戏结束!', 'end' => '游戏结束!',
'send' => '发送', 'send' => '发送',
'refresh' => '刷新', 'refresh' => '刷新',
'emoji' => '表情',
'chatswitch' => '切换',
'maptitle' => '虚拟世界地图', 'maptitle' => '虚拟世界地图',
); );
......
...@@ -17,7 +17,7 @@ if($command == 'info') { ...@@ -17,7 +17,7 @@ if($command == 'info') {
init_playerdata(); init_playerdata();
init_profile(); init_profile();
} elseif($command == 'news') { } 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"; $hnewsfile = GAME_ROOT."./gamedata/bak/{$gnum}_newsinfo.html";
if(file_exists($hnewsfile)){ if(file_exists($hnewsfile)){
$hnewsinfo = readover($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