go_dreamfactory/modules/academy/module.go
2023-05-26 12:10:36 +08:00

61 lines
1.4 KiB
Go

package academy
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
const moduleName = "联盟学院"
/*
模块名:联盟学院
描述:新手训练营
开发:李伟
*/
func NewModule() core.IModule {
m := new(Academy)
return m
}
type Academy struct {
modules.ModuleBase
service base.IRPCXService
battle comm.IBattle
api_comp *apiComp
configure *configureComp
modelAcademy *modelAcademyComp
}
//模块名
func (this *Academy) GetType() core.M_Modules {
return comm.ModuleAcademy
}
//模块初始化接口 注册用户创建角色事件
func (this *Academy) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService)
return
}
func (this *Academy) Start() (err error) {
err = this.ModuleBase.Start()
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
return
}
this.battle = module.(comm.IBattle)
return
}
//装备组件
func (this *Academy) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelAcademy = this.RegisterComp(new(modelAcademyComp)).(*modelAcademyComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}