public void SelectGroup(ShipGroupInfo group, long quantity, double population) { if (group == null) { throw new ArgumentNullException(nameof(group)); } quantity = Methods.Clamp(quantity, 0, group.Quantity); if (quantity <= 0) { this.DeselectGroup(group); return; } var minPopulation = group.Population - (group.Quantity - quantity) * group.Design.ColonizerPopulation; population = Methods.Clamp(population, minPopulation, group.Population); this.selection[group.Data.Design] = new ShipSelection(quantity, this.selection[group.Data.Design].Ships, population); this.calcCarriers(); if (!this.CanMove) { this.simulationWaypoints.Clear(); } this.calcSimulation(); }
public void DeselectGroup(ShipGroupInfo group) { this.selection[group.Data.Design] = new ShipSelection(0, this.selection[group.Data.Design].Ships, 0); if (!this.CanMove) { this.simulationWaypoints.Clear(); } }
public void DeselectGroup(ShipGroupInfo group) { selection.Remove(group.Data.Design); if (!this.CanMove) { this.simulationWaypoints.Clear(); } }
public long SelectionCount(ShipGroupInfo group) { if (group == null) { throw new ArgumentNullException(nameof(group)); } return(this.selection[group.Data.Design].Quantity); }
public void SelectGroup(ShipGroupInfo group, long quantity) { if (group == null) { throw new ArgumentNullException(nameof(group)); } this.SelectGroup(group, quantity, group.Population * quantity / (double)group.Quantity); }
public double SelectionPopulation(ShipGroupInfo group) { if (group == null) { throw new ArgumentNullException(nameof(group)); } return(this.selection[group.Data.Design].Population); }
public void SetData(ShipGroupInfo groupInfo, PlayerInfo owner) { this.Data = groupInfo; var thousandsFormat = new ThousandsFormatter(); this.hullThumbnail.Image = ImageCache.Get[groupInfo.Design.ImagePath]; this.hullThumbnail.BackColor = owner.Color; this.quantityLabel.Text = this.Data.Design.Name + Environment.NewLine + thousandsFormat.Format(groupInfo.Quantity); }
private string shipGroupText(ShipGroupInfo group) { var selected = this.selectedFleetControl.SelectionCount(group); if (selected == 0 || selected == group.Quantity) { return(group.Design.Name + Environment.NewLine + new ThousandsFormatter().Format(group.Quantity)); } var thousandsFormat = new ThousandsFormatter(group.Quantity); return(group.Design.Name + Environment.NewLine + thousandsFormat.Format(selected) + " / " + thousandsFormat.Format(group.Quantity)); }
public void DeselectGroup(ShipGroupInfo group) { if (group == null) { throw new ArgumentNullException(nameof(group)); } this.selection[group.Data.Design] = new ShipSelection(0, this.selection[group.Data.Design].Ships, 0); this.calcCarriers(); if (!this.CanMove) { this.simulationWaypoints.Clear(); } }
public bool IsTowed(ShipGroupInfo group) { if (group == null) { throw new ArgumentNullException(nameof(group)); } var selected = this.selectedCount(group.Design.Data); if (selected == 0 || group.Design.Data.IsDrive != null) { return(false); } return(this.carriedSelection.ContainsKey(group.Design.Data) && this.CanMove); }
public bool IsCarried(ShipGroupInfo group) { if (group == null) { throw new ArgumentNullException(nameof(group)); } var selected = this.selectedCount(group.Design.Data); if (selected == 0) { return(false); } return(!this.carriedSelection.TryGetValue(group.Design.Data, out var uncarried) || uncarried < selected); }
public void SelectGroup(ShipGroupInfo group, long quantity) { quantity = Methods.Clamp(quantity, 0, this.Fleet.FleetData.Ships.WithDesign[group.Data.Design].Quantity); selection[group.Data.Design] = quantity; if (selection[group.Data.Design] <= 0) { selection.Remove(group.Data.Design); } if (!this.CanMove) { this.simulationWaypoints.Clear(); } this.calcEta(); }
private IEnumerable <Sprite> shipImages(ShipGroupInfo x) { yield return(new Sprite(GalaxyTextures.Get.Sprite(x.Design.ImagePath))); var traits = new List <TextureInfo>(); if (this.selectedFleetControl.IsCarried(x)) { traits.Add(GalaxyTextures.Get.Hangar); } if (this.selectedFleetControl.IsTowed(x)) { traits.Add(GalaxyTextures.Get.Tow); } for (int i = 0; i < traits.Count; i++) { yield return(new Sprite( traits[i], Color.White, Matrix4.CreateScale(0.3f, 0.3f, 1) * Matrix4.CreateTranslation(0.3f, -0.3f + i * 0.35f, 0))); } }
public double SelectionPopulation(ShipGroupInfo group) { return(this.selection[group.Data.Design].Population); }
public long SelectionCount(ShipGroupInfo group) { return(this.selection[group.Data.Design].Quantity); }
public void SelectGroup(ShipGroupInfo group, long quantity) { this.SelectGroup(group, quantity, group.Population * quantity / (double)group.Quantity); }