no message

This commit is contained in:
sk 2024-10-09 17:51:38 +08:00
parent 373dd36b31
commit e38523c745
1 changed files with 19 additions and 61 deletions

View File

@ -1,29 +1,21 @@
package main
import (
"mongo.games.com/game/common"
"mongo.games.com/game/model"
"mongo.games.com/game/proto"
"mongo.games.com/game/protocol/chat"
"time"
"mongo.games.com/goserver/core/basic"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/task"
"time"
"mongo.games.com/game/common"
"mongo.games.com/game/model"
"mongo.games.com/game/proto"
"mongo.games.com/game/protocol/chat"
)
// 用户发送消息
type CSChatMsgPacketFactory struct {
}
type CSChatMsgHandler struct {
}
func (this *CSChatMsgPacketFactory) CreatePacket() interface{} {
pack := &chat.CSChatMsg{}
return pack
}
func (this *CSChatMsgHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
// CSChatMsgHandler 用户发送消息
func CSChatMsgHandler(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSChatMsgHandler Process recv ", data)
if msg, ok := data.(*chat.CSChatMsg); ok {
p := PlayerMgrSington.GetPlayer(sid)
@ -105,18 +97,8 @@ func (this *CSChatMsgHandler) Process(s *netlib.Session, packetid int, data inte
return nil
}
// 聊天记录
type CSGetChatLogPacketFactory struct {
}
type CSGetChatLogHandler struct {
}
func (this *CSGetChatLogPacketFactory) CreatePacket() interface{} {
pack := &chat.CSGetChatLog{}
return pack
}
func (this *CSGetChatLogHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
// CSGetChatLogHandler 聊天记录
func CSGetChatLogHandler(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSGetChatLogHandler Process recv ", data)
if msg, ok := data.(*chat.CSGetChatLog); ok {
p := PlayerMgrSington.GetPlayer(sid)
@ -273,18 +255,8 @@ func (this *CSGetChatLogHandler) Process(s *netlib.Session, packetid int, data i
return nil
}
// 读消息
type CSReadChatMsgPacketFactory struct {
}
type CSReadChatMsgHandler struct {
}
func (this *CSReadChatMsgPacketFactory) CreatePacket() interface{} {
pack := &chat.CSReadChatMsg{}
return pack
}
func (this *CSReadChatMsgHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
// CSReadChatMsgHandler 读消息
func CSReadChatMsgHandler(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSReadChatMsgHandler Process recv ", data)
if msg, ok := data.(*chat.CSReadChatMsg); ok {
p := PlayerMgrSington.GetPlayer(sid)
@ -306,18 +278,8 @@ func (this *CSReadChatMsgHandler) Process(s *netlib.Session, packetid int, data
return nil
}
// 屏蔽
type CSShieldMsgPacketFactory struct {
}
type CSShieldMsgHandler struct {
}
func (this *CSShieldMsgPacketFactory) CreatePacket() interface{} {
pack := &chat.CSShieldMsg{}
return pack
}
func (this *CSShieldMsgHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
// CSShieldMsgHandler 屏蔽
func CSShieldMsgHandler(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSShieldMsgHandler Process recv ", data)
if msg, ok := data.(*chat.CSShieldMsg); ok {
p := PlayerMgrSington.GetPlayer(sid)
@ -365,15 +327,11 @@ func (this *CSShieldMsgHandler) Process(s *netlib.Session, packetid int, data in
func init() {
//聊天消息
common.RegisterHandler(int(chat.ChatPacketID_PACKET_CSChatMsg), &CSChatMsgHandler{})
netlib.RegisterFactory(int(chat.ChatPacketID_PACKET_CSChatMsg), &CSChatMsgPacketFactory{})
common.Register(int(chat.ChatPacketID_PACKET_SCChatMsg), &chat.CSChatMsg{}, CSChatMsgHandler)
//聊天记录
common.RegisterHandler(int(chat.ChatPacketID_PACKET_CSGetChatLog), &CSGetChatLogHandler{})
netlib.RegisterFactory(int(chat.ChatPacketID_PACKET_CSGetChatLog), &CSGetChatLogPacketFactory{})
common.Register(int(chat.ChatPacketID_PACKET_CSGetChatLog), &chat.CSGetChatLog{}, CSGetChatLogHandler)
//读消息
common.RegisterHandler(int(chat.ChatPacketID_PACKET_CSReadChatMsg), &CSReadChatMsgHandler{})
netlib.RegisterFactory(int(chat.ChatPacketID_PACKET_CSReadChatMsg), &CSReadChatMsgPacketFactory{})
common.Register(int(chat.ChatPacketID_PACKET_CSReadChatMsg), &chat.CSReadChatMsg{}, CSReadChatMsgHandler)
//屏蔽玩家
common.RegisterHandler(int(chat.ChatPacketID_PACKET_CSShieldMsg), &CSShieldMsgHandler{})
netlib.RegisterFactory(int(chat.ChatPacketID_PACKET_CSShieldMsg), &CSShieldMsgPacketFactory{})
common.Register(int(chat.ChatPacketID_PACKET_SCShieldMsg), &chat.SCShieldMsg{}, CSShieldMsgHandler)
}