public void SetViewmodel(SystemMap_DrawableVM viewModel)
 {
     _viewModel = viewModel;
     viewModel.PropertyChanged += ViewModel_PropertyChanged;
     viewModel.SystemSubpulse.SystemDateChangedEvent += SystemSubpulse_SystemDateChangedEvent;
     IconEntitys_CollectionChanged();
 }
Beispiel #2
0
 public void SetViewmodel(SystemMap_DrawableVM viewModel)
 {
     _viewModel = viewModel;
     _viewModel.IconableEntitys.CollectionChanged    += IconableEntitys_CollectionChanged;
     viewModel.SystemSubpulse.SystemDateChangedEvent += SystemSubpulse_SystemDateChangedEvent;
     //IconEntitys_CollectionChanged();
     _iconCollection.Init(_viewModel.IconableEntitys, _camera2);
     Invalidate();
 }
        internal void SetSystem(FactionVM factionVM)
        {
            SysMap   = factionVM.SystemMap;
            _faction = _state.Faction;
            SysMap.SystemSubpulse.SystemDateChangedEvent += OnSystemDateChange;
            _state.CurrentSystemDateTime = SysMap.SystemSubpulse.SystemLocalDateTime;
            //_state.LastClickedEntity =

            foreach (var entityItem in SysMap.IconableEntitys)
            {
                var entityState = new EntityState()
                {
                    Entity = entityItem, Name = "Unknown"
                };

                if (entityItem.HasDataBlob <NameDB>())
                {
                    _nameIcons.Add(entityItem.Guid, new NameIcon(ref entityState, _state));
                }
                if (entityItem.HasDataBlob <OrbitDB>())
                {
                    var orbitDB = entityItem.GetDataBlob <OrbitDB>();
                    if (!orbitDB.IsStationary)
                    {
                        OrbitIcon orbit = new OrbitIcon(ref entityState, _state.UserOrbitSettings);
                        _orbitRings.Add(entityItem.Guid, orbit);
                    }
                }
                if (entityItem.HasDataBlob <StarInfoDB>())
                {
                    _entityIcons.Add(entityItem.Guid, new StarIcon(entityItem));
                }
                if (entityItem.HasDataBlob <SystemBodyInfoDB>())
                {
                    _entityIcons.Add(entityItem.Guid, new SysBodyIcon(entityItem));
                }
                if (entityItem.HasDataBlob <ShipInfoDB>())
                {
                    _entityIcons.Add(entityItem.Guid, new ShipIcon(entityItem));
                }

                IconEntityStates.Add(entityItem.Guid, entityState);
            }
            _state.LastClickedEntity = _state.MapRendering.IconEntityStates.Values.ElementAt(0);
        }