示例#1
0
文件: Action1007.cs 项目: 0jpq0/Scut
 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
        protected override bool CreateUserRole(out IUser user)
        {
            user = null;
            GameUser gameUser = new GameDataCacheSet<GameUser>().FindKey(Uid);
            if (gameUser == null)
            {
                var roleFunc = new RoleFunc();
                string msg;

                if (roleFunc.VerifyRange(UserName, out msg) ||
                    roleFunc.VerifyKeyword(UserName, out msg) ||
                    roleFunc.IsExistNickName(UserName, out msg))
                {
                    ErrorCode = Language.Instance.ErrorCode;
                    ErrorInfo = msg;
                    return false;
                }
                gameUser = CreateRole();
                roleFunc.OnCreateAfter(gameUser);
            }
            user = gameUser;
            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 = gameUser.Pid;
            userLoginLog.UserLv = gameUser.UserLv;
            var sender = DataSyncManager.GetDataSender();
            sender.Send(userLoginLog);

            return true;
        }