配置文件解析
This commit is contained in:
parent
ad778836cc
commit
05226c76f2
@ -3,22 +3,33 @@ package hero
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"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
|
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() {
|
defer func() {
|
||||||
if code == pb.ErrorCode_Success {
|
if code == pb.ErrorCode_Success {
|
||||||
session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.Hero_StrengthenUplv_Resp{})
|
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
|
return
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,13 @@ func (this *Configure_Comp) Init(service core.IService, module core.IModule, com
|
|||||||
this.LoadConfigure(game_heroStarup, cfg.NewGame_heroStarup)
|
this.LoadConfigure(game_heroStarup, cfg.NewGame_heroStarup)
|
||||||
this.LoadConfigure(game_heroLevelup, cfg.NewGame_heroLevelup)
|
this.LoadConfigure(game_heroLevelup, cfg.NewGame_heroLevelup)
|
||||||
this.LoadConfigure(game_heroExp, cfg.NewGame_heroExp)
|
this.LoadConfigure(game_heroExp, cfg.NewGame_heroExp)
|
||||||
|
|
||||||
|
// this.GetHeroConfigure()
|
||||||
|
// this.GetHeroStargrowCon()
|
||||||
|
// this.GetHeroLevelgrowCon()
|
||||||
|
// this.GetHeroStarupCon()
|
||||||
|
// this.GetHeroLevelUpCon()
|
||||||
|
// this.GetHeroExpCon()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,13 +47,96 @@ func (this *Configure_Comp) GetHeroConfigure() (configure *cfg.Game_newHero, err
|
|||||||
v interface{}
|
v interface{}
|
||||||
ok bool
|
ok bool
|
||||||
)
|
)
|
||||||
if v, err = this.GetConfigure(game_hero); err != nil {
|
if v, err = this.GetConfigure(game_hero); err == nil {
|
||||||
return
|
|
||||||
} else {
|
|
||||||
if configure, ok = v.(*cfg.Game_newHero); !ok {
|
if configure, ok = v.(*cfg.Game_newHero); !ok {
|
||||||
err = fmt.Errorf("%T no is *cfg.Game_hero", v)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,12 @@ func (this *Hero) OnInstallComp() {
|
|||||||
this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
|
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) {
|
func (this *Hero) GetHero(heroId int32) (*pb.DB_HeroData, pb.ErrorCode) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user