Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
        }