Example #1
0
        public override void OnStart(StartState state)
        {
            ModuleResourceHarvester harvester;

            base.OnStart(state);

            //Get the drills
            groundDrills = this.part.FindModulesImplementing <ModuleResourceHarvester>();

            //Setup the drills with the new resource to drill for.
            if (drillResources != null)
            {
                for (int index = 0; index < drillResources.Length; index++)
                {
                    harvester = groundDrills[index];
                    harvester.ResourceName    = drillResources[index];
                    harvester.StartActionName = "Start " + drillResources[index] + " Drill";
                    harvester.StopActionName  = "Stop " + drillResources[index] + " Drill";
                    harvester.Fields["ResourceStatus"].guiName = drillResources[index] + " rate";
                }
            }

            //Setup the window
            drillSwitchWindow = new DrillSwitchWindow();
            drillSwitchWindow.groundDrills     = groundDrills;
            drillSwitchWindow.part             = this.part;
            drillSwitchWindow.reconfigureCost  = reconfigureCost;
            drillSwitchWindow.requiredResource = requiredResource;
            drillSwitchWindow.requiredSkill    = requiredSkill;

            //Setup GUI
            Events["ShowDrillSwitchWindow"].guiActiveUnfocused = Utils.HasResearchedNode(PathfinderSettings.drillTechNode);

            //Tooltip
            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }
            WBIPathfinderScenario scenario = WBIPathfinderScenario.Instance;

            if (scenario.HasShownToolTip(this.ClassName))
            {
                return;
            }
            scenario.SetToolTipShown(this.ClassName);

            WBIToolTipWindow toolTipWindow = new WBIToolTipWindow(kToolTipTitle, kDrillSwitchTooltip);

            toolTipWindow.SetVisible(true);
        }