go_dreamfactory/modules/horoscope/module.go
2022-11-24 14:10:04 +08:00

73 lines
1.8 KiB
Go

package horoscope
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
/*
模块名:星座图
描述:全局属性增幅器
开发:李伟
*/
func NewModule() core.IModule {
m := new(Horoscope)
return m
}
type Horoscope struct {
modules.ModuleBase
service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口
options *Options
api_comp *apiComp
configure *configureComp
modelHoroscope *modelHoroscope
}
//模块名
func (this *Horoscope) GetType() core.M_Modules {
return comm.ModuleHoroscope
}
//模块初始化接口 注册用户创建角色事件
func (this *Horoscope) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService)
return
}
func (this *Horoscope) Start() (err error) {
err = this.ModuleBase.Start()
return
}
//装备组件
func (this *Horoscope) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
this.modelHoroscope = this.RegisterComp(new(modelHoroscope)).(*modelHoroscope)
}
//计算英雄数值
func (this *Horoscope) ComputeHeroNumeric(uid string, hero ...*pb.DBHero) {
this.modelHoroscope.computeHeroNumeric(uid, hero...)
return
}
//红点需求
func (this *Horoscope) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (result map[comm.ReddotType]bool) {
result = make(map[comm.ReddotType]bool)
for _, v := range rid {
switch v {
case comm.Reddot17:
result[comm.Reddot17] = this.modelHoroscope.reddot(session)
break
}
}
return
}