//private Logger					_logger;



        // Constructor
        public xScienceEventHandler(ScienceChecklistAddon Parent)
        {
//_logger = new Logger( this );
//_logger.Trace( "xScienceEventHandler" );
            _parent = Parent;

            _nextExperimentUpdate = DateTime.Now;
            _nextFilterCheck      = DateTime.Now;
            _mustDoFullRefresh    = true;
            _filterRefreshPending = true;


            GameEvents.onVesselWasModified.Add(new EventData <Vessel> .OnEvent(this.VesselWasModified));
            GameEvents.onVesselChange.Add(new EventData <Vessel> .OnEvent(this.VesselChange));
            GameEvents.onEditorShipModified.Add(new EventData <ShipConstruct> .OnEvent(this.EditorShipModified));

            GameEvents.onGameStateSave.Add(new EventData <ConfigNode> .OnEvent(this.GameStateSave));
            GameEvents.OnPartPurchased.Add(new EventData <AvailablePart> .OnEvent(this.PartPurchased));
            GameEvents.OnTechnologyResearched.Add(new EventData <GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> > .OnEvent(this.TechnologyResearched));
            GameEvents.OnScienceChanged.Add(new EventData <float, TransactionReasons> .OnEvent(this.ScienceChanged));
            GameEvents.OnScienceRecieved.Add(new EventData <float, ScienceSubject, ProtoVessel, bool> .OnEvent(this.ScienceRecieved));
            GameEvents.onVesselRename.Add(new EventData <GameEvents.HostedFromToAction <Vessel, string> > .OnEvent(this.VesselRename));
            GameEvents.OnKSCFacilityUpgraded.Add(new EventData <Upgradeables.UpgradeableFacility, int> .OnEvent(this.FacilityUpgrade));

            GameEvents.onDominantBodyChange.Add(new EventData <GameEvents.FromToAction <CelestialBody, CelestialBody> > .OnEvent(this.DominantBodyChange));
            GameEvents.onVesselSOIChanged.Add(new EventData <GameEvents.HostedFromToAction <Vessel, CelestialBody> > .OnEvent(this.VesselSOIChanged));

            _parent.Config.CheckDebrisChanged            += (s, e) => CheckDebrisSettingChanged( );
            _parent.Config.FilterDifficultScienceChanged += (s, e) => FilterDifficultScienceChanged( );
        }
        // Constructor
        public xScienceEventHandler(ScienceChecklistAddon Parent, ScienceWindow Window)
        {
            _parent = Parent;
            _window = Window;
            _nextSituationUpdate        = DateTime.Now;
            _nextExperimentUpdate       = DateTime.Now;
            _mustDoFullRefresh          = true;
            _filterRefreshPending       = true;
            _vExperimentsRefreshPending = true;


            GameEvents.onGameSceneSwitchRequested.Add(new EventData <GameEvents.FromToAction <GameScenes, GameScenes> > .OnEvent(this.OnGameSceneSwitch));
            GameEvents.onVesselWasModified.Add(new EventData <Vessel> .OnEvent(this.VesselWasModified));
            GameEvents.onVesselChange.Add(new EventData <Vessel> .OnEvent(this.VesselChange));
            GameEvents.onEditorShipModified.Add(new EventData <ShipConstruct> .OnEvent(this.EditorShipModified));

            GameEvents.onGameStateSave.Add(new EventData <ConfigNode> .OnEvent(this.GameStateSave));
            GameEvents.OnPartPurchased.Add(new EventData <AvailablePart> .OnEvent(this.PartPurchased));
            GameEvents.OnTechnologyResearched.Add(new EventData <GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> > .OnEvent(this.TechnologyResearched));
            GameEvents.OnScienceChanged.Add(new EventData <float, TransactionReasons> .OnEvent(this.ScienceChanged));
            GameEvents.OnScienceRecieved.Add(new EventData <float, ScienceSubject, ProtoVessel, bool> .OnEvent(this.ScienceRecieved));
            GameEvents.onVesselRename.Add(new EventData <GameEvents.HostedFromToAction <Vessel, string> > .OnEvent(this.VesselRename));
            GameEvents.OnKSCFacilityUpgraded.Add(new EventData <Upgradeables.UpgradeableFacility, int> .OnEvent(this.FacilityUpgrade));

            GameEvents.onDominantBodyChange.Add(new EventData <GameEvents.FromToAction <CelestialBody, CelestialBody> > .OnEvent(this.DominantBodyChange));
            GameEvents.onVesselSOIChanged.Add(new EventData <GameEvents.HostedFromToAction <Vessel, CelestialBody> > .OnEvent(this.VesselSOIChanged));
        }
