public static XElement CreateAchievementCondition(AchievementConditionInfo info) { return(new XElement("Item_Condiction", new object[] { new XAttribute("AchievementID", info.AchievementID), new XAttribute("CondictionID", info.CondictionID), new XAttribute("CondictionType", info.CondictionType), new XAttribute("Condiction_Para1", info.Condiction_Para1), new XAttribute("Condiction_Para2", info.Condiction_Para2) })); }
public static Dictionary <int, List <AchievementConditionInfo> > LoadAchievementConditionInfoDB(Dictionary <int, AchievementInfo> achievementInfos) { Dictionary <int, List <AchievementConditionInfo> > dictionary = new Dictionary <int, List <AchievementConditionInfo> >(); using (ProduceBussiness produceBussiness = new ProduceBussiness()) { AchievementConditionInfo[] aLlAchievementCondition = produceBussiness.GetALlAchievementCondition(); using (Dictionary <int, AchievementInfo> .ValueCollection.Enumerator enumerator = achievementInfos.Values.GetEnumerator()) { Func <AchievementConditionInfo, bool> func = null; AchievementInfo achievementInfo; while (enumerator.MoveNext()) { achievementInfo = enumerator.Current; if (func == null) { func = ((AchievementConditionInfo s) => s.AchievementID == achievementInfo.ID); } IEnumerable <AchievementConditionInfo> enumerable = aLlAchievementCondition.Where(func); dictionary.Add(achievementInfo.ID, enumerable.ToList <AchievementConditionInfo>()); if (enumerable != null) { foreach (AchievementConditionInfo current in enumerable) { if (!AchievementMgr.m_distinctCondition.Contains(current.CondictionType)) { AchievementMgr.m_distinctCondition.Add(current.CondictionType, current.CondictionType); } } } } } AchievementConditionInfo[] array = aLlAchievementCondition; for (int i = 0; i < array.Length; i++) { AchievementConditionInfo achievementConditionInfo = array[i]; int condictionType = achievementConditionInfo.CondictionType; int condiction_Para = achievementConditionInfo.Condiction_Para2; if (!AchievementMgr.m_recordLimit.ContainsKey(condictionType)) { AchievementMgr.m_recordLimit.Add(condictionType, new List <int>()); } if (!AchievementMgr.m_recordLimit[condictionType].Contains(condiction_Para)) { AchievementMgr.m_recordLimit[condictionType].Add(condiction_Para); } } foreach (int current2 in AchievementMgr.m_recordLimit.Keys) { AchievementMgr.m_recordLimit[current2].Sort(); } } return(dictionary); }