예제 #1
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            WBIConvertibleStorage storage = this.part.FindModuleImplementing <WBIConvertibleStorage>();

            if (storage != null)
            {
                storage.Events["ReconfigureStorage"].guiName = "Select Fuel";
                storage.SetWindowTitle("Select Fuel");

                if (HighLogic.LoadedSceneIsFlight)
                {
                    storage.onModuleRedecorated += new ModuleRedecoratedEvent(storage_onModuleRedecorated);
                }
            }
        }
예제 #2
0
        protected void checkForUpgrade()
        {
            if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX)
            {
                return;
            }

            WBIConvertibleStorage storage = this.part.FindModuleImplementing <WBIConvertibleStorage>();

            //If the player hasn't unlocked the upgradeTech node yet, then hide the resource switcher.
            if (ResearchAndDevelopment.GetTechnologyState(upgradeTech) == RDTech.State.Available)
            {
                storage.SetGUIVisible(true);
            }
            else
            {
                storage.SetGUIVisible(false);
            }
        }
예제 #3
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            //Find the switch if any.
            switcher    = this.part.FindModuleImplementing <WBIConvertibleStorage>();
            omniStorage = part.FindModuleImplementing <WBIOmniStorage>();

            //Find the resource distributor if any
            int        totalCount = this.part.Modules.Count;
            PartModule module;

            for (int index = 0; index < totalCount; index++)
            {
                module = this.part.Modules[index];
                if (module.moduleName == "WBIResourceDistributor")
                {
                    resourceDistributor = module;
                }
            }

            //Hide base GUI
            Events["NextMesh"].guiActive = false;
            Events["NextMesh"].active    = false;
            Events["PrevMesh"].active    = false;
            Events["PrevMesh"].guiActive = false;

            //Get the mesh options
            getOptionNodes();
            checkDefaultOption();
            Events["ToggleOption"].guiName = kOptionLabel + optionNames[currentOptionIndex];

            //Set up the mesh
            if (currentOptionIndex != -1)
            {
                WBIHexTrussOption trussOption = trussOptions[optionNames[currentOptionIndex]];
                setVisibleObjects(trussOption);
            }
        }
예제 #4
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            int nextIndex = -1;

            //Find the switch if any.
            switcher = this.part.FindModuleImplementing <WBIConvertibleStorage>();

            //Find the resource distributor if any
            int        totalCount = this.part.Modules.Count;
            PartModule module;

            for (int index = 0; index < totalCount; index++)
            {
                module = this.part.Modules[index];
                if (module.moduleName == "WBIResourceDistributor")
                {
                    resourceDistributor = module;
                }
            }

            //Hide base GUI
            Events["NextMesh"].guiActive = false;
            Events["NextMesh"].active    = false;
            Events["PrevMesh"].active    = false;
            Events["PrevMesh"].guiActive = false;

            //Set initial values
            if (rackConfiguration == RackConfigurations.Unknown)
            {
                rackConfiguration = kDefaultRacks;
            }
            Log("rack configuration: " + rackConfiguration);

            if (endCapIndex == -1)
            {
                endCapIndex = kDefaultEndCapIndex;
            }

            //Setup the GUI
            if (endCapNames != null)
            {
                nextIndex = (endCapIndex + 1) % endCapNames.Length;
                Events["NextEndCap"].guiName = endCapNames[nextIndex];
            }

            if (bodyNames != null)
            {
                nextIndex = (bodyIndex + 1) % bodyNames.Length;
                Events["NextBodyType"].guiName = bodyNames[nextIndex];
            }

            if (string.IsNullOrEmpty(centerVestibuleName))
            {
                Events["ToggleCenterVestibule"].guiActiveEditor = false;
                Events["ToggleCenterVestibule"].guiActive       = false;
                Events["ToggleCenterVestibule"].active          = false;
            }
            else
            {
                Events["ToggleCenterVestibule"].guiActiveEditor = true;
                Events["ToggleCenterVestibule"].guiActive       = false;
                Events["ToggleCenterVestibule"].active          = true;
            }

            switch (rackConfiguration)
            {
            case RackConfigurations.None:
                Events["NextRackConfiguration"].guiName = kTwoRacks;
                break;

            case RackConfigurations.Two:
                Events["NextRackConfiguration"].guiName = kThreeRacks;
                break;

            case RackConfigurations.Three:
                Events["NextRackConfiguration"].guiName = kSixRacks;
                break;

            case RackConfigurations.Six:
            default:
                Events["NextRackConfiguration"].guiName = kNoRacks;
                break;
            }

            //Set the visible objects
            SetVisibleObjects();
            if (HighLogic.LoadedSceneIsEditor)
            {
                UpdateResources();
            }
        }