65 lines
1.5 KiB
Go
65 lines
1.5 KiB
Go
/*
|
|
模块名:viking
|
|
描述:维京远征
|
|
开发:梅雄风
|
|
*/
|
|
package viking
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
type Viking struct {
|
|
modules.ModuleBase
|
|
modelViking *modelViking
|
|
api *apiComp
|
|
configure *configureComp
|
|
modulerank *ModelRank
|
|
battle comm.IBattle
|
|
service core.IService
|
|
}
|
|
|
|
func NewModule() core.IModule {
|
|
return &Viking{}
|
|
}
|
|
|
|
func (this *Viking) GetType() core.M_Modules {
|
|
return comm.ModuleViking
|
|
}
|
|
|
|
func (this *Viking) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
|
err = this.ModuleBase.Init(service, module, options)
|
|
this.service = service
|
|
return
|
|
}
|
|
|
|
func (this *Viking) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
this.modelViking = this.RegisterComp(new(modelViking)).(*modelViking)
|
|
this.modulerank = this.RegisterComp(new(ModelRank)).(*ModelRank)
|
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
|
}
|
|
|
|
// 接口信息
|
|
func (this *Viking) ModifyVikingData(uid string, data map[string]interface{}) (code pb.ErrorCode) {
|
|
err := this.modelViking.modifyVikingDataByObjId(uid, data)
|
|
if err != nil {
|
|
code = pb.ErrorCode_DBError
|
|
}
|
|
return
|
|
}
|
|
func (this *Viking) 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
|
|
}
|