go_dreamfactory/modules/guildgve/module.go
2023-07-25 18:31:45 +08:00

77 lines
2.3 KiB
Go

package guildgve
import (
"context"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
func NewModule() core.IModule {
m := new(GuildGve)
return m
}
type GuildGve struct {
modules.ModuleBase
service comm.IService
sociaty comm.ISociaty
mail comm.Imail
battle comm.IBattle
api *apiComp
modelGuildGve *ModelUniongve
modelUnionroulette *ModelUnionroulette
modelGuildMember *ModelGuildMember
modelRank *modelRank
configure *MCompConfigure
}
// 模块名
func (this *GuildGve) GetType() core.M_Modules {
return comm.ModuleGuildGve
}
// 模块初始化接口 注册用户创建角色事件
func (this *GuildGve) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(comm.IService)
return
}
func (this *GuildGve) Start() (err error) {
err = this.ModuleBase.Start()
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleSociaty); err != nil {
return
}
this.sociaty = module.(comm.ISociaty)
if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
return
}
this.mail = module.(comm.Imail)
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
return
}
this.battle = module.(comm.IBattle)
this.service.RegisterFunctionName(string(comm.Rpc_ModuleGuildBossSettlement), this.Rpc_ModuleGuildBossSettlement)
return
}
// 装备组件
func (this *GuildGve) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(MCompConfigure)).(*MCompConfigure)
this.modelGuildGve = this.RegisterComp(new(ModelUniongve)).(*ModelUniongve)
this.modelGuildMember = this.RegisterComp(new(ModelGuildMember)).(*ModelGuildMember)
this.modelUnionroulette = this.RegisterComp(new(ModelUnionroulette)).(*ModelUnionroulette)
this.modelRank = this.RegisterComp(new(modelRank)).(*modelRank)
}
// 工会Boos战结算通知
func (this *GuildGve) Rpc_ModuleGuildBossSettlement(ctx context.Context, req *pb.EmptyReq, resp interface{}) (err error) {
this.Debug("Rpc_ModuleGuildBossSettlement 工会Boos战结算通知 !")
this.modelRank.raceSettlement()
return
}