Example #1
0
        public override int Sort(PlaylistLevel a, PlaylistLevel b)
        {
            var levelSetsManager = G.Sys.LevelSets_;
            var aDifficulty      = levelSetsManager.GetLevelInfo(a.level.levelNameAndPath_.levelPath_).difficulty_;
            var bDifficulty      = levelSetsManager.GetLevelInfo(b.level.levelNameAndPath_.levelPath_).difficulty_;
            var aIndex           = aDifficulty != LevelDifficulty.None ? LevelFilterDifficulty.difficultyRanks.IndexOf(aDifficulty) : -1;
            var bIndex           = bDifficulty != LevelDifficulty.None ? LevelFilterDifficulty.difficultyRanks.IndexOf(bDifficulty) : -1;

            if (aIndex == bIndex)
            {
                return(0);
            }
            else if (aIndex == -1)
            {
                return(isPositive ? 1 : -1);
            }
            else if (bIndex == -1)
            {
                return(isPositive ? -1 : 1);
            }
            else
            {
                return(aIndex - bIndex);
            }
        }
Example #2
0
        public override int Sort(PlaylistLevel a, PlaylistLevel b)
        {
            var   levelSetsManager = G.Sys.LevelSets_;
            var   aLevelInfo       = levelSetsManager.GetLevelInfo(a.level.levelNameAndPath_.levelPath_);
            var   bLevelInfo       = levelSetsManager.GetLevelInfo(b.level.levelNameAndPath_.levelPath_);
            float aTime            = a.level.mode_.IsTimeBased() && aLevelInfo.SupportsMedals(a.level.mode_)
                ? aLevelInfo.GetMedalRequirementTime(medal)
                : -1;
            float bTime = b.level.mode_.IsTimeBased() && bLevelInfo.SupportsMedals(b.level.mode_)
                ? bLevelInfo.GetMedalRequirementTime(medal)
                : -1;

            if (aTime == -1 && bTime == -1)
            {
                return(0);
            }
            else if (aTime == -1)
            {
                return(isPositive ? 1 : -1);
            }
            else if (bTime == -1)
            {
                return(isPositive ? -1 : 1);
            }
            else
            {
                return((int)((aTime - bTime) * 1000f));
            }
        }
Example #3
0
        public override int Sort(PlaylistLevel a, PlaylistLevel b)
        {
            if (!SteamworksManager.IsSteamBuild_)
            {
                return(0);
            }
            var levelSetsManager = G.Sys.LevelSets_;
            var ugc = G.Sys.SteamworksManager_.UGC_;
            WorkshopLevelInfo aWorkshopLevelInfo;
            WorkshopLevelInfo bWorkshopLevelInfo;

            ugc.TryGetWorkshopLevelData(levelSetsManager.GetLevelInfo(a.level.levelNameAndPath_.levelPath_).relativePath_, out aWorkshopLevelInfo);
            ugc.TryGetWorkshopLevelData(levelSetsManager.GetLevelInfo(b.level.levelNameAndPath_.levelPath_).relativePath_, out bWorkshopLevelInfo);
            if (aWorkshopLevelInfo == null && bWorkshopLevelInfo == null)
            {
                return(0);
            }
            else if (aWorkshopLevelInfo == null)
            {
                return(isPositive ? 1 : -1);
            }
            else if (bWorkshopLevelInfo == null)
            {
                return(isPositive ? -1 : 1);
            }
            else
            {
                int aVoteScore = (int)Math.Floor((aWorkshopLevelInfo.voteScore_ / 0.2f) / roundTo + 0.5f);
                int bVoteScore = (int)Math.Floor((bWorkshopLevelInfo.voteScore_ / 0.2f) / roundTo + 0.5f);
                return(bVoteScore - aVoteScore);
            }
        }
        public override int Sort(PlaylistLevel a, PlaylistLevel b)
        {
            var levelSetsManager = G.Sys.LevelSets_;
            var aAuthor          = GeneralUtilities.getAuthorName(levelSetsManager.GetLevelInfo(a.level.levelNameAndPath_.levelPath_));
            var bAuthor          = GeneralUtilities.getAuthorName(levelSetsManager.GetLevelInfo(b.level.levelNameAndPath_.levelPath_));

            return(aAuthor.ToLower().CompareTo(bAuthor.ToLower()));
        }
 public override int Sort(PlaylistLevel a, PlaylistLevel b)
 {
     if (!indexIndex.ContainsKey(a) && !indexIndex.ContainsKey(b))
     {
         return(0);
     }
     else if (!indexIndex.ContainsKey(a))
     {
         return(isPositive ? 1 : -1);
     }
     else if (!indexIndex.ContainsKey(b))
     {
         return(isPositive ? -1 : 1);
     }
     return(indexIndex[a] - indexIndex[b]);
 }
        public override int Sort(PlaylistLevel a, PlaylistLevel b)
        {
            if (!SteamworksManager.IsSteamBuild_)
            {
                return(0);
            }
            var levelSetsManager = G.Sys.LevelSets_;
            var ugc = G.Sys.SteamworksManager_.UGC_;
            WorkshopLevelInfo aWorkshopLevelInfo;
            WorkshopLevelInfo bWorkshopLevelInfo;

            ugc.TryGetWorkshopLevelData(levelSetsManager.GetLevelInfo(a.level.levelNameAndPath_.levelPath_).relativePath_, out aWorkshopLevelInfo);
            ugc.TryGetWorkshopLevelData(levelSetsManager.GetLevelInfo(b.level.levelNameAndPath_.levelPath_).relativePath_, out bWorkshopLevelInfo);
            if (aWorkshopLevelInfo == null && bWorkshopLevelInfo == null)
            {
                return(0);
            }
            else if (aWorkshopLevelInfo == null)
            {
                return(isPositive ? 1 : -1);
            }
            else if (bWorkshopLevelInfo == null)
            {
                return(isPositive ? -1 : 1);
            }
            else
            {
                if (aWorkshopLevelInfo.timeUpdated_ < bWorkshopLevelInfo.timeUpdated_)
                {
                    return(-1);
                }
                else if (bWorkshopLevelInfo.timeUpdated_ < aWorkshopLevelInfo.timeUpdated_)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }
Example #7
0
        public override int Sort(PlaylistLevel a, PlaylistLevel b)
        {
            var aIndex = modes.IndexOf(a.level.mode_);
            var bIndex = modes.IndexOf(a.level.mode_);

            if (aIndex == bIndex)
            {
                return(0);
            }
            else if (aIndex == -1)
            {
                return(isPositive ? 1 : -1);
            }
            else if (bIndex == -1)
            {
                return(isPositive ? -1 : 1);
            }
            else
            {
                return(aIndex - bIndex);
            }
        }
Example #8
0
 public override int Sort(PlaylistLevel a, PlaylistLevel b)
 {
     return(a.level.levelNameAndPath_.levelName_.ToLower().CompareTo(b.level.levelNameAndPath_.levelName_.ToLower()));
 }
Example #9
0
 public override int Sort(PlaylistLevel a, PlaylistLevel b)
 {
     return(shuffleIndex[a] - shuffleIndex[b]);
 }
Example #10
0
 public abstract int Sort(PlaylistLevel a, PlaylistLevel b);