internal void SetSystem(FactionVM factionVM) { if (_sysState != null) { _sysState.StarSystem.ManagerSubpulses.SystemDateChangedEvent -= OnSystemDateChange; _sysState.StarSystem.GetSensorContacts(_faction.Guid).Changes.Unsubscribe(_sensorChanges); } if (_state.StarSystemStates.ContainsKey(factionVM.SystemMap.StarSystem.Guid)) { _sysState = _state.StarSystemStates[factionVM.SystemMap.StarSystem.Guid]; } else { _sysState = new SystemState(factionVM.SystemMap.StarSystem, factionVM.FactionEntity); _state.StarSystemStates[_sysState.StarSystem.Guid] = _sysState; } var starSys = _sysState.StarSystem; _faction = _state.Faction; starSys.ManagerSubpulses.SystemDateChangedEvent += OnSystemDateChange; _sensorMgr = starSys.GetSensorContacts(_faction.Guid); _sensorChanges = _sensorMgr.Changes.Subscribe(); _state.SetActiveSystem(starSys.Guid); foreach (var entityItem in _sysState.EntityStatesWithPosition.Values) { AddIconable(entityItem); } _state.LastClickedEntity = _sysState.EntityStatesWithPosition.Values.ElementAt(0); }
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); }