コード例 #1
0
        public override string GetInfo()
        {
            string ret = "";
            string reqLab = "", reqCyclo = "", reqZoo = "";

            foreach (var r in requirements)
            {
                if (ret != "")
                {
                    ret += "\n";
                }
                ret += r.Value.name + " " + Localizer.Format("#autoLOC_StatSci_Req", r.Value.amount);
                if (r.Value.name == EUREKAS)
                {
                    reqLab = Localizer.Format("#autoLOC_StatSci_LabReq");
                }
                if (r.Value.name == KUARQS)
                {
                    double productionRequired = 0.01;
                    if (kuarqHalflife > 0)
                    {
                        if (ret != "")
                        {
                            ret += "\n";
                        }
                        ret += Localizer.Format("#autoLOC_StatSci_KuarkHalf", kuarqHalflife);
                        productionRequired = requirements[KUARQS].amount /* kuarqsRequired */ * (1 - Math.Pow(.5, 1.0 / kuarqHalflife));
                        ret += "\n";
                        ret += Localizer.Format("#autoLOC_StatSci_KuarkProd", productionRequired.ToString("F3"));
                    }
                    if (productionRequired > 1)
                    {
                        reqCyclo = Localizer.Format("#autoLOC_StatSci_CycReqM", Math.Ceiling(productionRequired));
                    }
                    else
                    {
                        reqCyclo = Localizer.Format("#autoLOC_StatSci_CycReq");
                    }
                }
                if (r.Value.name == BIOPRODUCTS)
                {
                    double bioproductDensity = ResourceHelper.getResourceDensity(BIOPRODUCTS);
                    if (bioproductDensity > 0)
                    {
                        ret += Localizer.Format("#autoLOC_StatSci_BioMass", Math.Round(requirements[BIOPRODUCTS].amount /* bioproductsRequired */ * bioproductDensity + part.mass, 2));
                    }
                    reqZoo = Localizer.Format("#autoLOC_StatSci_ZooReq");
                }
            }
#if false
            //if (eurekasRequired > 0)
            //{
            //    ret += Localizer.Format("#autoLOC_StatSci_EuReq", eurekasRequired);
            //    reqLab = Localizer.Format("#autoLOC_StatSci_LabReq");
            //}
            if (kuarqsRequired > 0)
            {
                if (ret != "")
                {
                    ret += "\n";
                }
                ret += Localizer.Format("#autoLOC_StatSci_KuarkReq", kuarqsRequired);
                double productionRequired = 0.01;
                if (kuarqHalflife > 0)
                {
                    if (ret != "")
                    {
                        ret += "\n";
                    }
                    ret += Localizer.Format("#autoLOC_StatSci_KuarkHalf", kuarqHalflife);
                    productionRequired = kuarqsRequired * (1 - Math.Pow(.5, 1.0 / kuarqHalflife));
                    ret += "\n";
                    ret += Localizer.Format("#autoLOC_StatSci_KuarkProd", productionRequired);
                }
                if (productionRequired > 1)
                {
                    reqCyclo = Localizer.Format("#autoLOC_StatSci_CycReqM", Math.Ceiling(productionRequired));
                }
                else
                {
                    reqCyclo = Localizer.Format("#autoLOC_StatSci_CycReq");
                }
            }
            if (bioproductsRequired > 0)
            {
                if (ret != "")
                {
                    ret += "\n";
                }
                ret += Localizer.Format("#autoLOC_StatSci_BioReq", bioproductsRequired);
                double bioproductDensity = ResourceHelper.getResourceDensity(BIOPRODUCTS);
                if (bioproductDensity > 0)
                {
                    ret += Localizer.Format("#autoLOC_StatSci_BioMass", Math.Round(bioproductsRequired * bioproductDensity + part.mass, 2));
                }
                reqZoo = Localizer.Format("#autoLOC_StatSci_ZooReq");
            }
#endif
            return(ret + reqLab + reqCyclo + reqZoo + "\n\n" + base.GetInfo());
        }
コード例 #2
0
 public double GetResourceMaxAmount(string name)
 {
     return(ResourceHelper.getResourceMaxAmount(part, name));
 }
コード例 #3
0
 public PartResource SetResourceMaxAmount(string name, double max)
 {
     return(ResourceHelper.setResourceMaxAmount(part, name, max));
 }
コード例 #4
0
 public PartResource GetResource(string name)
 {
     return(ResourceHelper.getResource(part, name));
 }