コード例 #1
0
ファイル: Unlocked.cs プロジェクト: narfman0/BountyBandits
        public static UnlockedManager fromXML(XmlElement xmlElement)
        {
            UnlockedManager manager = new UnlockedManager();

            foreach (XmlElement element in xmlElement.GetElementsByTagName("difficultyUnlocked"))
            {
                DifficultyProgress prog = DifficultyProgress.fromXML(element);
                manager.campaignsUnlocked.Add(new Guid(element.GetAttribute("guid")), prog);
            }
            return(manager);
        }
コード例 #2
0
ファイル: Unlocked.cs プロジェクト: narfman0/BountyBandits
        public void add(MapManager mapManager, DifficultyEnum difficulty)
        {
            if (!campaignsUnlocked.ContainsKey(mapManager.guid))
            {
                campaignsUnlocked.Add(mapManager.guid, new DifficultyProgress());
            }
            DifficultyProgress diffProgress = campaignsUnlocked[mapManager.guid];

            if (!diffProgress.difficultiesUnlocked.ContainsKey(difficulty))
            {
                diffProgress.difficultiesUnlocked.Add(difficulty, new LevelsUnlocked());
            }
            LevelsUnlocked unlocked = diffProgress.difficultiesUnlocked[difficulty];

            if (!unlocked.isUnlocked(mapManager.getCurrentLevelIndex()))
            {
                unlocked.levelsUnlocked.Add(mapManager.getCurrentLevelIndex());
            }
        }
コード例 #3
0
ファイル: Unlocked.cs プロジェクト: narfman0/BountyBandits
        public static DifficultyProgress fromXML(XmlElement element)
        {
            DifficultyProgress progress = new DifficultyProgress();

            foreach (XmlElement levelsNode in element)
            {
                DifficultyEnum difficulty = (DifficultyEnum)Enum.Parse(typeof(DifficultyEnum), levelsNode.GetAttribute("difficulty"));
                List <int>     levels     = new List <int>();
                foreach (String level in levelsNode.GetAttribute("levels").Split(','))
                {
                    try
                    {
                        levels.Add(int.Parse(level));
                    }
                    catch (Exception e) { System.Console.Write(e.StackTrace); }
                }
                progress.difficultiesUnlocked.Add(difficulty, new LevelsUnlocked(levels));
            }
            return(progress);
        }