64 lines
1.5 KiB
Go
64 lines
1.5 KiB
Go
package autoBattle
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
type AutoBattle struct {
|
|
modules.ModuleBase
|
|
modelAutoBattle *modelAutoBattle
|
|
api *apiComp
|
|
configure *configureComp
|
|
battle comm.IBattle
|
|
service core.IService
|
|
}
|
|
|
|
func NewModule() core.IModule {
|
|
return &AutoBattle{}
|
|
}
|
|
|
|
func (this *AutoBattle) GetType() core.M_Modules {
|
|
return comm.ModuleHunting
|
|
}
|
|
|
|
func (this *AutoBattle) 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 *AutoBattle) 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
|
|
}
|
|
|
|
func (this *AutoBattle) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
|
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
|
}
|
|
|
|
// 接口信息
|
|
func (this *AutoBattle) ModifyAutoData(uid string, id string, data map[string]interface{}) (code pb.ErrorCode) {
|
|
err := this.modelAutoBattle.modifyAutoBattleDataByObjId(uid, id, data)
|
|
if err != nil {
|
|
code = pb.ErrorCode_DBError
|
|
}
|
|
return
|
|
}
|
|
|
|
func (this *AutoBattle) CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) {
|
|
|
|
return
|
|
}
|