示例#1
0
        public override bool TakeAction()
        {
            var         allActivities = CacheSet.ActivityTable.GetAllData();
            PlayerLogic p             = new PlayerLogic();

            p.SetUser(m_UserId);
            foreach (var activity in allActivities)
            {
                PBActivityInfo activityInfo = new PBActivityInfo();
                activityInfo.Id     = activity.Id;
                activityInfo.Status = LobbyServerUtils.GetActivityStatus(activity, p.MyPlayer.Level);
                if (activityInfo.Status == (int)ActivityStatusType.Hidden)
                {
                    continue;
                }
                switch ((ActivityType)activity.Id)
                {
                case ActivityType.TurnOverChess:
                    PlayerChessLogic pc = new PlayerChessLogic();
                    pc.SetUser(m_UserId);
                    activityInfo.Progress   = pc.MyChess.Count == 0 ? 0 : 1;
                    activityInfo.CountLimit = 1;
                    break;

                case ActivityType.OfflineArena:
                    PlayerArenaLogic pa = new PlayerArenaLogic();
                    pa.SetUser(m_UserId);
                    activityInfo.Progress   = pa.MyArena.ChallengeCount;
                    activityInfo.CountLimit = GameConsts.Arena.DailyChallengeCount;
                    break;

                case ActivityType.GearFoundry:
                    PlayerFoundryLogic pf = new PlayerFoundryLogic();
                    pf.SetUser(m_UserId);
                    activityInfo.Progress   = pf.GetProgress();
                    activityInfo.CountLimit = 1;
                    break;

                case ActivityType.CosmosCrack:
                    PlayerCosmosCrackLogic pcc = new PlayerCosmosCrackLogic();
                    pcc.SetUser(m_UserId);
                    var cosmosInfo = pcc.GetCosmosCrackInstanceInfo();
                    activityInfo.Progress   = cosmosInfo == null ? 0 : cosmosInfo.PassedRoundCount;
                    activityInfo.CountLimit = cosmosInfo == null ? 0 : GameConfigs.GetInt("Cosmos_Crack_Round_Limit", 10);
                    break;

                default:
                    ErrorCode = (int)ErrorType.CannotOpenChance;
                    ErrorInfo = "invalid activity type";
                    return(false);
                }
                m_ResponsePacket.ActivityInfo.Add(activityInfo);
            }
            return(true);
        }