This commit is contained in:
aozhiwei 2024-02-17 20:06:37 +08:00
parent 81cba8aa6e
commit 296d4c547a
4 changed files with 15 additions and 5 deletions

View File

@ -10,7 +10,6 @@ import (
)
type ChatMgr struct {
fm *FriendsMgr
gm *GuildMgr
worldMsgRec *ChatMsgRec
@ -23,7 +22,7 @@ type ChatMgr struct {
//tmpMsgId uint64
}
func NewChatMgr(fm *FriendsMgr, gm *GuildMgr) *ChatMgr {
func NewChatMgr(gm *GuildMgr) *ChatMgr {
cm := &ChatMgr{
gm: gm,
worldMsgRec: &ChatMsgRec{},
@ -161,7 +160,7 @@ func (cm *ChatMgr) ProcPrivateChat(p common.Player, msg *cs.CMSendChatMsg) {
}
// 确定是否好友
targetAccount := cm.fm.GetFriendByAccountId(p.GetAccountId(), targetAccountId)
targetAccount := GetFriendMgr().GetFriendByAccountId(p.GetAccountId(), targetAccountId)
if targetAccount == nil {
return
}

View File

@ -49,3 +49,10 @@ type PlayerMgr interface {
OnSocketClose(f5.WspCliConn)
GetPlayers() map[string]Player
}
type User interface {
}
type FriendMgr interface {
GetFriendByAccountId(account1Id, account2Id string) *User
}

View File

@ -1,9 +1,8 @@
package main
var handlerMgr = new(HandlerMgr)
var friendMgr = new(FriendsMgr)
var cacheMgr = new(CacheMgr)
// var guildMgr = new(GuildMgr)
var guildMgr = NewGuildMgr()
var chatMgr = NewChatMgr(friendMgr, guildMgr)
var chatMgr = NewChatMgr(guildMgr)

View File

@ -19,11 +19,16 @@ var initOrders = []int32 {
var app common.App
var playerMgr common.PlayerMgr
var wspListener common.WspListener
var friendMgr common.FriendMgr
func GetPlayerMgr() common.PlayerMgr {
return playerMgr
}
func GetFriendMgr() common.FriendMgr {
return friendMgr
}
func GetWspListener() common.WspListener {
return wspListener
}