Exemplo n.º 1
0
 private void FinishUpgrade(AssemblyLineUpgrade upgrade)
 {
     Messages.Message("UpgradeCompleted".Translate(parent.label, upgrade.Def.label), MessageSound.Benefit);
     parent.AddUpgrade(upgrade);
     UpgradesInProgress.Remove(upgrade);
     CompletedUpgrades.Add(upgrade.Def);
 }
Exemplo n.º 2
0
        private void DrawUpgradeInProgressEntry(AssemblyLineUpgrade upgrade, float currentScrollY)
        {
            Rect currentEntryRect = new Rect(margin, currentScrollY, upgradeEntrySize.x, upgradeEntrySize.y);

            Widgets.DrawMenuSection(currentEntryRect);
            Rect    innerRect = currentEntryRect.ContractedBy(4f);
            Vector2 butSize   = new Vector2(60f, innerRect.height / 2);

            Widgets.FillableBar(currentEntryRect, upgrade.PercentageComplete, FillableBarTex, null, false);

            try
            {
                GUI.BeginGroup(innerRect);

                Text.Anchor = TextAnchor.MiddleLeft;
                float width     = Text.CalcSize(upgrade.Def.LabelCap).x;
                Rect  labelRect = new Rect(0f, 0f, width, innerRect.height);
                Widgets.Label(labelRect, upgrade.Def.LabelCap);

                string s;
                if (upgrade.BillOfMaterials.HasMats)
                {
                    s = "MD2Progress".Translate((upgrade.PercentageComplete * 100).ToString("0.0\\%"));
                    TooltipHandler.TipRegion(innerRect, "UpgradeInstallTimeRemaining".Translate(TicksToTime.GetTime(upgrade.TicksRemaining)));
                }
                else
                {
                    s = upgrade.BillOfMaterials.ReportString;
                }
                Text.Anchor = TextAnchor.MiddleLeft;
                Rect progressRect = new Rect(innerRect.width / 2 - (Text.CalcSize(s).x), innerRect.yMin, innerRect.width, innerRect.height);
                Widgets.Label(progressRect, s);
            }
            finally
            {
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.EndGroup();
            }
        }
Exemplo n.º 3
0
        public void AddUpgrade(AssemblyLineUpgrade upgrade)
        {
            AssemblyLineProperty property = GetProperty(upgrade.Def.PropertyToAffect);

            property.Value += upgrade.Def.PercentageDecrease * -1;
        }
Exemplo n.º 4
0
 public void AddUpgrade(AssemblyLineUpgrade upgrade)
 {
     AssemblyLineProperty property = GetProperty(upgrade.Def.PropertyToAffect);
     property.Value += upgrade.Def.PercentageDecrease * -1;
 }
Exemplo n.º 5
0
 private void FinishUpgrade(AssemblyLineUpgrade upgrade)
 {
     Messages.Message("UpgradeCompleted".Translate(parent.label, upgrade.Def.label), MessageSound.Benefit);
     parent.AddUpgrade(upgrade);
     UpgradesInProgress.Remove(upgrade);
     CompletedUpgrades.Add(upgrade.Def);
 }
Exemplo n.º 6
0
        private void DrawUpgradeInProgressEntry(AssemblyLineUpgrade upgrade, float currentScrollY)
        {
            Rect currentEntryRect = new Rect(margin, currentScrollY, upgradeEntrySize.x, upgradeEntrySize.y);
            Widgets.DrawMenuSection(currentEntryRect);
            Rect innerRect = currentEntryRect.ContractedBy(4f);
            Vector2 butSize = new Vector2(60f, innerRect.height / 2);
            Widgets.FillableBar(currentEntryRect, upgrade.PercentageComplete, FillableBarTex, null, false);

            try
            {
                GUI.BeginGroup(innerRect);

                Text.Anchor = TextAnchor.MiddleLeft;
                float width = Text.CalcSize(upgrade.Def.LabelCap).x;
                Rect labelRect = new Rect(0f, 0f, width, innerRect.height);
                Widgets.Label(labelRect, upgrade.Def.LabelCap);

                string s;
                if (upgrade.BillOfMaterials.HasMats)
                {
                    s = "MD2Progress".Translate((upgrade.PercentageComplete * 100).ToString("0.0\\%"));
                    TooltipHandler.TipRegion(innerRect, "UpgradeInstallTimeRemaining".Translate(TicksToTime.GetTime(upgrade.TicksRemaining)));
                }
                else
                {
                    s = upgrade.BillOfMaterials.ReportString;
                }
                Text.Anchor = TextAnchor.MiddleLeft;
                Rect progressRect = new Rect(innerRect.width / 2 - (Text.CalcSize(s).x), innerRect.yMin, innerRect.width, innerRect.height);
                Widgets.Label(progressRect, s);
            }
            finally
            {
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.EndGroup();
            }
        }