示例#1
0
 private void OnKctFacilityUpgdQueued(FacilityUpgrade data)
 {
     if (!data.FacilityType.HasValue)
     {
         return;                                 // can be null in case of third party mods that define custom facilities
     }
     AddFacilityConstructionEvent(data.FacilityType.Value, data.UpgradeLevel, data.Cost, ConstructionState.Started);
 }
示例#2
0
 private void OnKctFacilityUpgdComplete(FacilityUpgrade data)
 {
     if (CareerEventScope.ShouldIgnore || !data.FacilityType.HasValue)
     {
         return;                                                                  // can be null in case of third party mods that define custom facilities
     }
     AddFacilityConstructionEvent(data.FacilityType.Value, data.UpgradeLevel, data.Cost, ConstructionState.Completed);
 }
示例#3
0
 private void OnKctFacilityUpgdComplete(FacilityUpgrade data)
 {
     Debug.Log($"[RP-0] OnKctFacilityUpgdComplete");
     if (!data.FacilityType.HasValue)
     {
         return;                                 // can be null in case of third party mods that define custom facilities
     }
     CareerLog.Instance?.AddFacilityConstructionEvent(data.FacilityType.Value, data.UpgradeLevel, data.Cost, ConstructionState.Completed);
 }
示例#4
0
 public void Bind(FacilityUpgrade data)
 {
     isUpgrading = true;
     Bind(data.New);
     txtName.Text = "Upgrade to " + txtName.Text;
 }
示例#5
0
 public FacilityReport(FacilityUpgrade fu)
 {
     InitializeComponent();
     Bind(fu);
 }
示例#6
0
 public UpgradeFacilityOrder(FacilityUpgrade fu)
 {
     Owner   = Empire.Current;
     Upgrade = fu;
 }
示例#7
0
        private void BindUpgradeListView(IEnumerable <FacilityTemplate> templates)
        {
            int i       = 0;
            var ilFacil = new ImageList();

            ilFacil.ImageSize          = new Size(32, 32);
            lstUpgrades.LargeImageList = ilFacil;
            lstUpgrades.SmallImageList = ilFacil;
            lstUpgrades.Items.Clear();
            if (ConstructionQueue.Colony != null)
            {
                foreach (var g in ConstructionQueue.Colony.Facilities.GroupBy(f => f.Template).OrderBy(g => g.Key.Group).ThenBy(g => g.Key.Name))                 // TODO - roman numeral sorting
                {
                    var oldf = g.Key;

                    // facilites which are not yet upgraded
                    var count = g.Count() - ConstructionQueue.Orders.OfType <UpgradeFacilityOrder>().Where(o => o.Upgrade.Old == oldf).Count();

                    if (count > 0)
                    {
                        foreach (var newf in templates)
                        {
                            if (ConstructionQueue.CanConstruct(newf))
                            {
                                var group = lstFacilities.Groups.Cast <ListViewGroup>().SingleOrDefault(g2 => g2.Header == newf.Group);
                                if (newf.Family.Value == oldf.Family.Value && newf.ModID != oldf.ModID)
                                {
                                    if (group == null)
                                    {
                                        group = new ListViewGroup(newf.Group);
                                        lstUpgrades.Groups.Add(group);
                                    }
                                    string name;
                                    if (count == 1)
                                    {
                                        name = oldf.Name;
                                    }
                                    else
                                    {
                                        name = count + "x " + oldf.Name;
                                    }
                                    var item = new ListViewItem(name + " to " + newf.Name, i, group);
                                    item.ImageIndex = i;
                                    var fu = new FacilityUpgrade(oldf, newf);
                                    item.Tag = fu;
                                    var cost = newf.Cost * Mod.Current.Settings.UpgradeFacilityPercentCost / 100;
                                    var eta  = cost.Keys.Max(res => (double)(cost[res]) / (double)ConstructionQueue.Rate[res]);
                                    item.SubItems.Add(new ListViewItem.ListViewSubItem(item, eta.CeilingString(1)));
                                    ilFacil.Images.Add(newf.Icon);
                                    lstUpgrades.Items.Add(item);
                                    if (fu.IsObsolete)
                                    {
                                        item.ForeColor = Color.Gray;
                                    }
                                    else if (fu.IsObsolescent)
                                    {
                                        item.ForeColor = Color.Yellow;
                                    }
                                    i++;
                                }
                            }
                        }
                    }
                }
            }
        }