public static bool DefIsBeingUsed(this List <AssemblyLineUpgrade> baseList, AssemblyLineUpgradeDef def)
 {
     if (baseList.Count > 0)
     {
         foreach (var upgrade in baseList)
         {
             if (upgrade.Def == def)
             {
                 return(true);
             }
         }
         return(false);
     }
     return(false);
 }
Exemple #2
0
        private void DrawAvailableUpgradeEntry(AssemblyLineUpgradeDef def, float currentScrollY)
        {
            Rect currentEntryRect = new Rect(margin, currentScrollY, upgradeEntrySize.x, upgradeEntrySize.y);

            Widgets.DrawMenuSection(currentEntryRect);
            Rect   innerRect = currentEntryRect.ContractedBy(4f);
            string s         = "MD2BuildingMaterials".Translate() + "\n";

            foreach (var item in def.RequiredMaterials)
            {
                s += item.amount.ToString() + " " + item.thing.LabelCap + "\n";
            }
            s += "InstallUpgradeTimeToComplete".Translate(TicksToTime.GetTime(def.workTicksAmount));
            TooltipHandler.TipRegion(innerRect, s);
            Vector2 butSize = new Vector2(60f, innerRect.height / 2);
            float   padding = 2f;

            try
            {
                GUI.BeginGroup(innerRect);

                Rect textBox = new Rect(0, 0, innerRect.width / 2, innerRect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                Widgets.Label(textBox, def.label);
                //Text.Anchor = TextAnchor.UpperLeft;

                Rect butRect = new Rect(innerRect.width - (butSize.x + padding), innerRect.height / 2 - (butSize.y / 2), butSize.x, butSize.y);
                if (Widgets.TextButton(butRect, "UpgradeInstall".Translate()))
                {
                    UpgradesInProgress.Add(new AssemblyLineUpgrade(def));
                }
            }
            finally
            {
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.EndGroup();
            }
        }
 public AssemblyLineUpgrade(AssemblyLineUpgradeDef def)
 {
     this.def             = def;
     this.billOfMaterials = new BillOfMaterials(def.RequiredMaterials);
 }
 public AssemblyLineUpgrade(AssemblyLineUpgradeDef def)
 {
     this.def = def;
     this.billOfMaterials = new BillOfMaterials(def.RequiredMaterials);
 }
        private void DrawAvailableUpgradeEntry(AssemblyLineUpgradeDef def, float currentScrollY)
        {
            Rect currentEntryRect = new Rect(margin, currentScrollY, upgradeEntrySize.x, upgradeEntrySize.y);
            Widgets.DrawMenuSection(currentEntryRect);
            Rect innerRect = currentEntryRect.ContractedBy(4f);
            string s = "MD2BuildingMaterials".Translate() + "\n";
            foreach (var item in def.RequiredMaterials)
            {
                s += item.amount.ToString() + " " + item.thing.LabelCap + "\n";
            }
            s += "InstallUpgradeTimeToComplete".Translate(TicksToTime.GetTime(def.workTicksAmount));
            TooltipHandler.TipRegion(innerRect, s);
            Vector2 butSize = new Vector2(60f, innerRect.height / 2);
            float padding = 2f;

            try
            {
                GUI.BeginGroup(innerRect);

                Rect textBox = new Rect(0, 0, innerRect.width / 2, innerRect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                Widgets.Label(textBox, def.label);
                //Text.Anchor = TextAnchor.UpperLeft;

                Rect butRect = new Rect(innerRect.width - (butSize.x + padding), innerRect.height / 2 - (butSize.y / 2), butSize.x, butSize.y);
                if (Widgets.TextButton(butRect, "UpgradeInstall".Translate()))
                {
                    UpgradesInProgress.Add(new AssemblyLineUpgrade(def));
                }
            }
            finally
            {
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.EndGroup();
            }
        }