From d8b6e8b010d35fde770aaeec74355787d1f64e3a Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 27 Dec 2022 17:42:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=8A=9F=E8=83=BD=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E4=BA=8B=E4=BB=B6=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/moonfantasy/module.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/moonfantasy/module.go b/modules/moonfantasy/module.go index 51b89d4ee..c2b1faa13 100644 --- a/modules/moonfantasy/module.go +++ b/modules/moonfantasy/module.go @@ -8,6 +8,7 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/event" "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" @@ -66,6 +67,7 @@ func (this *Moonfantasy) Start() (err error) { this.battle = module.(comm.IBattle) this.service.RegisterFunctionName(string(comm.Rpc_ModuleMoonfantasyTrigger), this.Rpc_ModuleMoonfantasyTrigger) this.service.RegisterFunctionName(string(comm.Rpc_ModuleMoonfantasyTriggerMF), this.Rpc_ModuleMoonfantasyTriggerMF) + event.RegisterGO(comm.EventOpenCond, this.EventOpenCond) return } @@ -167,3 +169,29 @@ func (this *Moonfantasy) TriggerMF(session comm.IUserSession, Boosid string) (er } return } + +//功能开启事件触发 +func (this *Moonfantasy) EventOpenCond(uid string, funcIds []string) { + for _, v := range funcIds { + if v == "Mystery" { //月子秘境 + if this.IsCross() { + ss, _ := this.GetUserSession(uid) + this.modelDream.trigger(ss) + if err := ss.Push(); err != nil { + this.Errorln(err) + } + } else { + if _, err := this.service.AcrossClusterRpcGo(context.Background(), + this.GetCrossTag(), + comm.Service_Worker, + string(comm.Rpc_ModuleMoonfantasyTrigger), + pb.RPCGeneralReqA1{Param1: uid}, + nil, + ); err != nil { + this.Errorln(err) + } + } + break + } + } +}