Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into liwei
This commit is contained in:
commit
4c11b17184
50
bin/json/game_heroexp.json
Normal file
50
bin/json/game_heroexp.json
Normal file
@ -0,0 +1,50 @@
|
||||
[
|
||||
{
|
||||
"hid": 42911,
|
||||
"name": "初级经验精灵",
|
||||
"star": 2,
|
||||
"color": 1,
|
||||
"heroexp": 1000,
|
||||
"skilllevelup": 0
|
||||
},
|
||||
{
|
||||
"hid": 43911,
|
||||
"name": "中级经验精灵",
|
||||
"star": 3,
|
||||
"color": 2,
|
||||
"heroexp": 5000,
|
||||
"skilllevelup": 0
|
||||
},
|
||||
{
|
||||
"hid": 44911,
|
||||
"name": "高级经验精灵",
|
||||
"star": 4,
|
||||
"color": 3,
|
||||
"heroexp": 20000,
|
||||
"skilllevelup": 0
|
||||
},
|
||||
{
|
||||
"hid": 43921,
|
||||
"name": "技能精灵·稀有",
|
||||
"star": 3,
|
||||
"color": 2,
|
||||
"heroexp": 0,
|
||||
"skilllevelup": 1
|
||||
},
|
||||
{
|
||||
"hid": 44921,
|
||||
"name": "技能精灵·史诗",
|
||||
"star": 4,
|
||||
"color": 3,
|
||||
"heroexp": 0,
|
||||
"skilllevelup": 1
|
||||
},
|
||||
{
|
||||
"hid": 45921,
|
||||
"name": "技能精灵·传说",
|
||||
"star": 5,
|
||||
"color": 4,
|
||||
"heroexp": 0,
|
||||
"skilllevelup": 1
|
||||
}
|
||||
]
|
@ -3,22 +3,33 @@ package hero
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"log"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *Api_Comp) Hero_Check(session comm.IUserSession, req *pb.Hero_StrengthenUplv_Req) (result map[string]interface{}, code comm.ErrorCode) {
|
||||
func (this *Api_Comp) StrengthenUplv_Check(session comm.IUserSession, req *pb.Hero_StrengthenUplv_Req) (result map[string]interface{}, code comm.ErrorCode) {
|
||||
if req.HeroObjID == "" {
|
||||
code.Code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
//this.module.model_hero.moduleHero.GetHeroInfoByObjID()
|
||||
return
|
||||
}
|
||||
|
||||
/// 英雄升级
|
||||
func (this *Api_Comp) HeroStrengthenLv(session comm.IUserSession, agrs map[string]interface{}, req *pb.Hero_StrengthenUplv_Req) (code pb.ErrorCode) {
|
||||
func (this *Api_Comp) StrengthenUplv(session comm.IUserSession, agrs map[string]interface{}, req *pb.Hero_StrengthenUplv_Req) (code pb.ErrorCode) {
|
||||
|
||||
defer func() {
|
||||
if code == pb.ErrorCode_Success {
|
||||
session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.Hero_StrengthenUplv_Resp{})
|
||||
}
|
||||
}()
|
||||
this.module.configure_comp.GetHeroConfigure()
|
||||
|
||||
if configure, err := this.module.configure_comp.GetHeroConfigure(); err != nil {
|
||||
_data := configure.GetDataMap()
|
||||
for key, value := range _data {
|
||||
log.Fatalf("%d,%v", key, value)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ const (
|
||||
game_heroLevelgrow = "game_heroLevelgrow.json"
|
||||
game_heroStarup = "game_heroStarup.json"
|
||||
game_heroLevelup = "game_heroLevelup.json"
|
||||
game_heroExp = "game_exp.json"
|
||||
)
|
||||
|
||||
///配置管理组件
|
||||
@ -29,6 +30,14 @@ func (this *Configure_Comp) Init(service core.IService, module core.IModule, com
|
||||
this.LoadConfigure(game_heroLevelgrow, cfg.NewGame_heroLevelgrow)
|
||||
this.LoadConfigure(game_heroStarup, cfg.NewGame_heroStarup)
|
||||
this.LoadConfigure(game_heroLevelup, cfg.NewGame_heroLevelup)
|
||||
this.LoadConfigure(game_heroExp, cfg.NewGame_heroExp)
|
||||
|
||||
// this.GetHeroConfigure()
|
||||
// this.GetHeroStargrowCon()
|
||||
// this.GetHeroLevelgrowCon()
|
||||
// this.GetHeroStarupCon()
|
||||
// this.GetHeroLevelUpCon()
|
||||
// this.GetHeroExpCon()
|
||||
return
|
||||
}
|
||||
|
||||
@ -38,13 +47,96 @@ func (this *Configure_Comp) GetHeroConfigure() (configure *cfg.Game_newHero, err
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_hero); err != nil {
|
||||
return
|
||||
} else {
|
||||
if v, err = this.GetConfigure(game_hero); err == nil {
|
||||
if configure, ok = v.(*cfg.Game_newHero); !ok {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_hero", v)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_hero", v)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取英雄强化增加属性配置数据
|
||||
func (this *Configure_Comp) GetHeroStargrowCon() (configure *cfg.Game_heroStargrow, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_heroStargrow); err == nil {
|
||||
if configure, ok = v.(*cfg.Game_heroStargrow); !ok {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_hero", v)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_hero", v)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 获取英雄升级属性变化相关配置数据
|
||||
func (this *Configure_Comp) GetHeroLevelgrowCon() (configure *cfg.Game_heroLevelgrow, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_heroLevelgrow); err == nil {
|
||||
if configure, ok = v.(*cfg.Game_heroLevelgrow); !ok {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_heroLevelgrow", v)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取英雄升星相关配置数据
|
||||
func (this *Configure_Comp) GetHeroStarupCon() (configure *cfg.Game_heroStarup, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_heroStarup); err == nil {
|
||||
if configure, ok = v.(*cfg.Game_heroStarup); !ok {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_heroStarup", v)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_heroStarup", v)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取英雄升级相关配置数据
|
||||
func (this *Configure_Comp) GetHeroLevelUpCon() (configure *cfg.Game_heroLevelup, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_heroLevelup); err == nil {
|
||||
if configure, ok = v.(*cfg.Game_heroLevelup); !ok {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_heroLevelup", v)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_heroLevelup", v)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Configure_Comp) GetHeroExpCon() (configure *cfg.Game_heroExp, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_heroExp); err == nil {
|
||||
if configure, ok = v.(*cfg.Game_heroExp); !ok {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_heroExp", v)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_heroExp", v)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -38,6 +38,12 @@ func (this *Hero) OnInstallComp() {
|
||||
this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
|
||||
}
|
||||
|
||||
//通过唯一对象获取英雄信息
|
||||
func (this *Hero) GetHeroInfoByObjID(id string) (*pb.DB_HeroData, pb.ErrorCode) {
|
||||
|
||||
return nil, pb.ErrorCode_HeroNoExist
|
||||
}
|
||||
|
||||
//获取英雄
|
||||
func (this *Hero) GetHero(heroId int32) (*pb.DB_HeroData, pb.ErrorCode) {
|
||||
|
||||
|
42
sys/configure/structs/game.heroExp.go
Normal file
42
sys/configure/structs/game.heroExp.go
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
package cfg
|
||||
|
||||
type Game_heroExp struct {
|
||||
_dataMap map[int32]*Game_heroExpData
|
||||
_dataList []*Game_heroExpData
|
||||
}
|
||||
|
||||
func NewGame_heroExp(_buf []map[string]interface{}) (*Game_heroExp, error) {
|
||||
_dataList := make([]*Game_heroExpData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*Game_heroExpData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := NewGame_heroExpData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.Hid] = _v
|
||||
}
|
||||
}
|
||||
return &Game_heroExp{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *Game_heroExp) GetDataMap() map[int32]*Game_heroExpData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *Game_heroExp) GetDataList() []*Game_heroExpData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *Game_heroExp) Get(key int32) *Game_heroExpData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
35
sys/configure/structs/game.heroExpData.go
Normal file
35
sys/configure/structs/game.heroExpData.go
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
package cfg
|
||||
|
||||
import "errors"
|
||||
|
||||
type Game_heroExpData struct {
|
||||
Hid int32
|
||||
Name string
|
||||
Star int32
|
||||
Color int32
|
||||
Heroexp int32
|
||||
Skilllevelup int32
|
||||
}
|
||||
|
||||
func (Game_heroExpData) GetTypeId() int {
|
||||
return 2029779473
|
||||
}
|
||||
|
||||
func NewGame_heroExpData(_buf map[string]interface{}) (_v *Game_heroExpData, err error) {
|
||||
_v = &Game_heroExpData{}
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hid"].(float64); !_ok_ { err = errors.New("hid error"); return }; _v.Hid = int32(_tempNum_) }
|
||||
{ var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["color"].(float64); !_ok_ { err = errors.New("color error"); return }; _v.Color = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["heroexp"].(float64); !_ok_ { err = errors.New("heroexp error"); return }; _v.Heroexp = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["skilllevelup"].(float64); !_ok_ { err = errors.New("skilllevelup error"); return }; _v.Skilllevelup = int32(_tempNum_) }
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue
Block a user