Esempio n. 1
0
        public void SystemClientDisConnected(SFNETPacket packet)
        {
            var user = UserManagerRef.GetUser(packet.SessionID());

            if (user == null)
            {
                return;
            }

            if (user.LobbyID > 0)
            {
                var jsonData = new JsonPacketRequestLeaveLobby()
                {
                    LobbyID = user.LobbyID, UserID = user.UserID
                };
                var bodyData = JsonEnDecode.Encode <JsonPacketRequestLeaveLobby>(jsonData);

                var InnerPacket = new CgsfNET64Lib.SFNETPacket();
                InnerPacket.SetData(-1, (ushort)PACKET_ID.REQUEST_LEAVE_LOBBY, bodyData);
                RelayPacketPacketProcess.RelayPacket(user.LobbyID, InnerPacket);
            }


            var result = UserManagerRef.RemoveUser(packet.SessionID());

            InnerMessageQueue.CurrentUserCount(UserManagerRef.GetConnectCount());

            DevLog.Write(string.Format("Client DisConnected. SessionID: {0}", packet.SessionID()), LOG_LEVEL.INFO);
        }
Esempio n. 2
0
        public void SystemClientConnect(SFNETPacket packet)
        {
            var result = UserManagerRef.AddUser(packet.SessionID());

            InnerMessageQueue.CurrentUserCount(UserManagerRef.GetConnectCount());

            if (result == CSCommonLib.ERROR_CODE.NONE)
            {
                DevLog.Write(string.Format("Client Connect. SessionID: {0}", packet.SessionID()), LOG_LEVEL.INFO);
            }
            else
            {
                DevLog.Write(string.Format("Client Connect. SessionID: {0}, Error:{1}", packet.SessionID(), result.ToString()), LOG_LEVEL.ERROR);
            }
        }