Example #1
0
        public void SetupGUI()
        {
            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }

            bool planetUnlocked = ResourceMap.Instance.IsPlanetScanned(FlightGlobals.currentMainBody.flightGlobalsIndex);

            //Is the telescope broken? if so, show the repair scope button
            //and don't allow any research
            if (isBroken)
            {
                //Enable repair button
                Events["RepairLab"].active = true;

                //Cannot perform an orbital survey...
                Events["PerformOrbitalSurvey"].active = false;

                //Hide survey scanner GUI
                if (orbitalScanner != null)
                {
                    orbitalScanner.DisableModule();
                }

                //No research can be performed.
                SetGuiVisible(false);
                return;
            }

            //Show scanner GUI?
            if (planetUnlocked && orbitalScanner != null)
            {
                orbitalScanner.EnableModule();
            }

            //Hide repair button
            Events["RepairLab"].active = false;

            //Show the perform orbital survey button if we've unlocked the planet
            Events["PerformOrbitalSurvey"].active = !planetUnlocked;

            //Ditto for the resource monitoring
            SetGuiVisible(planetUnlocked);
        }