Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev

This commit is contained in:
meixiongfeng 2022-09-19 17:57:05 +08:00
commit 1bee760df9
9 changed files with 94 additions and 1811 deletions

View File

@ -12,6 +12,10 @@
"introduce": { "introduce": {
"key": "hunting_boss_1005", "key": "hunting_boss_1005",
"text": "传说中的巨型猩猩是一个非常恐怖的角色,它暴戾且狡猾,与它为敌一定要非常小心" "text": "传说中的巨型猩猩是一个非常恐怖的角色,它暴戾且狡猾,与它为敌一定要非常小心"
},
"opentimetext": {
"key": "bossopening_time1",
"text": "开启时间1、2"
} }
}, },
{ {
@ -27,6 +31,10 @@
"introduce": { "introduce": {
"key": "hunting_boss_1006", "key": "hunting_boss_1006",
"text": "火龙可以从嘴里喷出猛烈的火焰,对地面造成毁灭性打击" "text": "火龙可以从嘴里喷出猛烈的火焰,对地面造成毁灭性打击"
},
"opentimetext": {
"key": "bossopening_time2",
"text": "开启时间3、4"
} }
}, },
{ {
@ -42,6 +50,10 @@
"introduce": { "introduce": {
"key": "hunting_boss_1007", "key": "hunting_boss_1007",
"text": "一种变异的老虎,它有着锋利的爪子和牙齿" "text": "一种变异的老虎,它有着锋利的爪子和牙齿"
},
"opentimetext": {
"key": "bossopening_time3",
"text": "开启时间5、6"
} }
}, },
{ {
@ -57,6 +69,10 @@
"introduce": { "introduce": {
"key": "hunting_boss_1008", "key": "hunting_boss_1008",
"text": "当黑夜来临时,梦魇露出了它的爪牙,会让无辜的人们陷入噩梦中无法自拔" "text": "当黑夜来临时,梦魇露出了它的爪牙,会让无辜的人们陷入噩梦中无法自拔"
},
"opentimetext": {
"key": "bossopening_time4",
"text": "开启时间1、7"
} }
} }
] ]

View File

