From 0ca503749757556138d05f70d507ec75fc80bc23 Mon Sep 17 00:00:00 2001 From: wnp Date: Wed, 29 Jun 2022 17:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gateway/agentmgr_comp.go | 16 ++++++++-------- modules/gateway/configure_comp.go | 4 ++-- modules/gateway/core.go | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/gateway/agentmgr_comp.go b/modules/gateway/agentmgr_comp.go index 1bc209aaf..d9a487132 100644 --- a/modules/gateway/agentmgr_comp.go +++ b/modules/gateway/agentmgr_comp.go @@ -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() diff --git a/modules/gateway/configure_comp.go b/modules/gateway/configure_comp.go index 8b155e9bc..2136dd29e 100644 --- a/modules/gateway/configure_comp.go +++ b/modules/gateway/configure_comp.go @@ -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 diff --git a/modules/gateway/core.go b/modules/gateway/core.go index 7159211ea..7fd4749a6 100644 --- a/modules/gateway/core.go +++ b/modules/gateway/core.go @@ -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