コード例 #1
0
        public void Move(object item, object category)
        {
            var ach  = (WowHeadAchievement)item;
            var zone = ((VisualCategory)category).Zone;

            // Remove the old one
            Zone zoneToRemoveFrom    = null;
            Ach  achievementToRemove = null;

            foreach (var sc in this.Achievements.supercats)
            {
                foreach (var c in sc.cats)
                {
                    foreach (var z in c.zones)
                    {
                        foreach (var a in z.achs)
                        {
                            if (a.id == ach.Achievement.id.ToString())
                            {
                                zoneToRemoveFrom    = z;
                                achievementToRemove = a;
                            }
                        }
                    }
                }
            }

            if (zoneToRemoveFrom != null)
            {
                zoneToRemoveFrom.achs.Remove(achievementToRemove);
            }
            else
            {
                throw new ApplicationException("Could not find zone to remove achievement from");
            }

            var achiev = new Ach()
            {
                id         = ach.Achievement.id.ToString(),
                icon       = ach.Achievement.icon,
                side       = FormatSide(ach.Achievement.factionId),
                points     = ach.Achievement.points,
                obtainable = false,
                criteria   = new Dictionary <string, string>()
            };

            zone.achs.Add(achiev);
        }
コード例 #2
0
        public void Add(object item, object category)
        {
            var wowHeadAchievement = (WowHeadAchievement)item;
            var zone = ((VisualCategory)category).Zone;

            var ach = new Ach()
            {
                id         = wowHeadAchievement.Achievement.id.ToString(),
                icon       = wowHeadAchievement.Achievement.icon,
                side       = FormatSide(wowHeadAchievement.Achievement.factionId),
                points     = wowHeadAchievement.Achievement.points,
                obtainable = true,
                criteria   = new Dictionary <string, string>()
            };

            zone.achs.Add(ach);
        }