Example #1
0
 public void SetAllPro(GameRunStatus status, bool flag, int num)
 {
     runStatus         = status;
     isCatch           = flag;
     currentGameNumber = num;
     SaveData();
 }
Example #2
0
 public void SetGameNumber(int num)
 {
     currentGameNumber = num;
     if (num < 0)
     {
         currentGameNumber = 4;
         isCatch           = false;
         runStatus         = GameRunStatus.GameEnd;
     }
     SaveData();
 }
Example #3
0
 public void SetRunStatus(GameRunStatus status)
 {
     runStatus = status;
     SaveData();
 }
        protected override bool CreateUserRole(out IUser user)
        {
            user = null;
            UserBasisCache basis = UserHelper.FindUserBasis(UserId);

            if (basis == null)
            {
                var    nickNameCheck = new NickNameCheck();
                var    KeyWordCheck  = new KeyWordCheck();
                string msg;

                if (nickNameCheck.VerifyRange(UserName, out msg) ||
                    KeyWordCheck.VerifyKeyword(UserName, out msg) ||
                    nickNameCheck.IsExistNickName(UserName, out msg))
                {
                    ErrorCode = Language.Instance.ErrorCode;
                    ErrorInfo = msg;
                    return(false);
                }


                basis = CreateRole(UserId, Sid, ServerID, Pid, RetailID, UserName, profession, HeadID);
                if (basis != null)
                {
                    /// 邀请处理
                    if (!string.IsNullOrEmpty(unid))
                    {
                        var selflist    = Util.FindUserCenterUser(Pid, RetailID, ServerID);
                        var inviterlist = Util.FindUserCenterUser(unid, RetailID, ServerID);
                        if (inviterlist.Count > 0 && inviterlist[0].UserID != 0 && Pid != unid)
                        {
                            if (selflist.Count > 0 && string.IsNullOrEmpty(selflist[0].Unid))
                            {
                                inviterUserId    = inviterlist[0].UserID;
                                selflist[0].Unid = unid;
                            }
                        }
                    }
                }
                else
                {
                    return(false);
                }

                nickNameCheck.OnCreateAfter(basis);
            }
            else
            {
                return(false);
            }

            UserLoginLog userLoginLog = new UserLoginLog();

            userLoginLog.UserId     = UserId.ToString();
            userLoginLog.SessionID  = Sid;
            userLoginLog.MobileType = MobileType;
            userLoginLog.ScreenX    = ScreenX;
            userLoginLog.ScreenY    = ScreenY;
            userLoginLog.RetailId   = RetailID;
            userLoginLog.AddTime    = DateTime.Now;
            userLoginLog.State      = LoginStatus.Logined;
            userLoginLog.DeviceID   = DeviceID;
            userLoginLog.Ip         = GetRealIP();
            userLoginLog.Pid        = basis.Pid;
            userLoginLog.UserLv     = basis.UserLv;
            var sender = DataSyncManager.GetDataSender();

            sender.Send(new[] { userLoginLog });

            user = new SessionUser(basis);



            // 记录删档测试登录老用户
            GameRunStatus gameRunStatus = ConfigUtils.GetSetting("Game.RunStatus").ToEnum <GameRunStatus>();

            if (gameRunStatus == GameRunStatus.DeleteFileTest)
            {
                OldUserLog record = new OldUserLog()
                {
                    UserID     = basis.UserID,
                    OpenID     = basis.Pid,
                    NickName   = basis.NickName,
                    AvatarUrl  = basis.AvatarUrl,
                    CreateDate = DateTime.Now,
                };
                //var oldUserSet = new ShareCacheStruct<OldUserRecord>();
                //oldUserSet.AddOrUpdate(record);
                sender.Send(new[] { record });

                MailData mail = new MailData()
                {
                    ID      = Guid.NewGuid().ToString(),
                    Title   = "《勇者之怒》删档测试通知",
                    Sender  = "系统",
                    Date    = DateTime.Now,
                    Context = "尊敬的玩家,您好,欢迎您进入我们的游戏,目前游戏正在删档封测阶段,如果您在游戏中遇到任何问题,请及时联系qq 2602611792处理。\n" +
                              "  本次测试时间为7月11日~7月18日,测试结束后,我们将清空所有玩家数据,请玩家牢记角色ID以及昵称,及时联系平台客服兑换奖励,没有获奖的玩家也可以在游戏正式上线时" +
                              "使用测试时的账号登录游戏可以享受充值3倍钻石优惠以及领取老玩家大礼包一份,千万不要错过哟!",
                };
                UserHelper.AddNewMail(basis.UserID, mail, false);
            }
            else if (gameRunStatus == GameRunStatus.OfficialOperation)
            {
                if (new MemoryCacheStruct <OldUserCache>().Find(t => (t.OpenID == basis.Pid)) != null)
                {// 是删档测试老用户发放奖励
                 //MailData mail = new MailData()
                 //{
                 //    ID = Guid.NewGuid().ToString(),
                 //    Title = "老用户回归奖励",
                 //    Sender = "系统",
                 //    Date = DateTime.Now,
                 //    Context = "感谢您再次登录勇者之怒,这是您的回归奖励!",
                 //};
                 //UserHelper.AddNewMail(basis.UserID, mail, false);
                }
            }

            return(true);
        }