72 lines
1.7 KiB
Go
72 lines
1.7 KiB
Go
package enchant
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
)
|
|
|
|
type Enchant struct {
|
|
modules.ModuleBase
|
|
modelEnchant *modelEnchant
|
|
api *apiComp
|
|
configure *configureComp
|
|
modelRank *ModelRank
|
|
battle comm.IBattle
|
|
service core.IService
|
|
battlerecord comm.IBattleRecord // 战报模块
|
|
}
|
|
|
|
func NewModule() core.IModule {
|
|
return &Enchant{}
|
|
}
|
|
|
|
func (this *Enchant) GetType() core.M_Modules {
|
|
return comm.ModuleEnchant
|
|
}
|
|
|
|
func (this *Enchant) 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 *Enchant) 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.ModuleBattleRecord); err != nil {
|
|
return
|
|
}
|
|
this.battlerecord = module.(comm.IBattleRecord)
|
|
return
|
|
}
|
|
|
|
func (this *Enchant) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
this.modelEnchant = this.RegisterComp(new(modelEnchant)).(*modelEnchant)
|
|
this.modelRank = this.RegisterComp(new(ModelRank)).(*ModelRank)
|
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
|
}
|
|
|
|
func (this *Enchant) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
|
|
reddot = make(map[comm.ReddotType]bool)
|
|
for _, v := range rid {
|
|
switch v {
|
|
case comm.Reddot33:
|
|
reddot[comm.Reddot33] = this.modelEnchant.checkReddot33(session)
|
|
break
|
|
}
|
|
}
|
|
return
|
|
}
|