Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
phpdts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nemo Ma
phpdts
Commits
25a98503
Commit
25a98503
authored
Feb 21, 2023
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
尽量优雅的表情系统
Signed-off-by:
unknown
<
mccleaner@126.com
>
parent
99dfe841
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
11 deletions
+54
-11
chat.php
chat.php
+3
-0
game.php
game.php
+2
-1
img/emoticons/example.png
img/emoticons/example.png
+0
-0
include/game.func.php
include/game.func.php
+0
-3
include/global.func.php
include/global.func.php
+17
-0
templates/default/chat.htm
templates/default/chat.htm
+32
-7
No files found.
chat.php
View file @
25a98503
...
...
@@ -38,6 +38,9 @@ if(($sendmode == 'send')&&$chatmsg) {
if
(
!
$chatdata
)
{
$chatdata
=
getchat
(
$lastcid
,
$teamID
);
}
if
(
!
$emdata
)
{
$emdata
=
get_emdata
();
}
ob_clean
();
//$json = new Services_JSON();
//$jgamedata = $json->encode($chatdata);
...
...
game.php
View file @
25a98503
...
...
@@ -43,7 +43,8 @@ $clbpara = get_clbpara($clbpara);
$log
=
''
;
//读取聊天信息
$chatdata
=
getchat
(
0
,
$teamID
);
//读取表情信息
$emdata
=
get_emdata
();
//读取玩家互动信息
$result
=
$db
->
query
(
"SELECT lid,time,log FROM
{
$tablepre
}
log WHERE toid = '
$pid
' AND prcsd = 0 ORDER BY time,lid"
);
$llist
=
''
;
...
...
img/emoticons/example.png
0 → 100644
View file @
25a98503
5.25 KB
include/game.func.php
View file @
25a98503
...
...
@@ -640,6 +640,3 @@ function destory_corpse(&$edata)
}
return
;
}
?>
include/global.func.php
View file @
25a98503
...
...
@@ -405,11 +405,28 @@ function getchat($last,$team='',$limit=0) {
}
elseif
(
$chat
[
'type'
]
==
'5'
)
{
$msg
=
"<span class=
\"
yellow
\"
>【
{
$chatinfo
[
$chat
[
'type'
]]
}
】
{
$chat
[
'msg'
]
}
"
.
date
(
"\(H:i:s\)"
,
$chat
[
'time'
])
.
'</span><br>'
;
}
//表情
$msg
=
preg_replace
(
'/\[(\w+)\]/'
,
"<img src='img/emoticons/$1.png'>"
,
$msg
);
$chatdata
[
'msg'
][
$chat
[
'cid'
]]
=
$msg
;
}
return
$chatdata
;
}
//获取表情
function
get_emdata
()
{
global
$emdata
;
$emdir
=
'img/emoticons/'
;
$emfiles
=
glob
(
$emdir
.
'*.png'
);
$emdata
=
array
();
foreach
(
$emfiles
as
$emfile
)
{
$name
=
basename
(
$emfile
,
'.png'
);
$emdata
[]
=
"<img src='
$emdir$name
.png' alt='
$name
' onClick=
\"
insertEm('
$name
')
\"
>"
;
}
return
$emdata
;
}
function
storyputchat
(
$time
,
$type
){
global
$db
,
$tablepre
,
$now
,
$syschatinfo
,
$gamestate
,
$rdown
,
$bdown
,
$ldown
,
$kdown
;
if
(
!
$time
){
$time
=
$now
;}
...
...
templates/default/chat.htm
View file @
25a98503
...
...
@@ -17,22 +17,47 @@
<tr>
<td
class=
"b3"
height=
"35"
>
<div>
<form
type=
"post"
id=
"sendchat"
name=
"sendchat"
action=
"chat.php"
onsubmit=
"return false;"
>
<form
type=
"post"
id=
"sendchat"
name=
"sendchat"
action=
"chat.php"
onsubmit=
"return false;"
>
<input
type=
"hidden"
id=
"lastcid"
name=
"lastcid"
value=
"$chatdata['lastcid']"
>
<input
type=
"hidden"
id=
"teamID"
name=
"teamID"
value=
"$teamID"
>
<input
type=
"hidden"
id=
"sendmode"
name=
"sendmode"
value=
"ref"
>
<span
id=
"chattype"
>
<select
name=
"chattype"
value=
"2"
>
<option
value=
"0"
selected
>
$chatinfo[0]
<!--{if $teamID}-->
<option
value=
"1"
>
$chatinfo[1]
<!--{/if}-->
<!--{if $teamID}-->
<option
value=
"1"
>
$chatinfo[1]
<!--{/if}-->
</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;"
value=
"{lang send}"
>
<input
type=
"button"
id=
"ref"
onClick=
"document['sendchat']['sendmode'].value='ref';chat('ref',$chatrefresh);return false;"
value=
"{lang refresh}"
>
<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;"
value=
"{lang send}"
>
<input
type=
"button"
id=
"ref"
onClick=
"document['sendchat']['sendmode'].value='ref';chat('ref',$chatrefresh);return false;"
value=
"{lang refresh}"
>
<!-- 表情 -->
<input
type=
"button"
id=
"embtn"
value=
"表情"
>
<div
id=
"empanel"
style=
"display:none;"
>
<!--{loop $emdata $em}-->
$em
<!--{/loop}-->
</div>
</form>
<script
type=
"text/javascript"
>
chat
(
'
ref
'
,
$chatrefresh
);
</script>
<script
type=
"text/javascript"
>
chat
(
'
ref
'
,
$chatrefresh
);
</script>
</div>
</td>
</tr>
</table>
\ No newline at end of file
</table>
<!-- JavaScript 代码 -->
<script>
function
insertEm
(
em
)
{
document
.
getElementById
(
'
chatmsg
'
).
value
+=
"
[
"
+
em
+
"
]
"
;
}
document
.
getElementById
(
'
embtn
'
).
addEventListener
(
'
click
'
,
function
()
{
var
panel
=
document
.
getElementById
(
'
empanel
'
);
panel
.
style
.
display
=
(
panel
.
style
.
display
==
'
none
'
)
?
'
block
'
:
'
none
'
;
});
</script>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment