方法重命名
This commit is contained in:
parent
9d47098166
commit
aca7543d7e
@ -38,7 +38,7 @@ type (
|
|||||||
//消耗卡片
|
//消耗卡片
|
||||||
ChangeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode)
|
ChangeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode)
|
||||||
//创建新英雄
|
//创建新英雄
|
||||||
CreatHero(uid string, heroCfgId ...int32) error
|
CreateHero(uid string, heroCfgId ...int32) error
|
||||||
|
|
||||||
// 获取英雄
|
// 获取英雄
|
||||||
// heroId 英雄ID
|
// heroId 英雄ID
|
||||||
|
@ -62,14 +62,19 @@ func (this *ModelHero) createOneHero(uid string, heroCfgId int32) error {
|
|||||||
|
|
||||||
//创建多个指定的英雄 heroCfgIds可填入多个英雄ID
|
//创建多个指定的英雄 heroCfgIds可填入多个英雄ID
|
||||||
func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...int32) error {
|
func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...int32) error {
|
||||||
data := make(map[string]interface{})
|
// data := make(map[string]interface{})
|
||||||
for _, v := range heroCfgIds {
|
for _, v := range heroCfgIds {
|
||||||
hero := this.initHero(uid, v)
|
if err := this.createOneHero(uid, v); err != nil {
|
||||||
if hero != nil {
|
return err
|
||||||
data[hero.Id] = hero
|
|
||||||
}
|
}
|
||||||
|
// hero := this.initHero(uid, v)
|
||||||
|
// if hero != nil {
|
||||||
|
// data[hero.Id] = hero
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
return this.moduleHero.modelHero.AddLists(uid, data)
|
|
||||||
|
return nil
|
||||||
|
// return this.moduleHero.model_hero.AddLists(uid, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取一个英雄
|
//获取一个英雄
|
||||||
|
@ -40,7 +40,7 @@ func (this *Hero) OnInstallComp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//创建新英雄
|
//创建新英雄
|
||||||
func (this *Hero) CreatHero(uid string, heroCfgId ...int32) error {
|
func (this *Hero) CreateHero(uid string, heroCfgId ...int32) error {
|
||||||
return this.modelHero.createMultiHero(uid, heroCfgId...)
|
return this.modelHero.createMultiHero(uid, heroCfgId...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ func (this *apiComp) Create(session comm.IUserSession, result map[string]interfa
|
|||||||
|
|
||||||
//初始化英雄卡
|
//初始化英雄卡
|
||||||
defaultHero := []int32{15001, 25001} //TODO 从配置中读取
|
defaultHero := []int32{15001, 25001} //TODO 从配置中读取
|
||||||
err = this.hero.CreatHero(session.GetUserId(), defaultHero...)
|
err = this.hero.CreateHero(session.GetUserId(), defaultHero...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_HeroInitCreat
|
code = pb.ErrorCode_HeroInitCreat
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user