56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
package storyline
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/sys/db"
|
|
)
|
|
|
|
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)
|
|
this.modeltask.Add("", nil, db.SetDBMgoLog(false))
|
|
this.modeltask.DBModel.Add("", nil)
|
|
|
|
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)
|
|
}
|