コード例 #1
0
ファイル: Action4009.cs プロジェクト: dongliang/Scut
        public override bool TakeAction()
        {
            //刷新副本奖励
            if (!PlotHelper.RefleshPrize(ContextUser.UserID, plotID))
            {
                //this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                //this.ErrorInfo = LanguageManager.GetLang().St4007_SaodangOver;
            }
            var sweepCacheSet     = new GameDataCacheSet <UserSweepPool>();
            var tempSweepPoolList = sweepCacheSet.FindAll(ContextUser.UserID, m => m.IsSend == false);

            tempSweepPoolList.QuickSort((x, y) =>
            {
                if (x == null && y == null)
                {
                    return(0);
                }
                if (x != null && y == null)
                {
                    return(1);
                }
                if (x == null)
                {
                    return(-1);
                }
                int result = 0;
                x.UserID   = x.UserID == null ? "" : x.UserID;
                y.UserID   = y.UserID == null ? "" : y.UserID;

                result = x.UserID.CompareTo(y.UserID);
                if (result == 0)
                {
                    if (x.TurnsNum < y.TurnsNum)
                    {
                        return(-1);
                    }
                    else if (x.TurnsNum > y.TurnsNum)
                    {
                        return(1);
                    }
                    else
                    {
                        if (x.BattleNum < y.BattleNum)
                        {
                            return(-1);
                        }
                        else if (x.BattleNum > y.BattleNum)
                        {
                            return(1);
                        }
                    }
                }
                return(result);
            });


            userEmbattleList = new GameDataCacheSet <UserEmbattle>().FindAll(ContextUser.UserID, m => m.GeneralID > 0 && m.MagicID == ContextUser.UseMagicID);

            foreach (UserSweepPool userSweepPool in tempSweepPoolList)
            {
                if (userSweepPool != null)
                {
                    sweepCacheSet.Delete(userSweepPool);
                }
            }

            var tempList = new List <UserSweepPool>(tempSweepPoolList);
            int pageSize = 12;
            int index    = 0;

            if (tempList.Count > pageSize)
            {
                index = tempList.Count - pageSize;
            }
            else
            {
                pageSize = tempList.Count;
            }
            if (tempList.Count > 0)
            {
                userSweepPoolList = tempList.GetRange(index, pageSize);
            }

            return(true);
        }