go_dreamfactory/modules/uniongve/module.go
2023-07-18 17:02:26 +08:00

61 lines
1.5 KiB
Go

package uniongve
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
func NewModule() core.IModule {
m := new(UnionGve)
return m
}
type UnionGve struct {
modules.ModuleBase
service core.IService
sociaty comm.ISociaty
mail comm.Imail
battle comm.IBattle
api *apiComp
modelUniongve *ModelUniongve
configure *MCompConfigure
}
// 模块名
func (this *UnionGve) GetType() core.M_Modules {
return comm.ModuleUnionGve
}
// 模块初始化接口 注册用户创建角色事件
func (this *UnionGve) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service
return
}
func (this *UnionGve) 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)
return
}
// 装备组件
func (this *UnionGve) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(MCompConfigure)).(*MCompConfigure)
this.modelUniongve = this.RegisterComp(new(ModelUniongve)).(*ModelUniongve)
}