public File(SubjectData subjectData, double size = 0.0, bool useStockCrediting = false, string resultText = "") { this.subjectData = subjectData; this.size = size; this.useStockCrediting = useStockCrediting; if (string.IsNullOrEmpty(resultText)) { this.resultText = ResearchAndDevelopment.GetResults(subjectData.StockSubjectId); } else { this.resultText = resultText; } }
/// <summary> /// Return the result description (Experiment definition RESULTS node) for the subject_id. /// Same as the stock ResearchAndDevelopment.GetResults(subject_id) but can be forced to return a non-randomized result /// </summary> /// <param name="randomized">If true the result can be different each this is called</param> /// <param name="useGenericIfNotFound">If true, a generic text will be returned if no RESULTS{} definition exists</param> public static string SubjectResultDescription(string subject_id, bool useGenericIfNotFound = true) { string result = ResearchAndDevelopment.GetResults(subject_id); if (result == null) { result = string.Empty; } if (result == string.Empty && useGenericIfNotFound) { result = Lib.TextVariant( Local.SciencresultText1, //"Our researchers will jump on it right now" Local.SciencresultText2, //"This cause some excitement" Local.SciencresultText3, //"These results are causing a brouhaha in R&D" Local.SciencresultText4, //"Our scientists look very confused" Local.SciencresultText5); //"The scientists won't believe these readings" } return(result); }
public File(SubjectData subjectData, double size = 0.0, bool useStockCrediting = false, string resultText = "") { this.subjectData = subjectData; this.size = size; if (double.IsNaN(size)) { Lib.LogStack($"File has a NaN size on creation : {subjectData.DebugStateInfo}", Lib.LogLevel.Error); this.size = 0.0; } this.useStockCrediting = useStockCrediting; if (string.IsNullOrEmpty(resultText)) { this.resultText = ResearchAndDevelopment.GetResults(subjectData.StockSubjectId); } else { this.resultText = resultText; } }
public override void ShowMenu(StringBuilder menuString, int width, int height) { base.ShowMenu(menuString, width, height); menuString.AppendLine(); var scienceData = m_experimentModule.GetData().FirstOrDefault(); if (scienceData != null) { var subject = ResearchAndDevelopment.GetSubjectByID(scienceData.subjectID); Util.WordWrap(subject.title, menuString, width); // Some experiment results have multiple flavor texts, and GetResults returns a random one // So cache the subjectID and results string and only update results if the subject changes. if (m_subjectID != scienceData.subjectID) { m_results = ResearchAndDevelopment.GetResults(scienceData.subjectID); m_subjectID = scienceData.subjectID; } Util.WordWrap(m_results, menuString, width); } }