锦标赛bug修复
This commit is contained in:
parent
f0c6b07c66
commit
5331ceea99
@ -29,6 +29,7 @@ type ChampshipData struct {
|
|||||||
PreGroupInfo map[int]int // 锦标赛分组信息 备份
|
PreGroupInfo map[int]int // 锦标赛分组信息 备份
|
||||||
Robot map[int]*ChampshipRobot // 机器人
|
Robot map[int]*ChampshipRobot // 机器人
|
||||||
PreRobot map[int]*ChampshipRobot // 机器人 备份
|
PreRobot map[int]*ChampshipRobot // 机器人 备份
|
||||||
|
ZeroTime int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChampshipRank struct {
|
type ChampshipRank struct {
|
||||||
@ -87,6 +88,9 @@ func (c *ChampshipMgr) Init() {
|
|||||||
|
|
||||||
Now := GoUtil.Now()
|
Now := GoUtil.Now()
|
||||||
ZeroTime := GoUtil.ZeroTimestamp()
|
ZeroTime := GoUtil.ZeroTimestamp()
|
||||||
|
if c.getData().ZeroTime != ZeroTime {
|
||||||
|
c.ZeroUpdate(&msg.Msg{})
|
||||||
|
}
|
||||||
Remain := Now - ZeroTime
|
Remain := Now - ZeroTime
|
||||||
Remain1 := 1800 - Remain%1800
|
Remain1 := 1800 - Remain%1800
|
||||||
|
|
||||||
@ -101,6 +105,7 @@ func (c *ChampshipMgr) Init() {
|
|||||||
Type: msg.HANDLE_TYPE_CHAMPSHIP_AI,
|
Type: msg.HANDLE_TYPE_CHAMPSHIP_AI,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
c.mDispatr.AfterFunc(time.Duration(GoUtil.NextZeroTimestampDuration())*time.Second, func() {
|
c.mDispatr.AfterFunc(time.Duration(GoUtil.NextZeroTimestampDuration())*time.Second, func() {
|
||||||
c.Send(&msg.Msg{
|
c.Send(&msg.Msg{
|
||||||
Type: msg.SERVER_ZERO_UPDATE,
|
Type: msg.SERVER_ZERO_UPDATE,
|
||||||
@ -116,6 +121,7 @@ func (c *ChampshipMgr) NotifyAll(m *msg.Msg) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *ChampshipMgr) ZeroUpdate(m *msg.Msg) (interface{}, error) {
|
func (c *ChampshipMgr) ZeroUpdate(m *msg.Msg) (interface{}, error) {
|
||||||
|
c.getData().ZeroTime = GoUtil.ZeroTimestamp()
|
||||||
c.getData().PreRank = c.getData().Rank
|
c.getData().PreRank = c.getData().Rank
|
||||||
c.getData().PreRobot = c.getData().Robot
|
c.getData().PreRobot = c.getData().Robot
|
||||||
c.getData().PreGroupInfo = c.getData().GroupInfo
|
c.getData().PreGroupInfo = c.getData().GroupInfo
|
||||||
|
|||||||
@ -102,9 +102,9 @@ func (gl *GameLogic) ZeroFlush() {
|
|||||||
})
|
})
|
||||||
var a1 = []interface{}{gl.DailyTaskTimestamp}
|
var a1 = []interface{}{gl.DailyTaskTimestamp}
|
||||||
GoUtil.CallEvent(MergeConst.Notify_Daily_Renew, a1)
|
GoUtil.CallEvent(MergeConst.Notify_Daily_Renew, a1)
|
||||||
gl.RankMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新排行榜
|
// gl.RankMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新排行榜
|
||||||
gl.ChampshipMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新锦标赛
|
// gl.ChampshipMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新锦标赛
|
||||||
gl.VarMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新变量
|
// gl.VarMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新变量
|
||||||
gl.NotifyAll(MsgMod.MSG_ZERO_UPDATE)
|
gl.NotifyAll(MsgMod.MSG_ZERO_UPDATE)
|
||||||
gl.CreateDailyLogFile()
|
gl.CreateDailyLogFile()
|
||||||
log.Debug("Server ZeroFlush")
|
log.Debug("Server ZeroFlush")
|
||||||
|
|||||||
@ -2,8 +2,10 @@ package game
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
|
"server/GoUtil"
|
||||||
"server/game/mod/card"
|
"server/game/mod/card"
|
||||||
"server/game/mod/msg"
|
"server/game/mod/msg"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type VarMgr struct {
|
type VarMgr struct {
|
||||||
@ -12,6 +14,7 @@ type VarMgr struct {
|
|||||||
|
|
||||||
type VarData struct {
|
type VarData struct {
|
||||||
Var map[string]interface{}
|
Var map[string]interface{}
|
||||||
|
ZeroTime int64
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -26,25 +29,22 @@ func (f *VarMgr) Init() {
|
|||||||
}
|
}
|
||||||
// 注册处理函数
|
// 注册处理函数
|
||||||
f.init()
|
f.init()
|
||||||
f.initData()
|
|
||||||
f.RegisterHandler(msg.SERVER_ZERO_UPDATE, f.ZeroUpdate)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *VarMgr) initData() {
|
|
||||||
if f.getData().Var == nil {
|
if f.getData().Var == nil {
|
||||||
f.getData().Var = make(map[string]interface{})
|
f.getData().Var = make(map[string]interface{})
|
||||||
}
|
}
|
||||||
GoldCard := f.GetVar(VAR_GOLD_CARD)
|
if f.getData().ZeroTime == GoUtil.ZeroTimestamp() {
|
||||||
if GoldCard == nil { // 随机生成两个金卡
|
f.ZeroUpdate(&msg.Msg{})
|
||||||
Card1, Card2 := card.RankGoldCard()
|
|
||||||
f.SetVar(VAR_GOLD_CARD, &VarGoldCard{
|
|
||||||
Four: Card1,
|
|
||||||
Five: Card2,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
f.RegisterHandler(msg.SERVER_ZERO_UPDATE, f.ZeroUpdate)
|
||||||
|
f.mDispatr.AfterFunc(time.Duration(GoUtil.NextZeroTimestampDuration())*time.Second, func() {
|
||||||
|
f.Send(&msg.Msg{
|
||||||
|
Type: msg.SERVER_ZERO_UPDATE,
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *VarMgr) ZeroUpdate(m *msg.Msg) (interface{}, error) {
|
func (f *VarMgr) ZeroUpdate(m *msg.Msg) (interface{}, error) {
|
||||||
|
f.getData().ZeroTime = GoUtil.ZeroTimestamp()
|
||||||
// 随机生成两个金卡
|
// 随机生成两个金卡
|
||||||
Card1, Card2 := card.RankGoldCard()
|
Card1, Card2 := card.RankGoldCard()
|
||||||
f.SetVar(VAR_GOLD_CARD, &VarGoldCard{
|
f.SetVar(VAR_GOLD_CARD, &VarGoldCard{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user