| | |
| | | import GameWorld
|
| | | import MirrorAttack
|
| | | import PlayerViewCacheTube
|
| | | import PlayerControl
|
| | | import ChConfig
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | # @param query_Type 请求类型
|
| | |
| | | msgData = funResult[1]
|
| | |
|
| | | if msgType == "PackDataSyncState":
|
| | | isCross, isNeed = msgData
|
| | | __UpdPackDataSyncState(curPlayer, isCross, isNeed)
|
| | | PlayerViewCacheTube.UpdPackDataSyncState(curPlayer, msgData)
|
| | |
|
| | | elif msgType == "PullPlayerPackData":
|
| | | msgInfo = msgData
|
| | | __DoPullPlayerPackData(curPlayer, msgInfo, tick)
|
| | |
|
| | | return
|
| | |
|
| | | def __UpdPackDataSyncState(curPlayer, isCross, isNeed):
|
| | | ## 更新打包数据同步状态,这里只更新状态即可,具体同步由定时同步处理
|
| | | syncState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PackDataSyncState)
|
| | | if isCross:
|
| | | updSyncState = (1 if isNeed else 0) * 10 + syncState % 10
|
| | | else:
|
| | | updSyncState = syncState / 10 + (1 if isNeed else 0)
|
| | | if syncState == updSyncState:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PackDataSyncState, syncState)
|
| | | GameWorld.DebugLog("更新打包数据同步状态: isCross=%s,isNeed=%s,syncState=%s,updSyncState=%s" |
| | | % (isCross, isNeed, syncState, updSyncState), curPlayer.GetPlayerID())
|
| | | elif msgType == "PullPlayerViewCache":
|
| | | msgInfo = msgData
|
| | | __DoPullPlayerViewCache(curPlayer, msgInfo, tick)
|
| | | |
| | | return
|
| | |
|
| | | def __DoPullPlayerPackData(curPlayer, msgInfo, tick):
|
| | | pullFrom = msgInfo.get("pullFrom")
|
| | | isCross = False
|
| | | # 0 或 非本服代表跨服需要
|
| | | if pullFrom == 0 or (pullFrom > 0 and pullFrom != GameWorld.GetServerGroupID()):
|
| | | isCross = True
|
| | | __UpdPackDataSyncState(curPlayer, isCross, 1)
|
| | | PlayerViewCacheTube.UpdateGameServerPlayerCache(curPlayer, tick, forcePackData=True, packMsg=msgInfo)
|
| | | PlayerViewCacheTube.SetPackDataCrossSyncState(curPlayer)
|
| | | else:
|
| | | PlayerViewCacheTube.SetPackDataSyncState(curPlayer)
|
| | | PlayerViewCacheTube.UpdateGameServerPlayerCache(curPlayer, tick, packMsg=msgInfo)
|
| | | return
|
| | |
|
| | |
|
| | | def __DoPullPlayerViewCache(curPlayer, msgInfo, tick):
|
| | | viewFrom = msgInfo.get("viewFrom")
|
| | | # 0 或 非本服代表跨服需要
|
| | | if viewFrom == 0 or (viewFrom > 0 and viewFrom != GameWorld.GetServerGroupID()):
|
| | | PlayerViewCacheTube.SetViewCacheCrossSyncState(curPlayer)
|
| | | PlayerViewCacheTube.UpdateGameServerPlayerCache(curPlayer, tick, packMsg=msgInfo, isOnlyViewCache=True)
|
| | | return
|
| | |
|