Exemplo n.º 1
0
        public void Start()
        {
            isTSTInstalled  = Database.instance.isTSTInstalled;
            isPCBMInstalled = Utilities.IsPCBMInstalled;
            if (isPCBMInstalled)  //If Progressive CB Maps assembly is present, initialise PCBM wrapper.
            {
                PCBMWrapper.InitPCBMWrapper();
                if (!PCBMWrapper.APIPCBMReady)
                {
                    isPCBMInstalled = false; //If the initialise of wrapper failed set bool to false, we won't be interfacing to PCBM today.
                }
            }
            enable = ResearchBodies.Enabled;

            //Register for Contract On offerred so we can remove ones that are for bodies not yet tracked.
            if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
            {
                GameEvents.Contract.onOffered.Add(CheckContracts);
            }

            if (Utilities.IsKopInstalled)
            {
                Database.instance.ReApplyRanges();
            }

            //If RB is enabled set initial Discovery Levels of CBs and call ProgressiveCBMaps to set their graphics levels.
            if (enable)
            {
                SetBodyDiscoveryLevels();
                GameEvents.onVesselSOIChanged.Add(onVesselSOIChanged);
                GameEvents.onVesselPersistentIdChanged.Add(onVesselPersistentIdChanged);
                Utilities.setScaledScreen();
                windowRect = new Rect(1, 1, Utilities.scaledScreenWidth - 2, Utilities.scaledScreenHeight - 2);
                GameEvents.onScreenResolutionModified.Add(onScreenResolutionModified);
                GameEvents.OnMapEntered.Add(onMapEntered);
                if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
                {
                    onMapEntered();
                }

                CheckVesselsSOI();
            }
            else
            {
                Database.instance.ResetBodyVisibilities();
                SetBodyDiscoveryLevels();
            }

            if (ResearchBodies.Instance.RBgameSettings.lastTimeCheckedSOIs <= 0)
            {
                ResearchBodies.Instance.RBgameSettings.lastTimeCheckedSOIs = Planetarium.GetUniversalTime();
            }
            oneWeek  = KSPUtil.dateTimeFormatter.Day * 7;
            oneMonth = KSPUtil.dateTimeFormatter.Day * 7 * 4;
        }
        public void Start()
        {
            French          = HighLogic.CurrentGame.Parameters.CustomParams <ResearchBodies_SettingsParms>().french;
            isTSTInstalled  = Database.instance.isTSTInstalled;
            isPCBMInstalled = Utilities.IsPCBMInstalled;
            if (isPCBMInstalled)  //If Progressive CB Maps assembly is present, initialise PCBM wrapper.
            {
                PCBMWrapper.InitPCBMWrapper();
                if (!PCBMWrapper.APIPCBMReady)
                {
                    isPCBMInstalled = false; //If the initialise of wrapper failed set bool to false, we won't be interfacing to PCBM today.
                }
            }
            enable = ResearchBodies.Enabled;

            //Create Instructor
            instructor_Werner = new ResearchBodiesInstructor("Instructor_Wernher");
            instructor_Linus  = new ResearchBodiesInstructor("Strategy_ScienceGuy");
            instructor_Werner.Instructor.enabled = false;
            instructor_Linus.Instructor.enabled  = false;
            //Register for Contract On offerred so we can remove ones that are for bodies not yet tracked.
            if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
            {
                GameEvents.Contract.onOffered.Add(CheckContracts);
            }

            if (Utilities.IsKopInstalled)
            {
                Database.instance.ReApplyRanges();
            }

            //If RB is enabled set initial Discovery Levels of CBs and call ProgressiveCBMaps to set their graphics levels.
            if (enable)
            {
                SetBodyDiscoveryLevels();
                GameEvents.onVesselSOIChanged.Add(onVesselSOIChanged);
                Utilities.setScaledScreen();
                windowRect = new Rect(1, 1, Utilities.scaledScreenWidth - 2, Utilities.scaledScreenHeight - 2);
                GameEvents.onScreenResolutionModified.Add(onScreenResolutionModified);
                GameEvents.OnMapEntered.Add(onMapEntered);
                if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
                {
                    onMapEntered();
                }
            }
            else
            {
                Database.instance.ResetBodyVisibilities();
                SetBodyDiscoveryLevels();
            }
        }
        public void Start()
        {
            isTSTInstalled  = Database.instance.isTSTInstalled;
            isPCBMInstalled = Utilities.IsPCBMInstalled;
            if (isPCBMInstalled)  //If Progressive CB Maps assembly is present, initialise PCBM wrapper.
            {
                PCBMWrapper.InitPCBMWrapper();
                if (!PCBMWrapper.APIPCBMReady)
                {
                    isPCBMInstalled = false; //If the initialise of wrapper failed set bool to false, we won't be interfacing to PCBM today.
                }
            }
            enable = ResearchBodies.enabled;

            //Create Instructor
            _instructor = Create("Instructor_Wernher");

            //Register for Contract On offerred so we can remove ones that are for bodies not yet tracked.
            if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
            {
                GameEvents.Contract.onOffered.Add(CheckContracts);
            }

            //If RB is enabled set initial Discovery Levels of CBs and call ProgressiveCBMaps to set their graphics levels.
            if (enable)
            {
                SetBodyDiscoveryLevels();

                if (!ToolbarManager.ToolbarAvailable && !Database.instance.UseAppLauncher)
                {
                    Database.instance.UseAppLauncher = true;
                }
                RBMenuAppLToolBar.Start(Database.instance.UseAppLauncher);
                GameEvents.onGUIRnDComplexSpawn.Add(TurnUIOff);
                GameEvents.onGUIMissionControlSpawn.Add(TurnUIOff);
                GameEvents.onGUIAstronautComplexSpawn.Add(TurnUIOff);
                GameEvents.onGUIAdministrationFacilitySpawn.Add(TurnUIOff);
                GameEvents.onGUIRnDComplexDespawn.Add(TurnUIOn);
                GameEvents.onGUIMissionControlDespawn.Add(TurnUIOn);
                GameEvents.onGUIAstronautComplexDespawn.Add(TurnUIOn);
                GameEvents.onGUIAdministrationFacilityDespawn.Add(TurnUIOn);
                GameEvents.onVesselSOIChanged.Add(onVesselSOIChanged);
                Utilities.setScaledScreen();

                difficulty           = ResearchBodies.Instance.RBgameSettings.Difficulty;
                ResearchCost         = ResearchBodies.Instance.RBgameSettings.ResearchCost;
                ScienceReward        = ResearchBodies.Instance.RBgameSettings.ScienceReward;
                ProgressResearchCost = ResearchBodies.Instance.RBgameSettings.ProgressResearchCost;
            }
        }