79 lines
1.9 KiB
Go
79 lines
1.9 KiB
Go
package plunder
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
)
|
|
|
|
func NewModule() core.IModule {
|
|
m := new(Plunder)
|
|
return m
|
|
}
|
|
|
|
/*
|
|
模块名称:猜颜色
|
|
*/
|
|
type Plunder struct {
|
|
modules.ModuleBase
|
|
service comm.IService
|
|
api *apiComp
|
|
configure *configureComp
|
|
modelPlunder *modelPlunder
|
|
modelLand *modelLand
|
|
battle comm.IBattle
|
|
modelRecord *modelRecord
|
|
battlerecord comm.IBattleRecord // 战报模块
|
|
mail comm.Imail
|
|
}
|
|
|
|
// 模块名
|
|
func (this *Plunder) GetType() core.M_Modules {
|
|
return comm.ModulePlunder
|
|
}
|
|
|
|
// 模块初始化接口
|
|
func (this *Plunder) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
|
err = this.ModuleBase.Init(service, module, options)
|
|
this.service = service.(comm.IService)
|
|
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
|
|
return
|
|
}
|
|
|
|
this.battle = module.(comm.IBattle)
|
|
|
|
return
|
|
}
|
|
|
|
func (this *Plunder) Start() (err error) {
|
|
if err = this.ModuleBase.Start(); err != nil {
|
|
return
|
|
}
|
|
var module core.IModule
|
|
if module, err = this.service.GetModule(comm.ModuleBattleRecord); err != nil {
|
|
return
|
|
}
|
|
this.battlerecord = module.(comm.IBattleRecord)
|
|
|
|
if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
|
|
return
|
|
}
|
|
this.mail = module.(comm.Imail)
|
|
return
|
|
}
|
|
|
|
func (this *Plunder) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
|
this.modelPlunder = this.RegisterComp(new(modelPlunder)).(*modelPlunder)
|
|
this.modelLand = this.RegisterComp(new(modelLand)).(*modelLand)
|
|
this.modelRecord = this.RegisterComp(new(modelRecord)).(*modelRecord)
|
|
this.modelRecord = this.RegisterComp(new(modelRecord)).(*modelRecord)
|
|
}
|
|
|
|
//初始化用户掠夺信息
|
|
func (this *Plunder) InitPlunderByUser(session comm.IUserSession) {
|
|
this.modelPlunder.getPlunderData(session)
|
|
}
|