63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
package questionnaire
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
)
|
|
|
|
type Questionnaire struct {
|
|
modules.ModuleBase
|
|
service core.IService
|
|
caravan comm.ICaravan
|
|
battle comm.IBattle
|
|
sys comm.ISys
|
|
api *apiComp
|
|
configure *configureComp
|
|
modelQuestionnaire *ModelQuestionnaire
|
|
}
|
|
|
|
func NewModule() core.IModule {
|
|
return &Questionnaire{}
|
|
}
|
|
|
|
func (this *Questionnaire) GetType() core.M_Modules {
|
|
return comm.ModuleQuestionnaire
|
|
}
|
|
|
|
func (this *Questionnaire) 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 *Questionnaire) 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)
|
|
if module, err = this.service.GetModule(comm.ModuleSys); err != nil {
|
|
return
|
|
}
|
|
this.sys = module.(comm.ISys)
|
|
if module, err = this.service.GetModule(comm.ModuleCaravan); err != nil {
|
|
return
|
|
}
|
|
this.caravan = module.(comm.ICaravan)
|
|
return
|
|
}
|
|
|
|
func (this *Questionnaire) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
this.modelQuestionnaire = this.RegisterComp(new(ModelQuestionnaire)).(*ModelQuestionnaire)
|
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
|
|
|
}
|