This commit is contained in:
meixiongfeng 2023-10-10 14:37:52 +08:00
parent f2fd4ebb63
commit d42497f2ea

View File

@ -24,10 +24,9 @@ const (
// /配置管理基础组件 // /配置管理基础组件
type configureComp struct { type configureComp struct {
modules.MCompConfigure modules.MCompConfigure
module *Caravan module *Caravan
lock sync.RWMutex lock sync.RWMutex
event map[int32][]*cfg.GameCaravanEventData event map[int32][]*cfg.GameCaravanEventData
overflow int32
} }
// 组件初始化接口 // 组件初始化接口
@ -50,16 +49,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
} }
this.lock.Unlock() this.lock.Unlock()
}) })
configure.RegisterConfigure(game_caravan_reward, cfg.NewGameCaravanReward, func() {
if v, err := this.GetConfigure(game_caravan_reward); err == nil {
for _, v := range v.(*cfg.GameCaravanReward).GetDataList() {
if v.Key < 0 {
this.overflow = v.Id
return
}
}
}
})
return return
} }
@ -229,12 +218,14 @@ func (this *configureComp) GetCaravanMoreReward() (reward *cfg.GameCaravanReward
) )
if v, err = this.GetConfigure(game_caravan_reward); err == nil { if v, err = this.GetConfigure(game_caravan_reward); err == nil {
if configure, ok := v.(*cfg.GameCaravanReward); ok { if configure, ok := v.(*cfg.GameCaravanReward); ok {
if reward = configure.Get(this.overflow); err == nil { for _, reward = range configure.GetDataList() {
return if reward.Key < 0 {
return
}
} }
} }
} }
err = comm.NewNotFoundConfErr(moduleName, game_caravan_reward, this.overflow) err = comm.NewNotFoundConfErr(moduleName, game_caravan_reward, "")
return return
} }