示例#1
0
        void OnReconnect(string sessionID, CBReconnectRequest msg)
        {
            Logger.Log($"{sessionID} Reconnect with token: {msg.Token} ");

            UserData user = null;

            if (!m_users.TryGetValue(msg.Token, out user))
            {
                Logger.LogError($"RECONNECT => {sessionID}'s token {msg.Token} is wrong, refuse reconnect.");
                return;
            }

            if (GetProxy <RoomProxy>().GetRoom(user.roomID) == null)
            {
                Logger.LogError($"RECONNECT => {sessionID}'s token {msg.Token} is wrong, refuse reconnect.");
                CBReconnectReply rep = new CBReconnectReply();
                rep.RoomState = (int)SOS.SOS_Logic.State.Dismiss;
                SendMessage(sessionID, rep);
                return;
            }

            SOS.SOS_Logic sosLogic = GetProxy <BattleServerProxy>().GetSosLogic(user.roomID);

            user.SetSessionID(sessionID);
            if (sosLogic.state == SOS.SOS_Logic.State.Started)
            {
                user.SetState(UserState.Battle);
            }
            else
            {
                user.SetState(UserState.Login);
            }

            CBReconnectReply reply = sosLogic.GetReconnectData(user.uid);

            SendMessage(sessionID, reply);
        }
示例#2
0
 public void NewPvL(int id)
 {
     SOS.SOS_Logic logic = new SOS.SOS_Logic();
     logic.Init(id);
     m_pvlLogics.Add(id, logic);
 }
 public SOS.SOS_Logic GetSosLogic(int roomID)
 {
     SOS.SOS_Logic logic = null;
     m_pvlLogics.TryGetValue(roomID, out logic);
     return(logic);
 }