上传竞技场代码

This commit is contained in:
liwei1dao 2022-10-25 17:52:32 +08:00
parent 10e2ae2fd9
commit aa54bef632
2 changed files with 16 additions and 7 deletions

View File

@ -12,7 +12,7 @@ import (
const (
game_arenabuychallenge = "game_arenabuychallenge.json" //购买挑战记录
game_arenaactivereward = "game_arenaactivereward.json" //挑战奖励
game_arenaarobot = "game_arenaarobot.json" //ai配置表
game_arenarobot = "game_arenarobot.json" //ai配置表
game_arenarankreward = "game_arenarankreward.json" //比赛奖励配置
game_arenachallengenpc = "game_arenachallengenpc.json" //剧情表
@ -34,8 +34,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
this.module = module.(*Arena)
this.LoadConfigure(game_arenabuychallenge, cfg.NewGameArenaBuyChallenge)
this.LoadConfigure(game_arenaactivereward, cfg.NewGameArenaActiveReward)
this.LoadConfigure(game_arenaarobot, cfg.NewGameArenaRobot)
configure.RegisterConfigure(game_arenaarobot, cfg.NewGameArenaRobot, this.updateArenaRobot)
configure.RegisterConfigure(game_arenarobot, cfg.NewGameArenaRobot, this.updateArenaRobot)
this.LoadConfigure(game_arenarankreward, cfg.NewGameArenaRankReward)
this.LoadConfigure(game_arenachallengenpc, cfg.NewGameArenaChallengeNpc)
@ -96,10 +95,11 @@ func (this *configureComp) getActiveRewardById(lv int32) (result *cfg.GameArenaA
//更新ai数据表
func (this *configureComp) updateArenaRobot() {
if v, err := this.GetConfigure(game_arenaarobot); err == nil {
if v, err := this.GetConfigure(game_arenarobot); err == nil {
if configure, ok := v.(*cfg.GameArenaRobot); ok {
this.lock.Lock()
defer this.lock.Unlock()
this.ais = make(map[int32][]*cfg.GameArenaRobotData)
for _, value := range configure.GetDataList() {
if _, ok = this.ais[value.LvId]; !ok {
this.ais[value.LvId] = make([]*cfg.GameArenaRobotData, 0)

View File

@ -75,7 +75,7 @@ func (this *modelArena) queryUserHeros(uid string, heroids []string) (results []
return
}
results = make([]*pb.DBHero, 0)
if err = model.GetListObjs(uid, heroids, results); err != nil {
if err = model.GetListObjs(uid, heroids, &results); err != nil {
this.module.Errorln(err)
return
}
@ -227,7 +227,16 @@ func (this *modelArena) matchePlayer(uid string, dan, num int32) (results []*pb.
//随机用户名
func (this *modelArena) randUserName() string {
return ""
var s = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*")
r := rand.New(rand.NewSource(time.Now().UnixNano() + rand.Int63n(10000)))
result := []byte("DWA_")
for i, v := range r.Perm(len(s)) {
result = append(result, s[v])
if i == 3 {
break
}
}
return string(result)
}
func (this *modelArena) getAI(mformatId int32) (ai *pb.ArenaPlayer, err error) {
@ -273,5 +282,5 @@ func (this *modelArena) getAI(mformatId int32) (ai *pb.ArenaPlayer, err error) {
//积分计算
func (this *modelArena) integralCompute(red, bule *pb.ArenaPlayer, iswin bool) {
}