Ejemplo n.º 1
0
        /// <summary>
        /// 子类实现Action处理
        /// </summary>
        /// <returns></returns>
        public override bool TakeAction()
        {
            ILogin login = LoginProxy.GetLogin();

            if (login != null && login.CheckLogin())
            {
                Uid        = login.UserID;
                Sid        = Current.SessionId;
                UserId     = Uid.ToInt();
                PassportId = login.PassportID;
                var session = GameSession.Get(Sid);
                if (session != null)
                {
                    session.BindIdentity(UserId);
                }
                UserType = SnsManager.GetUserType(PassportId);
                SetParameter(login);
                if (!GetError() && DoSuccess(UserId))
                {
                    if (UserFactory != null)
                    {
                        var user = UserFactory(UserId);
                        if (user != null)
                        {
                            Current.User       = user;
                            user.RemoteAddress = httpGet.RemoteAddress;
                        }
                    }
                    return(true);
                }
            }
            else
            {
                Uid       = string.Empty;
                Sid       = string.Empty;
                ErrorCode = Language.Instance.ErrorCode;
                ErrorInfo = Language.Instance.PasswordError;
            }
            return(false);
        }
Ejemplo n.º 2
0
        public override bool TakeAction()
        {
            ILogin login = LoginProxy.GetLogin();

            if (login != null && login.CheckLogin())
            {
                Uid        = login.UserID;
                Sid        = httpGet.SessionId;//string.Format("{0}|{1}|{2}", login.SessionID, GameType, ServerID);
                UserId     = Uid.ToInt();
                PassportId = login.PassportID;
                UserType   = SnsManager.GetUserType(PassportId);
                SetParameter(login);
                InitContext(actionId, UserId);
                using (RequestLock())
                {
                    if (!GetError() && DoSuccess(UserId))
                    {
                        if (UserFactory != null)
                        {
                            var user = UserFactory(UserId);
                            if (user != null)
                            {
                                user.RemoteAddress = httpGet.RemoteAddress;
                                user.SocketSid     = httpGet.SessionId;
                                httpGet.LoginSuccessCallback(UserId);
                            }
                        }
                        return(true);
                    }
                }
            }
            else
            {
                Uid       = string.Empty;
                Sid       = string.Empty;
                ErrorCode = LanguageHelper.GetLang().ErrorCode;
                ErrorInfo = LanguageHelper.GetLang().PasswordError;
            }
            return(false);
        }