@ -26,7 +26,10 @@
} }
], ],
"endid1": 10009, "endid1": 10009,
"endid2": 10010 "endid2": 10010,
"fid": [
102
]
}, },
{ {
"hid": 25001, "hid": 25001,
@ -55,7 +58,10 @@
} }
], ],
"endid1": 10009, "endid1": 10009,
"endid2": 10010 "endid2": 10010,
"fid": [
101
]
}, },
{ {
"hid": 35001, "hid": 35001,
@ -84,7 +90,10 @@
} }
], ],
"endid1": 10009, "endid1": 10009,
"endid2": 10010 "endid2": 10010,
"fid": [
101
]
}, },
{ {
"hid": 11009, "hid": 11009,
@ -113,6 +122,9 @@
} }
], ],
"endid1": 10009, "endid1": 10009,
"endid2": 10010 "endid2": 10010,
"fid": [
102
]
} }
] ]

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -78,7 +78,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -123,7 +123,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -168,7 +168,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -213,7 +213,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -258,7 +258,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -303,7 +303,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -348,7 +348,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -393,7 +393,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -438,7 +438,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -483,7 +483,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },
@ -528,7 +528,7 @@
], ],
"award": [ "award": [
{ {
"a": "item", "a": "attr",
"t": "diamond", "t": "diamond",
"n": 50 "n": 50
}, },

View File

@ -27,7 +27,7 @@ var user_builders = []*TestCase{
req: &pb.UserGetTujianReq{}, req: &pb.UserGetTujianReq{},
rsp: &pb.UserGetTujianResp{}, rsp: &pb.UserGetTujianResp{},
// enabled: true, // enabled: true,
},{ }, {
desc: "获取配置", desc: "获取配置",
mainType: string(comm.ModuleUser), mainType: string(comm.ModuleUser),
subType: user.UserSubTypeGetSetting, subType: user.UserSubTypeGetSetting,

View File

@ -6,49 +6,24 @@ import (
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
"sync"
) )
const ( const (
game_huntingboss = "game_huntingboss.json" game_libraryhero = "game_libraryhero.json"
game_challenge = "game_huntingchallenge.json"
) )
///配置管理基础组件 ///配置管理基础组件
type configureComp struct { type configureComp struct {
hlock sync.RWMutex
modules.MCompConfigure modules.MCompConfigure
_huntingMap map[int64]*cfg.GameHuntingBossData
} }
//组件初始化接口 //组件初始化接口
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompConfigure.Init(service, module, comp, options) err = this.MCompConfigure.Init(service, module, comp, options)
this._huntingMap = make(map[int64]*cfg.GameHuntingBossData, 0) err = this.LoadConfigure(game_libraryhero, cfg.NewGameLibraryHero)
configure.RegisterConfigure(game_huntingboss, cfg.NewGameHuntingBoss, func() {
if v, err := this.GetConfigure(game_huntingboss); err == nil {
if configure, ok := v.(*cfg.GameHuntingBoss); ok {
this.hlock.Lock()
defer this.hlock.Unlock()
for _, value := range configure.GetDataList() {
this._huntingMap[int64(value.Type<<16)+int64(value.Difficulty)] = value
}
return
}
} else {
log.Errorf("get game_huntingboss conf err:%v", err)
}
return
})
err = this.LoadConfigure(game_challenge, cfg.NewGameHuntingChallenge)
return
}
// 参数: boss类型 难度 return
func (this *configureComp) GetHuntingBossConfigData(bossType int32, difficulty int32) (data *cfg.GameHuntingBossData) {
return this._huntingMap[int64(bossType<<16)+int64(difficulty)]
} }
//加载多个配置文件 //加载多个配置文件
@ -68,29 +43,10 @@ func (this *configureComp) GetConfigure(name string) (v interface{}, err error)
return configure.GetConfigure(name) return configure.GetConfigure(name)
} }
// get boss Type func (this *configureComp) GetLibraryHero(hid int32) (data *cfg.GameLibraryHeroData) {
func (this *configureComp) GetHuntingBossTypeConfigData() (mapType map[int32]struct{}) { if v, err := this.GetConfigure(game_libraryhero); err == nil {
if configure, ok := v.(*cfg.GameLibraryHero); ok {
mapType = make(map[int32]struct{}, 0) data = configure.Get(hid)
if v, err := this.GetConfigure(game_huntingboss); err == nil {
if configure, ok := v.(*cfg.GameHuntingBoss); ok {
this.hlock.Lock()
defer this.hlock.Unlock()
for _, value := range configure.GetDataList() {
if _, ok := mapType[value.Type]; !ok {
mapType[value.Type] = struct{}{}
}
}
}
}
return
}
func (this *configureComp) GetBuyChallengeCount(index int32) (data *cfg.GameHuntingChallengeData) {
if v, err := this.GetConfigure(game_challenge); err == nil {
if configure, ok := v.(*cfg.GameHuntingChallenge); ok {
data = configure.Get(index)
return return
} }
} else { } else {

View File

@ -3,7 +3,6 @@ package library
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -32,13 +31,31 @@ func (this *modelLibrary) modifyLibraryDataByObjId(uid string, data map[string]i
} }
// 获取列表信息 // 获取列表信息
func (this *modelLibrary) getLibraryList(uid string) (result *pb.DBHero, err error) { func (this *modelLibrary) getLibraryList(uid string) []*pb.DBLibrary {
result = &pb.DBHero{} libs := make([]*pb.DBLibrary, 0)
if err = this.Get(uid, result); err != nil && mgo.MongodbNil != err { err := this.GetList(uid, &libs)
if err != nil {
return nil
}
return libs
}
//创建一条信息
func (this *modelLibrary) createLibrary(uid string, fetter *pb.DBLibrary) (err error) {
if err = this.AddList(uid, fetter.Id, fetter); err != nil {
this.module.Errorf("%v", err)
return return
} }
return
err = nil }
return result, err
// 通过objid 找对应的数据
func (this *modelLibrary) getOneLibrary(uid, oid string) *pb.DBLibrary {
fetter := &pb.DBLibrary{}
err := this.GetListObj(uid, oid, fetter)
if err != nil {
return nil
}
return fetter
} }

View File

@ -15,6 +15,7 @@ type GameHuntingOpenTimeData struct {
Opentime []int32 Opentime []int32
Name string Name string
Introduce string Introduce string
Opentimetext string
} }
const TypeId_GameHuntingOpenTimeData = 1854578068 const TypeId_GameHuntingOpenTimeData = 1854578068
@ -41,6 +42,7 @@ func (_v *GameHuntingOpenTimeData)Deserialize(_buf map[string]interface{}) (err
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["introduce"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Introduce error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Introduce, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["introduce"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Introduce error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Introduce, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["opentimetext"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Opentimetext error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Opentimetext, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
return return
} }

View File

@ -21,6 +21,7 @@ type GameLibraryHeroData struct {
Stroyprize []*Gameatn Stroyprize []*Gameatn
Endid1 int32 Endid1 int32
Endid2 int32 Endid2 int32
Fid []int32
} }
const TypeId_GameLibraryHeroData = 1808545443 const TypeId_GameLibraryHeroData = 1808545443
@ -79,6 +80,20 @@ func (_v *GameLibraryHeroData)Deserialize(_buf map[string]interface{}) (err erro
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["endid1"].(float64); !_ok_ { err = errors.New("endid1 error"); return }; _v.Endid1 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["endid1"].(float64); !_ok_ { err = errors.New("endid1 error"); return }; _v.Endid1 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["endid2"].(float64); !_ok_ { err = errors.New("endid2 error"); return }; _v.Endid2 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["endid2"].(float64); !_ok_ { err = errors.New("endid2 error"); return }; _v.Endid2 = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["fid"].([]interface{}); !_ok_ { err = errors.New("fid error"); return }
_v.Fid = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Fid = append(_v.Fid, _list_v_)
}
}
return return
} }