比赛场轮次淘汰允许不淘汰人员
This commit is contained in:
parent
cdc3b3d3da
commit
7f75f9a0a4
|
@ -8,6 +8,7 @@ import (
|
||||||
"mongo.games.com/game/srvdata"
|
"mongo.games.com/game/srvdata"
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
"mongo.games.com/goserver/core/netlib"
|
"mongo.games.com/goserver/core/netlib"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CSHundredSceneGetPlayerNumPacketFactory struct {
|
type CSHundredSceneGetPlayerNumPacketFactory struct {
|
||||||
|
@ -210,38 +211,38 @@ func (this *CSGameObservePacketFactory) CreatePacket() interface{} {
|
||||||
|
|
||||||
func (this *CSGameObserveHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
func (this *CSGameObserveHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
||||||
logger.Logger.Trace("CSGameObserveHandler Process recv ", data)
|
logger.Logger.Trace("CSGameObserveHandler Process recv ", data)
|
||||||
if _, ok := data.(*gamehall.CSGameObserve); ok {
|
if msg, ok := data.(*gamehall.CSGameObserve); ok {
|
||||||
p := PlayerMgrSington.GetPlayer(sid)
|
p := PlayerMgrSington.GetPlayer(sid)
|
||||||
if p != nil {
|
if p != nil {
|
||||||
//if msg.GetStartOrEnd() {
|
if msg.GetStartOrEnd() {
|
||||||
// gameStateMgr.PlayerRegiste(p, msg.GetGameId(), msg.GetStartOrEnd())
|
gameStateMgr.PlayerRegiste(p, msg.GetGameId(), msg.GetStartOrEnd())
|
||||||
// pack := &gamehall.SCGameSubList{}
|
pack := &gamehall.SCGameSubList{}
|
||||||
// statePack := &gamehall.SCGameState{}
|
statePack := &gamehall.SCGameState{}
|
||||||
// scenes := HundredSceneMgrSington.GetPlatformScene(p.Platform, msg.GetGameId())
|
scenes := HundredSceneMgrSington.GetPlatformScene(p.Platform, msg.GetGameId())
|
||||||
// for _, value := range scenes {
|
for _, value := range scenes {
|
||||||
// pack.List = append(pack.List, &gamehall.GameSubRecord{
|
pack.List = append(pack.List, &gamehall.GameSubRecord{
|
||||||
// GameFreeId: proto.Int32(value.dbGameFree.GetId()),
|
GameFreeId: proto.Int32(value.dbGameFree.GetId()),
|
||||||
// NewLog: proto.Int32(-1),
|
NewLog: proto.Int32(-1),
|
||||||
// LogCnt: proto.Int(len(value.GameLog)),
|
LogCnt: proto.Int(len(value.GameLog)),
|
||||||
// TotleLog: value.GameLog,
|
TotleLog: value.GameLog,
|
||||||
// })
|
})
|
||||||
// leftTime := int64(value.StateSec) - (time.Now().Unix() - value.StateTs)
|
leftTime := int64(value.StateSec) - (time.Now().Unix() - value.StateTs)
|
||||||
// if leftTime < 0 {
|
if leftTime < 0 {
|
||||||
// leftTime = 0
|
leftTime = 0
|
||||||
// }
|
}
|
||||||
// statePack.List = append(statePack.List, &gamehall.GameState{
|
statePack.List = append(statePack.List, &gamehall.GameState{
|
||||||
// GameFreeId: proto.Int32(value.dbGameFree.GetId()),
|
GameFreeId: proto.Int32(value.dbGameFree.GetId()),
|
||||||
// Ts: proto.Int64(leftTime),
|
Ts: proto.Int64(leftTime),
|
||||||
// Sec: proto.Int32(value.StateSec),
|
Sec: proto.Int32(value.StateSec),
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
// p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_GAMESUBLIST), pack)
|
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_GAMESUBLIST), pack)
|
||||||
// logger.Logger.Trace("SCGameSubList:", pack)
|
logger.Logger.Trace("SCGameSubList:", pack)
|
||||||
// p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_GAMESTATE), statePack)
|
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_GAMESTATE), statePack)
|
||||||
// logger.Logger.Trace("SCGameState:", statePack)
|
logger.Logger.Trace("SCGameState:", statePack)
|
||||||
//} else {
|
} else {
|
||||||
// gameStateMgr.PlayerClear(p)
|
gameStateMgr.PlayerClear(p)
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -177,7 +177,16 @@ func (tm *TmMatch) CreateRobotGrades(round int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort.Slice(tm.robotGrades[round-1], func(i, j int) bool {
|
sort.Slice(tm.robotGrades[round-1], func(i, j int) bool {
|
||||||
return tm.robotGrades[round-1][i].grade > tm.robotGrades[round-1][j].grade
|
if tm.robotGrades[round-1][i].copySnid > 0 && tm.robotGrades[round-1][j].copySnid == 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if tm.robotGrades[round-1][i].copySnid > 0 && tm.robotGrades[round-1][j].copySnid > 0 {
|
||||||
|
return tm.robotGrades[round-1][i].grade > tm.robotGrades[round-1][j].grade
|
||||||
|
}
|
||||||
|
if tm.robotGrades[round-1][i].copySnid == 0 && tm.robotGrades[round-1][j].copySnid > 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
// 当前轮数据
|
// 当前轮数据
|
||||||
|
@ -291,11 +300,11 @@ func (tm *TmMatch) RobotGradesDecline(round int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.Logger.Tracef("======积分衰减======当前第 %v 轮============", round)
|
//logger.Logger.Tracef("======积分衰减======当前第 %v 轮============", round)
|
||||||
for i, infos := range tm.robotGrades {
|
//for i, infos := range tm.robotGrades {
|
||||||
logger.Logger.Tracef(">>>积分历史>>> 第 %v 轮", i)
|
// logger.Logger.Tracef(">>>积分历史>>> 第 %v 轮", i)
|
||||||
for _, info := range infos {
|
// for _, info := range infos {
|
||||||
logger.Logger.Trace("Snid: ", info.copySnid, " grade: ", info.grade, " copyLv: ", info.copyLv, " copyRoleId: ", info.copyRoleId)
|
// logger.Logger.Trace("Snid: ", info.copySnid, " grade: ", info.grade, " copyLv: ", info.copyLv, " copyRoleId: ", info.copyRoleId)
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,9 +137,9 @@ func (this *Tournament) checkData(cfg *webapiproto.GameMatchDate) bool {
|
||||||
if num%4 != 0 { //必须是4的整倍数
|
if num%4 != 0 { //必须是4的整倍数
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if num <= cfg.MatchPromotion[i+1] { //必须递减
|
//if num <= cfg.MatchPromotion[i+1] { //必须递减
|
||||||
return false
|
// return false
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -959,7 +959,9 @@ func (this *Tournament) NextRoundStartSingle(sortId int64, playerCtx *PlayerMatc
|
||||||
}
|
}
|
||||||
|
|
||||||
if promotionNum != 1 {
|
if promotionNum != 1 {
|
||||||
arr = arr[:promotionNum]
|
if int(promotionNum) < len(arr) {
|
||||||
|
arr = arr[:promotionNum]
|
||||||
|
}
|
||||||
playerCtx.tm.robotGrades[int(round)] = arr
|
playerCtx.tm.robotGrades[int(round)] = arr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue