Beispiel #1
0
        public void HandleLogout(Int64 nSessionID)
        {
            FFLog.Trace(string.Format("PlayerHandler.HandleLogout {0}", nSessionID));
            Player player = RoleMgr.Instance().GetPlayerBySessionID(nSessionID);

            if (player == null)
            {
                return;
            }
            RoleMgr.Instance().RemoveRole(nSessionID);

            Pbmsg.LogoutRet retMsg = new Pbmsg.LogoutRet()
            {
                Id   = player.GetID(),
                Name = player.strName,
            };
            FFWorker.Instance().GateBroadcastMsg((int)Pbmsg.ServerCmdDef.SLogout, retMsg);

            if (player.playerYS != null && RoleMgr.Instance().GetPlayerBySessionID(player.playerYS.nSessionID) != null)
            {
                RoleMgr.Instance().RemoveRole(player.playerYS.nSessionID);;
                retMsg = new Pbmsg.LogoutRet()
                {
                    Id   = player.playerYS.GetID(),
                    Name = player.playerYS.strName,
                };
                FFWorker.Instance().GateBroadcastMsg((int)Pbmsg.ServerCmdDef.SLogout, retMsg);
            }
            return;
        }
Beispiel #2
0
        public EmptyMsgRet OnSessionOfflineReq(SessionOfflineReq reqMsg)
        {
            Int64 nSessionID = reqMsg.SessionId;

            FFLog.Trace(string.Format("worker OnSessionOfflineReq! {0}", nSessionID));
            if (m_dictRoles.ContainsKey(nSessionID) == false)
            {
                return(RPC_NONE);
            }

            Player player = GetPlayerBySessionID(nSessionID);

            m_dictRoles.Remove(nSessionID);


            Pbmsg.LogoutRet retMsg = new Pbmsg.LogoutRet()
            {
                Id   = player.GetID(),
                Name = player.strName,
            };
            BroadcastPlayerMsg <Pbmsg.LogoutRet>(Pbmsg.ServerCmdDef.SLogout, retMsg);

            if (player.playerYS != null && m_dictRoles.ContainsKey(player.playerYS.nSessionID) != false)
            {
                m_dictRoles.Remove(player.playerYS.nSessionID);
                retMsg = new Pbmsg.LogoutRet()
                {
                    Id   = player.playerYS.GetID(),
                    Name = player.playerYS.strName,
                };
                BroadcastPlayerMsg <Pbmsg.LogoutRet>(Pbmsg.ServerCmdDef.SLogout, retMsg);
            }
            return(RPC_NONE);
        }