コード例 #1
0
ファイル: Experiment.cs プロジェクト: Simoyd/KSP-X-Science
 /// <summary>
 /// Creates a new instance of the Experiment class.
 /// </summary>
 /// <param name="experiment">The ScienceExperiment to be used.</param>
 /// <param name="situation">The Situation this experiment is valid in.</param>
 /// <param name="onboardScience">A collection of all onboard ScienceData.</param>
 public Experiment( ScienceExperiment experiment, Situation situation, Dictionary<string, List<ScienceData>> onboardScience, Dictionary<string, ScienceSubject> SciDict, UnlockedExperimentList AvailableExperiments )
 {
     _experiment = experiment;
     _situation = situation;
     ScienceSubject = null;
     Update( onboardScience, SciDict, AvailableExperiments );
 }
コード例 #2
0
 /// <summary>
 /// Creates a new instance of the ExperimentFilter class.
 /// </summary>
 public ExperimentFilter()
 {
     _logger = new Logger(this);
     _displayMode = DisplayMode.Unlocked;
     _text = string.Empty;
     _kscBiomes = new List<string>();
     AllExperiments = new List<Experiment>();
     DisplayExperiments = new List<Experiment>();
     CompleteCount = TotalCount = 0;
     AvailableExperiments = new UnlockedExperimentList( );
 }
コード例 #3
0
 /// <summary>
 /// Creates a new instance of the ExperimentFilter class.
 /// </summary>
 public ExperimentFilter()
 {
     _logger              = new Logger(this);
     _displayMode         = DisplayMode.Unlocked;
     _text                = string.Empty;
     _kscBiomes           = new List <string>();
     AllExperiments       = new List <Experiment>();
     DisplayExperiments   = new List <Experiment>();
     CompleteCount        = TotalCount = 0;
     AvailableExperiments = new UnlockedExperimentList( );
 }
コード例 #4
0
ファイル: Experiment.cs プロジェクト: Simoyd/KSP-X-Science
 /// <summary>
 /// Creates a new instance of the Experiment class.
 /// </summary>
 /// <param name="experiment">The ScienceExperiment to be used.</param>
 /// <param name="situation">The Situation this experiment is valid in.</param>
 /// <param name="onboardScience">A collection of all onboard ScienceData.</param>
 public Experiment(ScienceExperiment experiment, Situation situation, Dictionary <string, List <ScienceData> > onboardScience, Dictionary <string, ScienceSubject> SciDict, UnlockedExperimentList AvailableExperiments)
 {
     _experiment    = experiment;
     _situation     = situation;
     ScienceSubject = null;
     Update(onboardScience, SciDict, AvailableExperiments);
 }
コード例 #5
0
ファイル: Experiment.cs プロジェクト: Simoyd/KSP-X-Science
        /// <summary>
        /// Updates the IsUnlocked, CompletedScience, TotalScience, OnboardScience, and IsComplete fields.
        /// </summary>
        /// <param name="onboardScience">The total onboard ScienceData.</param>
        public void Update(Dictionary <string, List <ScienceData> > onboardScience, Dictionary <string, ScienceSubject> SciDict, UnlockedExperimentList AvailableExperiments)
        {
            if (SciDict.ContainsKey(Id))
            {
                ScienceSubject = SciDict[Id];
            }
            else
            {
                ScienceSubject = new ScienceSubject(ScienceExperiment, Situation.ExperimentSituation, Situation.Body, Situation.SubBiome ?? Situation.Biome ?? string.Empty);
            }


            IsUnlocked = AvailableExperiments.IsUnlocked(ScienceExperiment.id);

            CompletedScience = ScienceSubject.science * HighLogic.CurrentGame.Parameters.Career.ScienceGainMultiplier;
            TotalScience     = ScienceSubject.scienceCap * HighLogic.CurrentGame.Parameters.Career.ScienceGainMultiplier;
            IsComplete       = CompletedScience > TotalScience || TotalScience - CompletedScience < 0.1;

            var multiplier = ScienceExperiment.baseValue / ScienceExperiment.scienceCap;



            OnboardScience = 0;
            if (onboardScience.ContainsKey(ScienceSubject.id))
            {
                var data = onboardScience[ScienceSubject.id];
//				var _logger = new Logger( "Experiment" );
//				_logger.Trace( ScienceSubject.id + " found " + data.Count( ) + " items" );
                foreach (var i in data)
                {
                    var next = (TotalScience - (CompletedScience + OnboardScience)) * multiplier;
                    OnboardScience += next;
                }
            }
            var AllCollectedScience = CompletedScience + OnboardScience;

            IsCollected = AllCollectedScience > TotalScience || TotalScience - AllCollectedScience < 0.1;
        }
コード例 #6
0
ファイル: Experiment.cs プロジェクト: Simoyd/KSP-X-Science
        /// <summary>
        /// Updates the IsUnlocked, CompletedScience, TotalScience, OnboardScience, and IsComplete fields.
        /// </summary>
        /// <param name="onboardScience">The total onboard ScienceData.</param>
        public void Update( Dictionary<string, List<ScienceData>> onboardScience, Dictionary<string, ScienceSubject> SciDict, UnlockedExperimentList AvailableExperiments )
        {
            if( SciDict.ContainsKey( Id ) )
                ScienceSubject = SciDict[ Id ];
            else ScienceSubject = new ScienceSubject(ScienceExperiment, Situation.ExperimentSituation, Situation.Body, Situation.SubBiome ?? Situation.Biome ?? string.Empty);

            IsUnlocked = AvailableExperiments.IsUnlocked( ScienceExperiment.id );

            CompletedScience = ScienceSubject.science * HighLogic.CurrentGame.Parameters.Career.ScienceGainMultiplier;
            TotalScience = ScienceSubject.scienceCap * HighLogic.CurrentGame.Parameters.Career.ScienceGainMultiplier;
            IsComplete = CompletedScience > TotalScience || TotalScience - CompletedScience < 0.1;

            var multiplier = ScienceExperiment.baseValue / ScienceExperiment.scienceCap;

            OnboardScience = 0;
            if( onboardScience.ContainsKey( ScienceSubject.id ) )
            {
                var data = onboardScience[ ScienceSubject.id ];
            //				var _logger = new Logger( "Experiment" );
            //				_logger.Trace( ScienceSubject.id + " found " + data.Count( ) + " items" );
                foreach (var i in data)
                {
                    var next = (TotalScience - (CompletedScience + OnboardScience)) * multiplier;
                    OnboardScience += next;
                }
            }
            var AllCollectedScience = CompletedScience + OnboardScience;
            IsCollected = AllCollectedScience > TotalScience || TotalScience - AllCollectedScience < 0.1;
        }