Example #1
0
        private static void RegisterChallengeConflictGroup <ChallengeType>(BMChallengeInfo info)
        {
            foreach (EChallengeConflictGroup conflictGroup in info.ConflictGroups)
            {
                if (!conflictGroupDict.ContainsKey(conflictGroup))
                {
                    conflictGroupDict[conflictGroup] = new List <Type>();
                }

                conflictGroupDict[conflictGroup].Add(typeof(ChallengeType));
            }
        }
Example #2
0
        /// <summary>
        /// Sets the cancellations for the given Challenge.
        /// </summary>
        private static void RegisterCancellations(Type challengeType, BMChallengeInfo challengeInfo)
        {
            UnlockWrapper    unlock        = challengeInfo.UnlockBuilder.Unlock;
            HashSet <string> cancellations = new HashSet <string>();

            // cancel all Challenges in this conflictGroup
            if (challengeInfo.ConflictGroups.Count > 0)
            {
                foreach (string cancelChallenge in challengeInfo.ConflictGroups
                         .SelectMany(group => conflictGroupDict[group])
                         .Where(type => type != challengeType)                        // prevent Challenge from cancelling itself
                         .Select(GetChallengeInfo)
                         .Where(info => info != null)
                         .Select(info => info.Name))
                {
                    cancellations.Add(cancelChallenge);
                }
            }

            // TODO conflicts with vanilla Challenges

            unlock.SetCancellations(cancellations);
        }
Example #3
0
 public static void RegisterChallenge <ChallengeType>(BMChallengeInfo info)
 {
     info.FinalizeInfo();
     registeredChallenges.Add(typeof(ChallengeType), info);
     RegisterChallengeConflictGroup <ChallengeType>(info);
 }