예제 #1
0
        /// <summary>
        /// Initializes the IconCollection
        /// Creates Orbitrings, TextIcons and Entityicons and adds them to Collection
        /// </summary>
        /// <param name="entities"></param>
        /// <param name="camera"></param>
        public void Init(IEnumerable <Entity> entities, Camera2dv2 camera)
        {
            IconDict.Clear();
            OrbitList.Clear();
            TextIconList.Clear();
            EntityList.Clear();
            scale = new ScaleIcon(camera);

            foreach (var item in entities)
            {
                if (item.HasDataBlob <OrbitDB>() && item.GetDataBlob <OrbitDB>().Parent != null)
                {
                    OrbitRing ring = new OrbitRing(item, camera);
                    OrbitList.Add(ring);
                }
                if (item.HasDataBlob <NameDB>())
                {
                    TextIconList.Add(new TextIcon(item, camera));
                }


                EntityIcon entIcon = new EntityIcon(item, camera);
                EntityList.Add(entIcon);


                IconDict.Add(item.Guid, entIcon);
            }
        }
예제 #2
0
        internal void HandleChange(EntityChangeData changeData)
        {
            if (changeData.ChangeType == EntityChangeData.EntityChangeType.DBAdded)
            {
                if (changeData.Datablob is OrbitDB && changeData.Entity.GetDataBlob <OrbitDB>().Parent != null)
                {
                    if (!((OrbitDB)changeData.Datablob).IsStationary)
                    {
                        OrbitList[changeData.Entity.Guid] = new OrbitRing(changeData.Entity, _camera);
                    }
                }
                if (changeData.Datablob is NameDB)
                {
                    TextIconList[changeData.Entity.Guid] = new TextIcon(changeData.Entity, _camera);
                }

                IconDict[changeData.Entity.Guid] = new EntityIcon(changeData.Entity, _camera);
            }
            if (changeData.ChangeType == EntityChangeData.EntityChangeType.DBRemoved)
            {
                if (changeData.Datablob is OrbitDB)
                {
                    OrbitList.Remove(changeData.Entity.Guid);
                }
                if (changeData.Datablob is NameDB)
                {
                    TextIconList.Remove(changeData.Entity.Guid);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Initializes the IconCollection
        /// Creates Orbitrings, TextIcons and Entityicons and adds them to Collection
        /// </summary>
        /// <param name="entities"></param>
        /// <param name="camera"></param>
        public void Init(IEnumerable <Entity> entities, Camera2dv2 camera)
        {
            IconDict.Clear();
            OrbitList.Clear();
            TextIconList.Clear();
            EntityList.Clear();
            _camera = camera;
            Scale   = new ScaleIcon(_camera);

            foreach (var item in entities)
            {
                AddNewIcon(item);
            }
        }
예제 #4
0
 internal void RemoveIcon(Entity entity)
 {
     if (OrbitList.ContainsKey(entity.Guid))
     {
         OrbitList.Remove(entity.Guid);
     }
     if (TextIconList.ContainsKey(entity.Guid))
     {
         TextIconList.Remove(entity.Guid);
     }
     if (IconDict.ContainsKey(entity.Guid))
     {
         IconDict.Remove(entity.Guid);
     }
 }
예제 #5
0
        internal void AddNewIcon(Entity entity)
        {
            if (entity.HasDataBlob <OrbitDB>() && entity.GetDataBlob <OrbitDB>().Parent != null)
            {
                if (!entity.GetDataBlob <OrbitDB>().IsStationary)
                {
                    OrbitRing ring = new OrbitRing(entity, _camera);
                    OrbitList.Add(entity.Guid, ring);
                }
            }
            if (entity.HasDataBlob <NameDB>())
            {
                TextIconList.Add(entity.Guid, new TextIcon(entity, _camera));
            }

            EntityIcon entIcon = new EntityIcon(entity, _camera);

            EntityList.Add(entity.Guid, entIcon);
            IconDict.Add(entity.Guid, entIcon);
        }