示例#1
0
        protected virtual string GenerateCostText()
        {
            string result = "";

            // Write out the cost line
            string costLine = "";

            if (InitialCostFunds != 0)
            {
                costLine += "<color=#B4D455>£ " + InitialCostFunds.ToString("N0") + "    </color>";
            }
            if (InitialCostScience != 0)
            {
                costLine += "<color=#6DCFF6>© " + InitialCostScience.ToString("N0") + "    </color>";
            }
            if (InitialCostReputation != 0)
            {
                costLine += "<color=#E0D503>¡ " + InitialCostReputation.ToString("N0") + "    </color>";
            }
            if (!string.IsNullOrEmpty(costLine))
            {
                result += "\n<b><color=#EDED8B>Setup Cost:</color></b> " + costLine + "\n";
            }

            return(result);
        }
示例#2
0
        protected virtual string GenerateRequirementText()
        {
            string result = "";

            // Write out stock-based requirements
            result += "\n<b><color=#feb200>Requirements:</color></b>\n\n";
            if (InitialCostFunds > 0)
            {
                double currentFunds = Funding.Instance.Funds;
                bool   fundsMet     = Math.Round(currentFunds) >= Math.Round(InitialCostFunds);
                string text         = "At least " + InitialCostFunds.ToString("N0") + " funds";
                if (!fundsMet)
                {
                    text += " (Current funds: " + Math.Round(currentFunds) + ")";
                }
                result += RequirementText(text, fundsMet);
            }
            if (InitialCostScience > 0)
            {
                double currentScience = ResearchAndDevelopment.Instance.Science;
                bool   scienceMet     = Math.Round(currentScience) >= Math.Round(InitialCostScience);
                string text           = "At least " + InitialCostScience.ToString("N0") + " science";
                if (!scienceMet)
                {
                    text += " (Current science: " + Math.Round(currentScience) + ")";
                }
                result += RequirementText(text, scienceMet);
            }
            if (RequiredReputation > -1000 || InitialCostReputation > 0)
            {
                float  reputationNeeded  = Math.Max(RequiredReputation, InitialCostReputation > 0 ? InitialCostReputation : -1000);
                float  currentReputation = Reputation.Instance.reputation;
                bool   repMet            = Math.Round(currentReputation) >= Math.Round(reputationNeeded);
                string text = "At least " + reputationNeeded.ToString("N0") + " reputation";
                if (!repMet)
                {
                    text += " (Current reputation: " + Math.Round(currentReputation) + ")";
                }
                result += RequirementText(text, repMet);
            }
            int minFacilityLevel = MinimumFacilityLevel();

            if (minFacilityLevel > 1)
            {
                int currentLevel = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.Administration) *
                                                   ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.Administration)) + 1;
                result += RequirementText("Administration Facility Level " + minFacilityLevel,
                                          currentLevel >= minFacilityLevel);
            }

            // Requirements from strategies
            foreach (StrategyEffect effect in Effects)
            {
                IRequirementEffect requirementEffect = effect as IRequirementEffect;
                if (requirementEffect != null)
                {
                    string unmetReason;
                    bool   requirementMet = requirementEffect.RequirementMet(out unmetReason);
                    string text           = requirementEffect.RequirementText();
                    if (!requirementMet && !string.IsNullOrEmpty(unmetReason))
                    {
                        text += " (" + unmetReason + ")";
                    }
                    result += RequirementText(text, requirementMet);
                }
            }

            return(result);
        }