Esempio n. 3
0
//		private readonly Logger	_logger;



        /// <summary>
        /// Creates a new instance of the ExperimentFilter class.
        /// </summary>
        public ExperimentFilter(ScienceChecklistAddon Parent)
        {
            _parent = Parent;
//			_logger = new Logger(this);
            _displayMode            = DisplayMode.Unlocked;
            _text                   = string.Empty;
            DisplayScienceInstances = new List <ScienceInstance>( );
            CompleteCount           = TotalCount = 0;
            EnforceLabLanderMode    = false;
            TotalScience            = CompletedScience = OutstandingScience = 0;
        }
Esempio n. 4
0
        public ScienceContext(ScienceChecklistAddon Parent)
        {
            _parent = Parent;
            _logger = new Logger(this);
            //_logger.Trace( "Making ScienceContext" );
            _bodyList = new Dictionary <CelestialBody, Body>();
            //_logger.Trace( "Made _bodyList" );
            _onboardScience = new Dictionary <string, List <ScienceData> >();
            //_logger.Trace( "Made _onboardScience" );
            _scienceSubjects = new Dictionary <string, ScienceSubject>();
            //_logger.Trace( "Made _scienceSubjects" );
            _experiments = new Dictionary <ScienceExperiment, ModuleScienceExperiment>();
            //_logger.Trace( "Made _experiments" );
            _kscBiomes = new List <string>();
            //_logger.Trace( "Made _kscBiomes" );
            _unlockedInstruments = new UnlockedInstrumentList();
            //_logger.Trace( "Made _unlockedInstruments" );
            _allScienceInstances = new List <ScienceInstance>();
            //_logger.Trace( "Made _allScienceInstances" );

            Reset();
            //_logger.Trace( "Made ScienceContext" );

            //workerThreads.Add(new Thread(() => { if (_bodyList.Count != FlightGlobals.Bodies.Count) UpdateBodies(); } ));
            //workerThreads.Add(new Thread(UpdateOnboardScience));
            //workerThreads.Add(new Thread(UpdateScienceSubjects));
            //workerThreads.Add(new Thread(UpdateExperiments));
            //workerThreads.Add(new Thread(UpdateKscBiomes));
            //workerThreads.Add(new Thread(RefreshExperimentCache));

            //workerThreads.Add(new Thread(() =>
            //{
            //    if (_bodyList.Count != FlightGlobals.Bodies.Count)
            //        UpdateBodies();
            //    UpdateOnboardScience();
            //}));
            //workerThreads.Add(new Thread(() =>
            //{
            //    UpdateScienceSubjects();
            //    UpdateExperiments();
            //    UpdateKscBiomes();
            //    RefreshExperimentCache();
            //}));


            //for (int i = 0; i < workerThreads.Count; i++)
            //{
            //    workerThreads[i].IsBackground = true;
            //    workerThreads[i].Priority = System.Threading.ThreadPriority.Normal;
            //}
        }
