45 lines
991 B
Go
45 lines
991 B
Go
package gateway
|
|
|
|
import (
|
|
"go_dreamfactory/modules"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
|
|
"go_dreamfactory/lego/core"
|
|
)
|
|
|
|
const (
|
|
game_msgdistrib = "game_msgdistrib.json"
|
|
)
|
|
|
|
///背包配置管理组件
|
|
type configureComp struct {
|
|
modules.MCompConfigure
|
|
}
|
|
|
|
//组件初始化接口
|
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
|
this.ModuleCompBase.Init(service, module, comp, options)
|
|
this.LoadConfigure(game_msgdistrib, cfg.NewGame_msgDistrib)
|
|
return
|
|
}
|
|
|
|
//获取消息分发规则读取配置表
|
|
func (this *configureComp) GetMsgDistribute(mtype, stype string) (rule string, ok bool) {
|
|
var (
|
|
err error
|
|
v interface{}
|
|
)
|
|
if v, err = this.GetConfigure(game_msgdistrib); err != nil {
|
|
return
|
|
} else {
|
|
for _, v := range v.(*cfg.Game_msgDistrib).GetDataMap() {
|
|
if v.Mtype == mtype && v.Stype == stype {
|
|
rule = v.Routrules
|
|
ok = true
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|