Exemple #1
0
        /// <summary>
        /// Initializes the store of zone items with data
        /// </summary>
        public void InitializeStore()
        {
            this.zoneService.Initialize();

            var continents = this.zoneService.GetContinents();
            foreach (var continent in continents)
            {
                this.Data.Add(continent.Id, new ContinentZoneItems(continent.Id));
            }

            foreach (var continent in this.Data)
            {
                var zoneItems = this.zoneService.GetZoneItemsByContinent(continent.Key);

                Threading.InvokeOnUI(() => continent.Value.Clear());

                foreach (var entity in zoneItems)
                {
                    var zoneItem = new ZoneItemViewModel(entity, this.playerService, this.zoneUserData);
                    Threading.InvokeOnUI(() =>
                    {
                        continent.Value.Add(zoneItem);
                    });
                }
            }

            Threading.BeginInvokeOnUI(() => this.RaiseDataLoadedEvent());
        }
Exemple #2
0
        /// <summary>
        /// Adds a new zone item/objective various collections 
        /// </summary>
        /// <param name="zoneItem">The zone item/objective to add</param>
        public void Add(ZoneItemViewModel zoneItem)
        {
            var mapId = zoneItem.ItemModel.MapId;
            if (!this.ZoneItemsByMap.ContainsKey(mapId))
                this.ZoneItemsByMap.Add(mapId, new ZoneItems(mapId));

            switch (zoneItem.ItemType)
            {
                case API.Data.Enums.ZoneItemType.Dungeon:
                    this.Dungeons.Add(zoneItem);
                    this.ZoneItemsByMap[mapId].Dungeons.Add(zoneItem);
                    break;
                case API.Data.Enums.ZoneItemType.HeartQuest:
                    this.HeartQuests.Add(zoneItem);
                    this.ZoneItemsByMap[mapId].HeartQuests.Add(zoneItem);
                    break;
                case API.Data.Enums.ZoneItemType.HeroPoint:
                    this.HeroPoints.Add(zoneItem);
                    this.ZoneItemsByMap[mapId].HeroPoints.Add(zoneItem);
                    break;
                case API.Data.Enums.ZoneItemType.PointOfInterest:
                    this.POIs.Add(zoneItem);
                    this.ZoneItemsByMap[mapId].POIs.Add(zoneItem);
                    break;
                case API.Data.Enums.ZoneItemType.Vista:
                    this.Vistas.Add(zoneItem);
                    this.ZoneItemsByMap[mapId].Vistas.Add(zoneItem);
                    break;
                case API.Data.Enums.ZoneItemType.Waypoint:
                    this.Waypoints.Add(zoneItem);
                    this.ZoneItemsByMap[mapId].Waypoints.Add(zoneItem);
                    break;
                default:
                    break;
            }
        }