Esempio n. 1
0
        public void RequestLogin(SFNETPacket packetData, ConnectUser user)
        {
            try
            {
                var request = JsonEnDecode.Decode<JsonPacketRequestLogin>(packetData.GetData());

                // 이미 등록된 유저인가? serial, ID
                var result = UserManagerRef.AddUser(packetData.SessionID(), request.ID);

                var response = new JsonPacketResponseLogin() { Result = result };
                ServerNetworkRef.Send<JsonPacketResponseLogin>(packetData.SessionID(), PACKET_ID.RESPONSE_LOGIN, response);

                DevLog.Write(string.Format("[Login] result:{0}, UserID:{1}, SessionID{2}", result.ToString(), request.ID, packetData.SessionID()), LOG_LEVEL.INFO);
            }
            catch
            {
            }
        }
Esempio n. 2
0
        public ERROR_CODE AddUser(int sessionID, string userID)
        {
            if (UserSessionMap.ContainsKey(sessionID))
            {
                return ERROR_CODE.ERROR;
            }

            if (UserIDMap.ContainsKey(userID))
            {
                return ERROR_CODE.ERROR;
            }

            var user = new ConnectUser();
            user.SetInfo(sessionID, userID);

            UserSessionMap.Add(sessionID, user);
            UserIDMap.Add(userID, user);

            return ERROR_CODE.NONE;
        }