Exemplo n.º 1
0
        protected override bool CreateUserRole(out IUser user)
        {
            user = null;
            GameUser gameUser = new GameDataCacheSet <GameUser>().FindKey(UserId.ToString());

            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 = new SessionUser(gameUser);
            UserLoginLog userLoginLog = new UserLoginLog();

            userLoginLog.UserId     = UserId.ToString();
            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(new[] { userLoginLog });

            return(true);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
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);
     }
 }