go_dreamfactory/modules/storyline/module.go

52 lines
1.2 KiB
Go

package storyline
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
type StoryLine struct {
modules.ModuleBase
service core.IService
api *apiComp
configure *configureComp
modeltask *Modeltask
battle comm.IBattle
}
func NewModule() core.IModule {
return &StoryLine{}
}
func (this *StoryLine) GetType() core.M_Modules {
return comm.ModuleStoryLine
}
func (this *StoryLine) 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
return
}
func (this *StoryLine) Start() (err error) {
if err = this.ModuleBase.Start(); err != nil {
return
}
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
return
}
this.battle = module.(comm.IBattle)
return
}
func (this *StoryLine) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modeltask = this.RegisterComp(new(Modeltask)).(*Modeltask)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}