Esempio n. 5
0
        public ScienceWindow(ScienceChecklistAddon Parent, SettingsWindow settingsWindow, HelpWindow helpWindow)
        {
            _parent         = Parent;
            _settingsWindow = settingsWindow;
            _helpWindow     = helpWindow;

            _logger       = new Logger(this);
            _defaultSize  = new Vector2(500, 400);
            _rect         = wScale(new Rect(40, 40, _defaultSize.x, _defaultSize.y));
            _defaultSize3 = new Vector2(400, 200);
            _rect3        = wScale(new Rect(40, 40, _defaultSize3.x, _defaultSize3.y));
            _scrollPos    = new Vector2();
            _filter       = new ExperimentFilter(_parent);

            _progressTexture         = TextureHelper.FromResource("ScienceChecklist.icons.scienceProgress.png", 13, 13);
            _completeTexture         = TextureHelper.FromResource("ScienceChecklist.icons.scienceComplete.png", 13, 13);
            _progressTextureCompact  = TextureHelper.FromResource("ScienceChecklist.icons.scienceProgressCompact.png", 8, 8);
            _completeTextureCompact  = TextureHelper.FromResource("ScienceChecklist.icons.scienceCompleteCompact.png", 8, 8);
            _currentSituationTexture = TextureHelper.FromResource("ScienceChecklist.icons.currentSituation.png", 25, 21);
            _currentVesselTexture    = TextureHelper.FromResource("ScienceChecklist.icons.currentVessel.png", 25, 21);
            _notCurrentVesselTexture = TextureHelper.FromResource("ScienceChecklist.icons.notCurrentVessel.png", 25, 21);
            _unlockedTexture         = TextureHelper.FromResource("ScienceChecklist.icons.unlocked.png", 25, 21);
            _allTexture         = TextureHelper.FromResource("ScienceChecklist.icons.all.png", 25, 21);
            _searchTexture      = TextureHelper.FromResource("ScienceChecklist.icons.search.png", 25, 21);
            _clearSearchTexture = TextureHelper.FromResource("ScienceChecklist.icons.clearSearch.png", 25, 21);
            _minimizeTexture    = TextureHelper.FromResource("ScienceChecklist.icons.minimize.png", 16, 16);
            _maximizeTexture    = TextureHelper.FromResource("ScienceChecklist.icons.maximize.png", 16, 16);
            _closeTexture       = TextureHelper.FromResource("ScienceChecklist.icons.close.png", 16, 16);
            _helpTexture        = TextureHelper.FromResource("ScienceChecklist.icons.help.png", 16, 16);
            _settingsTexture    = TextureHelper.FromResource("ScienceChecklist.icons.settings.png", 16, 16);

            _emptyTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
            _emptyTexture.SetPixels(new[] { Color.clear });
            _emptyTexture.Apply();

            _parent.Config.HideCompleteEventsChanged      += (s, e) => RefreshFilter(s, e);
            _parent.Config.CompleteWithoutRecoveryChanged += (s, e) => RefreshFilter(s, e);

            _parent.ScienceEventHandler.FilterUpdateEvent += (s, e) => RefreshFilter(s, e);
            _parent.ScienceEventHandler.SituationChanged  += (s, e) => UpdateSituation(s, e);

            _parent.Config.UiScaleChanged += OnUiScaleChange;
        }
Esempio n. 6
0
        public ScienceContext(ScienceChecklistAddon Parent)
        {
            _parent = Parent;
            _logger = new Logger(this);
//_logger.Trace( "Making ScienceContext" );
            _bodyList = new Dictionary <CelestialBody, Body>( );
//_logger.Trace( "Made _bodyList" );
            _onboardScience = new Dictionary <string, List <ScienceData> >( );
//_logger.Trace( "Made _onboardScience" );
            _scienceSubjects = new Dictionary <string, ScienceSubject>( );
//_logger.Trace( "Made _scienceSubjects" );
            _experiments = new Dictionary <ScienceExperiment, ModuleScienceExperiment>( );
//_logger.Trace( "Made _experiments" );
            _kscBiomes = new List <string>( );
//_logger.Trace( "Made _kscBiomes" );
            _unlockedInstruments = new UnlockedInstrumentList( );
//_logger.Trace( "Made _unlockedInstruments" );
            _allScienceInstances = new List <ScienceInstance>( );
//_logger.Trace( "Made _allScienceInstances" );

            Reset( );
//_logger.Trace( "Made ScienceContext" );
        }