hxp
2018-10-26 e893a6cab624a161ae6c09dd48dfd1f1e97d929b
ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py
@@ -68,6 +68,7 @@
import GMT_CTG
import PyGameData
import GMShell
import IPY_PlayerDefine
#---------------------------------------------------------------------
#---------------------------------------------------------------------
@@ -77,7 +78,15 @@
#  @return None
#  @remarks 登陆顺序, PlayerLogin->PlayerLoadMapState(PlayerLoginLoadMapOK), 此处未设置初始化状态
def PlayerLogin(index, tick):
    GameWorld.GetPsycoFunc(__Func_PlayerLogin)(index, tick)
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    try:
        __Func_PlayerLogin(curPlayer, tick)
    except:
        curPlayer.Kick(IPY_PlayerDefine.disWaitForPlayerLoinError)
        import traceback
        GameWorld.ErrLog("玩家上线逻辑错误~~~~~\r\n%s" % traceback.format_exc())
        if GameWorld.GetGameWorld().GetDebugLevel():
            raise Exception("玩家上线逻辑错误~~~~\r\n%s" % traceback.format_exc())
    return
#---------------------------------------------------------------------
@@ -86,10 +95,8 @@
#  @param tick 当前时间
#  @return None
#  @remarks 登陆顺序, PlayerLogin->PlayerLoadMapState(PlayerLoginLoadMapOK), 此处未设置初始化状态
def __Func_PlayerLogin(index, tick):
def __Func_PlayerLogin(curPlayer, tick):
    
    #玩家登录初始化
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    #玩家在线时间初始化
    InitPlayerOnLineTime(curPlayer, tick)
    #玩家响应信息初始化
@@ -483,7 +490,16 @@
#  @return None
#  @remarks 函数详细说明.
def PlayerDisconnect(index, tick):
    GameWorld.GetPsycoFunc(__Func_PlayerDisconnect)(index, tick)
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    try:
        __Func_PlayerDisconnect(curPlayer, tick)
    except:
        import traceback
        GameWorld.ErrLog("玩家下线逻辑错误~~~~~\r\n%s" % traceback.format_exc())
        if GameWorld.GetGameWorld().GetDebugLevel():
            raise Exception("玩家下线逻辑错误~~~~\r\n%s" % traceback.format_exc())
    #调用底层下线
    curPlayer.DoDisconnect()
    return
## 玩家下线(封包参数)
@@ -491,8 +507,7 @@
#  @param tick 当前时间
#  @return None
#  @remarks 函数详细说明.
def __Func_PlayerDisconnect(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
def __Func_PlayerDisconnect(curPlayer, tick):
    
    #跨服匹配PK
    #GameWorldMergePK.OnLeaveServer(curPlayer)
@@ -510,8 +525,6 @@
    #MergePlayer.OnPlayerLeaveGotoMergeServer(curPlayer, tick)
    #------------镖车逻辑
    #TruckPlayerDisconnectProcess(curPlayer, tick)
    #调用底层下线
    curPlayer.DoDisconnect()
    return
## 设置玩家离线时间