初始养成数据
This commit is contained in:
parent
3447e7ac63
commit
c86bf2c37a
@ -24,12 +24,13 @@ const (
|
|||||||
// /配置管理组件
|
// /配置管理组件
|
||||||
type configureComp struct {
|
type configureComp struct {
|
||||||
modules.MCompConfigure
|
modules.MCompConfigure
|
||||||
module *Dragon
|
module *Dragon
|
||||||
hlock sync.RWMutex
|
hlock sync.RWMutex
|
||||||
dragon map[string]*cfg.GameTrainlvData
|
dragon map[string]*cfg.GameTrainlvData
|
||||||
play map[string]*cfg.GameDragonPlayData
|
play map[string]*cfg.GameDragonPlayData
|
||||||
mount map[string]*cfg.GameBuzkashiMountData
|
mount map[string]*cfg.GameBuzkashiMountData
|
||||||
lvItem map[string]*cfg.GameDragonLvItemData
|
lvItem map[string]*cfg.GameDragonLvItemData
|
||||||
|
attribute map[string]struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组件初始化接口
|
// 组件初始化接口
|
||||||
@ -153,10 +154,14 @@ func (this *configureComp) LoadDragonLvItem() {
|
|||||||
if v, err := this.GetConfigure(game_dragonlvitem); err == nil {
|
if v, err := this.GetConfigure(game_dragonlvitem); err == nil {
|
||||||
this.hlock.Lock()
|
this.hlock.Lock()
|
||||||
defer this.hlock.Unlock()
|
defer this.hlock.Unlock()
|
||||||
|
this.attribute = make(map[string]struct{}, 0)
|
||||||
this.lvItem = make(map[string]*cfg.GameDragonLvItemData)
|
this.lvItem = make(map[string]*cfg.GameDragonLvItemData)
|
||||||
if _configure, ok := v.(*cfg.GameDragonLvItem); ok {
|
if _configure, ok := v.(*cfg.GameDragonLvItem); ok {
|
||||||
for _, v := range _configure.GetDataList() {
|
for _, v := range _configure.GetDataList() {
|
||||||
this.lvItem[v.Attribute+"-"+strconv.Itoa(int(v.Lv))] = v
|
this.lvItem[v.Attribute+"-"+strconv.Itoa(int(v.Lv))] = v
|
||||||
|
if _, ok := this.attribute[v.Attribute]; !ok {
|
||||||
|
this.attribute[v.Attribute] = struct{}{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -176,3 +181,10 @@ func (this *configureComp) GetDragonLvItemConf(attribute string, lv int32) (conf
|
|||||||
err = comm.NewNotFoundConfErr(moduleName, dragon_trainlv, fmt.Sprintf("id:%s,lv:%d", attribute, lv))
|
err = comm.NewNotFoundConfErr(moduleName, dragon_trainlv, fmt.Sprintf("id:%s,lv:%d", attribute, lv))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *configureComp) GetDragonAttributeConf() (conf map[string]struct{}) {
|
||||||
|
|
||||||
|
this.hlock.RLock()
|
||||||
|
defer this.hlock.RUnlock()
|
||||||
|
return this.attribute
|
||||||
|
}
|
||||||
|
@ -122,6 +122,9 @@ func (this *ModelDragon) CreateDragon(session comm.IUserSession, dragons map[str
|
|||||||
if !bNewDragon {
|
if !bNewDragon {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
for k := range this.module.configure.GetDragonAttributeConf() {
|
||||||
|
dragon.Lvitem[k] = 1
|
||||||
|
}
|
||||||
|
|
||||||
if dbModel != nil {
|
if dbModel != nil {
|
||||||
err = dbModel.AddList(uid, dragon.Id, dragon)
|
err = dbModel.AddList(uid, dragon.Id, dragon)
|
||||||
|
Loading…
Reference in New Issue
Block a user