Ejemplo n.º 1
0
 void Grid_GridItems(object sender, GridItemsEventArgs e)
 {
     foreach (MapItem item in e.Items)
     {
         if (item is MapAgentLocation)
         {
             MapAgentLocation loc = (MapAgentLocation)item;
             lock (regionMapItems)
             {
                 if (!regionMapItems.ContainsKey(item.RegionHandle))
                 {
                     regionMapItems[loc.RegionHandle] = new List <MapItem>();
                 }
                 regionMapItems[loc.RegionHandle].Add(loc);
             }
             if (loc.AvatarCount > 0)
             {
                 needRepaint = true;
             }
         }
     }
 }
Ejemplo n.º 2
0
        void Grid_GridItems(object sender, GridItemsEventArgs e)
        {
            lock (regionCacheSync)
            {
                hasRegionDataChanged = true;
            }

            int avatarCount = 0;

            if (e.Items.Count == 0)
            {
                return;
            }

            foreach (var mapItem in e.Items)
            {
                MapAgentLocation agentLocation = mapItem as MapAgentLocation;
                if (agentLocation == null)
                {
                    continue;
                }

                avatarCount += agentLocation.AvatarCount;
            }

            ulong regionHandle = e.Items[0].RegionHandle;

            lock (regionCacheSync)
            {
                if (!regionCacheTemp.ContainsKey(regionHandle))
                {
                    regionCacheTemp.Add(regionHandle, new RegionData());
                }

                regionCacheTemp[regionHandle].AgentCount = avatarCount;
            }
        }