go_dreamfactory/modules/island/module.go
2023-11-20 15:39:19 +08:00

66 lines
1.5 KiB
Go

package island
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
/*
模块名:Pack
描述:背包系统模块
开发:李伟
*/
func NewModule() core.IModule {
m := new(IsLand)
return m
}
type IsLand struct {
modules.ModuleBase
service base.IRPCXService
hero comm.IHero
battle comm.IBattle
api *apiComp
model *modelComp
modelhero *modelHeroComp
configure *ConfigureComp
}
func (this *IsLand) GetType() core.M_Modules {
return comm.ModuleIsLand
}
func (this *IsLand) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
if err = this.ModuleBase.Init(service, module, options); err != nil {
return
}
this.service = service.(comm.IService)
return
}
func (this *IsLand) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.model = this.RegisterComp(new(modelComp)).(*modelComp)
this.modelhero = this.RegisterComp(new(modelHeroComp)).(*modelHeroComp)
this.configure = this.RegisterComp(new(ConfigureComp)).(*ConfigureComp)
}
func (this *IsLand) Start() (err error) {
if err = this.ModuleBase.Start(); err != nil {
return
}
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleHero); err != nil {
return
}
this.hero = module.(comm.IHero)
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
return
}
this.battle = module.(comm.IBattle)
return
}