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