增加注释

This commit is contained in:
wnp 2022-06-29 17:34:11 +08:00
parent 7670cb6505
commit 0ca5037497
3 changed files with 12 additions and 12 deletions

View File

@ -30,12 +30,12 @@ func (this *AgentMgrComp) Init(service core.IService, module core.IModule, comp
return
}
//加入新的用户
// Connect 加入新的用户
func (this *AgentMgrComp) Connect(a IAgent) {
this.agents.Store(a.SessionId(), a)
}
//移除断开的用户
// DisConnect 移除断开的用户
func (this *AgentMgrComp) DisConnect(a IAgent) {
this.agents.Delete(a.SessionId())
if a.UserId() != "" { //登录用户 通知业务服务处理玩家离线相关
@ -49,7 +49,7 @@ func (this *AgentMgrComp) DisConnect(a IAgent) {
}
}
//用户登录绑定Id
// Bind 用户绑定Id
func (this *AgentMgrComp) Bind(ctx context.Context, args *pb.AgentBuildReq, reply *pb.RPCMessageReply) error {
if a, ok := this.agents.Load(args.UserSessionId); ok {
a.(IAgent).Bind(args.UserId, args.WorkerId)
@ -60,7 +60,7 @@ func (this *AgentMgrComp) Bind(ctx context.Context, args *pb.AgentBuildReq, repl
return nil
}
//用户登录解绑Id
// UnBind 用户解绑Id
func (this *AgentMgrComp) UnBind(ctx context.Context, args *pb.AgentUnBuildReq, reply *pb.RPCMessageReply) error {
if a, ok := this.agents.Load(args.UserSessionId); ok {
a.(IAgent).UnBind()
@ -71,7 +71,7 @@ func (this *AgentMgrComp) UnBind(ctx context.Context, args *pb.AgentUnBuildReq,
return nil
}
//向用户发送消息
// SendMsgToAgent 向用户发送消息
func (this *AgentMgrComp) SendMsgToAgent(ctx context.Context, args *pb.AgentSendMessageReq, reply *pb.RPCMessageReply) error {
if a, ok := this.agents.Load(args.UserSessionId); ok {
a.(IAgent).WriteMsg(&pb.UserMessage{
@ -86,7 +86,7 @@ func (this *AgentMgrComp) SendMsgToAgent(ctx context.Context, args *pb.AgentSend
return nil
}
//向多个户发送消息
// SendMsgToAgents 向多个户发送消息
func (this *AgentMgrComp) SendMsgToAgents(ctx context.Context, args *pb.BatchMessageReq, reply *pb.RPCMessageReply) error {
msg := &pb.UserMessage{
MainType: args.MainType,
@ -101,7 +101,7 @@ func (this *AgentMgrComp) SendMsgToAgents(ctx context.Context, args *pb.BatchMes
return nil
}
//向所有户发送消息
// SendMsgToAllAgent 向所有户发送消息
func (this *AgentMgrComp) SendMsgToAllAgent(ctx context.Context, args *pb.BroadCastMessageReq, reply *pb.RPCMessageReply) error {
msg := &pb.UserMessage{
MainType: args.MainType,
@ -115,7 +115,7 @@ func (this *AgentMgrComp) SendMsgToAllAgent(ctx context.Context, args *pb.BroadC
return nil
}
//关闭代理
// CloseAgent 关闭某个用户
func (this *AgentMgrComp) CloseAgent(ctx context.Context, args *pb.AgentCloseeReq, reply *pb.RPCMessageReply) error {
if a, ok := this.agents.Load(args.UserSessionId); ok {
a.(IAgent).Close()

View File

@ -16,14 +16,14 @@ type configureComp struct {
modules.MCompConfigure
}
//组件初始化接口
// Init 组件初始化接口
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.ModuleCompBase.Init(service, module, comp, options)
this.LoadConfigure(game_msgdistrib, cfg.NewGame_msgDistrib)
return
}
//获取消息分发规则读取配置表
// GetMsgDistribute 获取消息分发规则读取配置表
func (this *configureComp) GetMsgDistribute(mtype, stype string) (rule string, ok bool) {
var (
err error

View File

@ -8,7 +8,7 @@ import (
)
type (
//用户代理对象接口定义
// IAgent 用户代理对象接口定义
IAgent interface {
SessionId() string
IP() string
@ -19,7 +19,7 @@ type (
WriteMsg(msg *pb.UserMessage) (err error)
Close() //主动关闭接口
}
//网关模块 接口定义
// IGateway 网关模块 接口定义
IGateway interface {
core.IModule
Service() base.IRPCXService