示例#1
0
        public override bool TakeAction()
        {
            m_ResponsePacket.Authorized = false;
            GameSession session = actionGetter.GetSession();

            if (string.IsNullOrEmpty(m_RequestPacket.AccountName))
            {
                ErrorCode = (int)ErrorType.EmptyInput;
                ErrorInfo = "empty account name";
                return(false);
            }
            if (CheckAuthorize())
            {
                m_ResponsePacket.Authorized = true;
            }
            else
            {
                session.Close();
                ErrorCode = (int)ErrorType.WrongInput;
                ErrorInfo = "Wrong password or account name";
                return(false);
            }

            if (m_Player.MyPlayer == null)
            {
                m_ResponsePacket.NewAccount = true;
                m_Player.AddPlayer();
            }
            else if (string.IsNullOrEmpty(m_Player.MyPlayer.Name))
            {
                //CacheSet.PlayerCache.Delete(m_Player.MyPlayer);
                m_ResponsePacket.NewAccount = true;
                //m_Player.AddPlayer();
            }
            else
            {
                m_ResponsePacket.NewAccount = false;
            }

            m_Player.OnLine(session);
            return(true);
        }