public void RefreshOrders(int a, int b) { if (SelectedShip == null) { return; } _moveOrdersPossible.Clear(); if (SelectedShip.HasDataBlob <PropulsionDB>()) { _moveOrdersPossible.Add(new MoveOrder(), "Move to"); } _moveOrdersPossible.SelectedIndex = 0; RefreshOrderList(0, 0); OnPropertyChanged(nameof(SelectedMoveOrder)); OnPropertyChanged(nameof(SelectedPossibleMoveOrder)); OnPropertyChanged(nameof(ShipSpeed)); OnPropertyChanged(nameof(XSpeed)); OnPropertyChanged(nameof(YSpeed)); OnPropertyChanged(nameof(XPos)); OnPropertyChanged(nameof(YPos)); OnPropertyChanged(nameof(MaxSpeed)); return; }
public void RefreshFireControlList(int a, int b) { _fireControlList.Clear(); if (SelectedShip == null) { return; } if (!SelectedShip.HasDataBlob <BeamWeaponsDB>()) { _fireControlList.Clear(); return; } var instanceDB = SelectedShip.GetDataBlob <ComponentInstancesDB>(); if (instanceDB.TryGetComponentsByAttribute <BeamFireControlAtbDB>(out var fcList)) { int fcCount = 0; foreach (var item in fcList) { fcCount++; _fireControlList.Add(item, item.GetName()); } } //List<KeyValuePair<Entity, List<Entity>>> fcList = EntityStoreHelpers.GetComponentsOfType<BeamFireControlAtbDB>(instanceDB.SpecificInstances); //new List<KeyValuePair<Entity, List<Entity>>>(instanceDB.SpecificInstances.ToDictionary().Where(item => item.Key.HasDataBlob<BeamFireControlAtbDB>()).ToList()); /* * foreach (KeyValuePair<Entity, List<Entity>> kvp in fcList) * { * int fcCount = 0; * if (kvp.Key.HasDataBlob<BeamFireControlAtbDB>()) * foreach(Entity instance in kvp.Value) * { * fcCount++; * _fireControlList.Add(instance, kvp.Key.GetDataBlob<NameDB>().DefaultName + fcCount); * } * * * } */ _fireControlList.SelectedIndex = 0; RefreshBeamWeaponsList(0, 0); // OnPropertyChanged(nameof(FireControlList)); }
public void RefreshFireControlList(int a, int b) { _fireControlList.Clear(); if (SelectedShip == null) { return; } if (!SelectedShip.HasDataBlob <BeamWeaponsDB>()) { _fireControlList.Clear(); return; } // The component instances all seem to think that their parent entity is Ensuing Calm, regardless of SelectedShip var instanceDB = SelectedShip.GetDataBlob <ComponentInstancesDB>(); List <KeyValuePair <Entity, List <Entity> > > fcList = EntityStoreHelpers.GetComponentsOfType <BeamFireControlAtbDB>(instanceDB.SpecificInstances); //new List<KeyValuePair<Entity, List<Entity>>>(instanceDB.SpecificInstances.ToDictionary().Where(item => item.Key.HasDataBlob<BeamFireControlAtbDB>()).ToList()); foreach (KeyValuePair <Entity, List <Entity> > kvp in fcList) { int fcCount = 0; if (kvp.Key.HasDataBlob <BeamFireControlAtbDB>()) { foreach (Entity instance in kvp.Value) { fcCount++; _fireControlList.Add(instance, kvp.Key.GetDataBlob <NameDB>().DefaultName + fcCount); } } } _fireControlList.SelectedIndex = 0; RefreshBeamWeaponsList(0, 0); // OnPropertyChanged(nameof(FireControlList)); }