コード例 #1
0
        public void UpdateIngotDisplay(IngotStockpiles ingotStockpiles)
        {
            if (ingotStatusScreen == null)
            {
                return;
            }

            // Clear previous state.
            local_UpdateIngotDisplay_builder.Clear();

            // Clear previous state.
            local_UpdateIngotDisplay_builder.AppendFormat("Ingot stockpiles  {0}\n", Datestamp.Minutes);

            foreach (var stockpile in ingotStockpiles)
            {
                local_UpdateIngotDisplay_builder.Append(stockpile.Ingot.ItemType.SubtypeId);
                local_UpdateIngotDisplay_builder.Append(":  ");

                if (stockpile.QuotaFraction >= 20)
                {
                    local_UpdateIngotDisplay_builder.AppendFormat("{0:0}x", stockpile.QuotaFraction);
                }
                else if (stockpile.QuotaFraction >= 2)
                {
                    local_UpdateIngotDisplay_builder.AppendFormat("{0:0.#}x", stockpile.QuotaFraction);
                }
                else
                {
                    local_UpdateIngotDisplay_builder.AppendFormat("{0:#000%}", stockpile.QuotaFraction);
                }

                local_UpdateIngotDisplay_builder.AppendFormat("   {0} / {1}",
                                                              Unit.Mass.FormatSI((float)stockpile.CurrentQuantity),
                                                              Unit.Mass.FormatSI((float)stockpile.TargetQuantity));

                if (stockpile.QuotaFraction < 1)
                {
                    local_UpdateIngotDisplay_builder.Append(" (!)");
                }
                local_UpdateIngotDisplay_builder.AppendLine();
            }
            ingotStatusScreen.WriteText(local_UpdateIngotDisplay_builder.ToString());
        }
コード例 #2
0
 public SystemState(StaticState staticState)
 {
     Static = staticState;
     Ingots = new IngotStockpiles(staticState.IngotTypes.All.Select(i => new IngotStockpile(i)));
 }