go_dreamfactory/modules/tools/module.go
2023-07-03 14:14:02 +08:00

68 lines
1.8 KiB
Go

package tools
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
func NewModule() core.IModule {
m := new(Tools)
return m
}
type Tools struct {
modules.ModuleBase
configure *MCompConfigure
}
// 模块名
func (this *Tools) GetType() core.M_Modules {
return comm.ModuleTools
}
// 模块初始化接口 注册用户创建角色事件
func (this *Tools) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
// 模块初始化接口 注册用户创建角色事件
func (this *Tools) Start() (err error) {
err = this.ModuleBase.Start()
return
}
// 装备组件
func (this *Tools) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.configure = this.RegisterComp(new(MCompConfigure)).(*MCompConfigure)
}
// 读取英雄配置
func (this *Tools) GetHeroConfig(heroCfgId string) (conf *cfg.GameHeroData, err error) {
conf, err = this.configure.GetHeroConfig(heroCfgId)
return
}
func (this *Tools) GetGroupDataByLottery(lotteryId int32, vipLv int32, lv int32) (items []*cfg.Gameatn) {
items = this.configure.GetGroupDataByLottery(lotteryId, vipLv, lv)
return
}
func (this *Tools) GetGlobalConf() *cfg.GameGlobalData {
return this.configure.GetGlobalConf()
}
func (this *Tools) GetPriceGroupCost(pricegroupId int32, purchase int32) (res []*cfg.Gameatn, err error) {
return this.configure.GetPriceGroupCost(pricegroupId, purchase)
}
func (this *Tools) GetPriceGroupLen(pricegroupId int32) (count int32, err error) {
return this.configure.GetPriceGroupLen(pricegroupId)
}
func (this *Tools) GetGrormetLlame(id string) (data int32, err error) {
return this.configure.GetGrormetLlame(id)
}