功能测试
This commit is contained in:
parent
d8cb4f78af
commit
5969eb80cd
@ -41,7 +41,7 @@
|
|||||||
"png": "jiban_img_zu02",
|
"png": "jiban_img_zu02",
|
||||||
"friends_lv": 1,
|
"friends_lv": 1,
|
||||||
"favorability_lv": 1,
|
"favorability_lv": 1,
|
||||||
"hid": "35001",
|
"hid": "14002",
|
||||||
"attribute": [
|
"attribute": [
|
||||||
{
|
{
|
||||||
"a": "atk",
|
"a": "atk",
|
||||||
@ -49,7 +49,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"attribute_txt": {
|
"attribute_txt": {
|
||||||
"key": "favorability_friends_friend_name_350011",
|
"key": "favorability_friends_friend_name_140021",
|
||||||
"text": "攻击力+{0}"
|
"text": "攻击力+{0}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -95,7 +95,7 @@
|
|||||||
"png": "jiban_img_zu02",
|
"png": "jiban_img_zu02",
|
||||||
"friends_lv": 2,
|
"friends_lv": 2,
|
||||||
"favorability_lv": 9,
|
"favorability_lv": 9,
|
||||||
"hid": "35001",
|
"hid": "14002",
|
||||||
"attribute": [
|
"attribute": [
|
||||||
{
|
{
|
||||||
"a": "atk",
|
"a": "atk",
|
||||||
@ -103,7 +103,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"attribute_txt": {
|
"attribute_txt": {
|
||||||
"key": "favorability_friends_friend_name_350012",
|
"key": "favorability_friends_friend_name_140022",
|
||||||
"text": "攻击力+{0}"
|
"text": "攻击力+{0}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -149,7 +149,7 @@
|
|||||||
"png": "jiban_img_zu02",
|
"png": "jiban_img_zu02",
|
||||||
"friends_lv": 3,
|
"friends_lv": 3,
|
||||||
"favorability_lv": 15,
|
"favorability_lv": 15,
|
||||||
"hid": "35001",
|
"hid": "14002",
|
||||||
"attribute": [
|
"attribute": [
|
||||||
{
|
{
|
||||||
"a": "atk",
|
"a": "atk",
|
||||||
@ -157,7 +157,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"attribute_txt": {
|
"attribute_txt": {
|
||||||
"key": "favorability_friends_friend_name_350013",
|
"key": "favorability_friends_friend_name_140023",
|
||||||
"text": "攻击力+{0}"
|
"text": "攻击力+{0}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -27,8 +27,6 @@ const (
|
|||||||
type configureComp struct {
|
type configureComp struct {
|
||||||
modules.MCompConfigure
|
modules.MCompConfigure
|
||||||
hlock sync.RWMutex
|
hlock sync.RWMutex
|
||||||
// fetter map[int64]*cfg.GameLibraryFetterData
|
|
||||||
// favor map[int64]*cfg.GameLibraryFavorData
|
|
||||||
|
|
||||||
favorability map[string]*cfg.GameFavorabilityData
|
favorability map[string]*cfg.GameFavorabilityData
|
||||||
favorLvExp map[string][]int32 // key 英雄id value 每级升级所需要的经验值
|
favorLvExp map[string][]int32 // key 英雄id value 每级升级所需要的经验值
|
||||||
@ -40,25 +38,15 @@ type configureComp struct {
|
|||||||
//组件初始化接口
|
//组件初始化接口
|
||||||
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)
|
||||||
// err = this.LoadMultiConfigure(map[string]interface{}{
|
|
||||||
// game_libraryhero: cfg.NewGameLibraryHero,
|
|
||||||
// game_libraryhistory: cfg.NewGameLibraryHistory,
|
|
||||||
// game_libraryfavor: cfg.NewGameLibraryFavor,
|
|
||||||
// game_librarystory: cfg.NewGameLibraryStory,
|
|
||||||
// game_librarycomplot: cfg.NewGameLibraryComplot,
|
|
||||||
// })
|
|
||||||
|
|
||||||
// this.fetter = make(map[int64]*cfg.GameLibraryFetterData, 0)
|
|
||||||
// configure.RegisterConfigure(game_libraryfetter, cfg.NewGameLibraryFetter, this.SetLibraryFetter)
|
|
||||||
// this.favor = make(map[int64]*cfg.GameLibraryFavorData, 0)
|
|
||||||
// configure.RegisterConfigure(game_libraryfetter, cfg.NewGameLibraryFetter, this.SetLibraryFavor)
|
|
||||||
|
|
||||||
configure.RegisterConfigure(game_favorability, cfg.NewGameFavorability, this.SetFavorability)
|
configure.RegisterConfigure(game_favorability, cfg.NewGameFavorability, this.SetFavorability)
|
||||||
configure.RegisterConfigure(game_friends, cfg.NewGameLibraryFetter, this.SetFriendData)
|
configure.RegisterConfigure(game_friends, cfg.NewGameFriends, this.SetFriendData)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (this *configureComp) SetFavorability() {
|
func (this *configureComp) SetFavorability() {
|
||||||
if v, err := this.GetConfigure(game_favorability); err == nil {
|
if v, err := this.GetConfigure(game_favorability); err == nil {
|
||||||
|
this.hlock.Lock()
|
||||||
|
defer this.hlock.Unlock()
|
||||||
this.favorability = make(map[string]*cfg.GameFavorabilityData, 0)
|
this.favorability = make(map[string]*cfg.GameFavorabilityData, 0)
|
||||||
this.favorLvExp = make(map[string][]int32)
|
this.favorLvExp = make(map[string][]int32)
|
||||||
if _configure, ok := v.(*cfg.GameFavorability); ok {
|
if _configure, ok := v.(*cfg.GameFavorability); ok {
|
||||||
@ -81,6 +69,8 @@ func (this *configureComp) GetFavorability(hid string, lv int32) *cfg.GameFavora
|
|||||||
|
|
||||||
func (this *configureComp) SetFriendData() {
|
func (this *configureComp) SetFriendData() {
|
||||||
if v, err := this.GetConfigure(game_friends); err == nil {
|
if v, err := this.GetConfigure(game_friends); err == nil {
|
||||||
|
this.hlock.Lock()
|
||||||
|
defer this.hlock.Unlock()
|
||||||
this.friend = make(map[int64][]*cfg.GameFriendsData, 0)
|
this.friend = make(map[int64][]*cfg.GameFriendsData, 0)
|
||||||
this.heroFetter = make(map[string][]int32)
|
this.heroFetter = make(map[string][]int32)
|
||||||
if _configure, ok := v.(*cfg.GameFriends); ok {
|
if _configure, ok := v.(*cfg.GameFriends); ok {
|
||||||
@ -89,11 +79,11 @@ func (this *configureComp) SetFriendData() {
|
|||||||
this.friend[key] = append(this.friend[key], v1)
|
this.friend[key] = append(this.friend[key], v1)
|
||||||
this.heroFetter[v1.Hid] = append(this.heroFetter[v1.Hid], v1.FriendId)
|
this.heroFetter[v1.Hid] = append(this.heroFetter[v1.Hid], v1.FriendId)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = fmt.Errorf("%T no is *cfg.SetFavorability", err)
|
err = fmt.Errorf("%T no is *cfg.SetFavorability", err)
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// id:羁绊id lv 羁绊等级
|
// id:羁绊id lv 羁绊等级
|
||||||
|
@ -95,11 +95,7 @@ func (this *Library) CheckFetter(uid string, hid string) (dbLibrary []*pb.DBLibr
|
|||||||
|
|
||||||
szFid := this.configure.GetHeroFetterID(hid)
|
szFid := this.configure.GetHeroFetterID(hid)
|
||||||
for _, fid := range szFid {
|
for _, fid := range szFid {
|
||||||
conf := this.configure.GetFriendData(fid, 1)
|
|
||||||
if len(conf) == 0 {
|
|
||||||
this.modelFetter.module.Errorf("can't foun conf fid:%d", fid)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if list := this.GetLibraryListByFid(uid, fid); list == nil { // 没有这条羁绊数据
|
if list := this.GetLibraryListByFid(uid, fid); list == nil { // 没有这条羁绊数据
|
||||||
tmp := &pb.DBLibrary{ // 创建一条羁绊数据
|
tmp := &pb.DBLibrary{ // 创建一条羁绊数据
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
@ -108,29 +104,28 @@ func (this *Library) CheckFetter(uid string, hid string) (dbLibrary []*pb.DBLibr
|
|||||||
Herofetter: map[string]string{},
|
Herofetter: map[string]string{},
|
||||||
Prize: map[int32]int32{},
|
Prize: map[int32]int32{},
|
||||||
}
|
}
|
||||||
for _, v := range conf {
|
|
||||||
if _d := this.CheckHeroFetter(uid, v.Hid); _d != nil { // check DBHeroFetter
|
if _d := this.CheckHeroFetter(uid, hid); _d != nil { // check DBHeroFetter
|
||||||
tmp.Herofetter[v.Hid] = _d.Id
|
tmp.Herofetter[hid] = _d.Id
|
||||||
fetter = append(fetter, _d)
|
fetter = append(fetter, _d)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := this.modelLibrary.createLibrary(uid, tmp); err != nil {
|
if err := this.modelLibrary.createLibrary(uid, tmp); err != nil {
|
||||||
this.modelFetter.module.Errorf("createLibrary error: %v,obj:%v", err, tmp)
|
this.modelFetter.module.Errorf("createLibrary error: %v,obj:%v", err, tmp)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
dbLibrary = append(dbLibrary, tmp)
|
dbLibrary = append(dbLibrary, tmp)
|
||||||
} else { // 有这条羁绊数据
|
} else { // 有这条羁绊数据
|
||||||
for _, v := range conf {
|
|
||||||
if _, ok := list.Herofetter[v.Hid]; !ok {
|
if _, ok := list.Herofetter[hid]; !ok {
|
||||||
if _d := this.CheckHeroFetter(uid, v.Hid); _d == nil {
|
if _d := this.CheckHeroFetter(uid, hid); _d == nil {
|
||||||
list.Herofetter[v.Hid] = _d.Id
|
list.Herofetter[hid] = _d.Id
|
||||||
fetter = append(fetter, _d)
|
fetter = append(fetter, _d)
|
||||||
}
|
|
||||||
mapData := make(map[string]interface{}, 0)
|
|
||||||
mapData["herofetter"] = list.Herofetter
|
|
||||||
this.modelLibrary.modifyLibraryDataByObjId(uid, list.Id, mapData) // 更新新的羁绊信息
|
|
||||||
dbLibrary = append(dbLibrary, list)
|
|
||||||
}
|
}
|
||||||
|
mapData := make(map[string]interface{}, 0)
|
||||||
|
mapData["herofetter"] = list.Herofetter
|
||||||
|
this.modelLibrary.modifyLibraryDataByObjId(uid, list.Id, mapData) // 更新新的羁绊信息
|
||||||
|
dbLibrary = append(dbLibrary, list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ type DBHero struct {
|
|||||||
HoroscopeProperty map[string]int32 `protobuf:"bytes,28,rep,name=horoscopeProperty,proto3" json:"horoscopeProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"horoscopeProperty"` ////星座属性加成
|
HoroscopeProperty map[string]int32 `protobuf:"bytes,28,rep,name=horoscopeProperty,proto3" json:"horoscopeProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"horoscopeProperty"` ////星座属性加成
|
||||||
Fulllvenr int32 `protobuf:"varint,29,opt,name=fulllvenr,proto3" json:"fulllvenr" bson:"fulllvenr"` ////满级登记分组 武馆使用
|
Fulllvenr int32 `protobuf:"varint,29,opt,name=fulllvenr,proto3" json:"fulllvenr" bson:"fulllvenr"` ////满级登记分组 武馆使用
|
||||||
KongfuUid string `protobuf:"bytes,30,opt,name=kongfuUid,proto3" json:"kongfuUid"` //@go_tags(`bson:"kongfuUid"`)// 英雄在谁家练功
|
KongfuUid string `protobuf:"bytes,30,opt,name=kongfuUid,proto3" json:"kongfuUid"` //@go_tags(`bson:"kongfuUid"`)// 英雄在谁家练功
|
||||||
Fetters map[string]int32 `protobuf:"bytes,31,rep,name=fetters,proto3" json:"fetters" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"horoscopeProperty"` ////羁绊属性加成
|
Fetters map[string]int32 `protobuf:"bytes,31,rep,name=fetters,proto3" json:"fetters" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"fetters"` ////羁绊属性加成
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBHero) Reset() {
|
func (x *DBHero) Reset() {
|
||||||
|
Loading…
Reference in New Issue
Block a user