Пример #1
0
 public override bool TakeAction()
 {
     try
     {
         var roleFunc = new RoleFunc();
         string msg;
         if (roleFunc.VerifyRange(_nickName, out msg) ||
             roleFunc.IsExistNickName(_nickName, out msg))
         {
             ErrorCode = LanguageManager.GetLang().ErrorCode;
             ErrorInfo = LanguageManager.GetLang().St1005_NickNameExist;
             return false;
         }
         return true;
     }
     catch (Exception ex)
     {
         SaveLog(ex);
         return false;
     }
 }
Пример #2
0
        public override bool TakeAction()
        {
            GameUser user = new GameDataCacheSet<GameUser>().FindKey(Uid);
            if (user == null)
            {
                var roleFunc = new RoleFunc();
                string msg;

                if (roleFunc.VerifyRange(UserName, out msg) ||
                    roleFunc.VerifyKeyword(UserName, out msg) ||
                    roleFunc.IsExistNickName(UserName, out msg))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = msg;
                    return false;
                }
                user = CreateRole();
                roleFunc.OnCreateAfter(user);
            }
            Current.User = user;
            UserLoginLog userLoginLog = new UserLoginLog();
            userLoginLog.UserId = Uid;
            userLoginLog.SessionID = Sid;
            userLoginLog.MobileType = (short)MobileType;
            userLoginLog.ScreenX = ScreenX;
            userLoginLog.ScreenY = ScreenY;
            userLoginLog.RetailId = RetailID;
            userLoginLog.AddTime = DateTime.Now;
            userLoginLog.State = (short)LoginStatus.Logined;
            userLoginLog.DeviceID = DeviceID;
            userLoginLog.Ip = GetRealIP();
            userLoginLog.Pid = user.Pid;
            userLoginLog.UserLv = user.UserLv;
            var sender = DataSyncManager.GetDataSender();
            sender.Send(userLoginLog);

            return true;
        }