override public void postLoad(ConfigNode node) { if (selectedPartFlightID != 0) //We check if a previous flightID was set on the parts. When switching MechJeb Cores and performing save/load of the script, the port order may change so we try to rely on the flight ID to select the right part. { int i = 0; foreach (Part part in irsequencerParts) { if (part.flightID == selectedPartFlightID) { this.selectedPartIndex = i; } i++; } } //Populate the current list of sequences based on the selected part this.populateSequencesList(); //then try to find the sequence Guid in the selected part sequences list if (selectedSequenceGuid != Guid.Empty) { int i = 0; foreach (object sequence in currentIrsequencerSequences) { if (getSequenceGuid(sequence) == selectedSequenceGuid) { this.selectedSequenceIndex = i; } i++; } } }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("Activate Vessel"); selectedPartIndex = GuiUtils.ComboBox.Box(selectedPartIndex, commandPartsNames.ToArray(), commandPartsNames); if (!partHighlighted) { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view", true), GUILayout.ExpandWidth(false))) { partHighlighted = true; commandParts[selectedPartIndex].SetHighlight(true, false); } } else { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view_a", true), GUILayout.ExpandWidth(false))) { partHighlighted = false; commandParts[selectedPartIndex].SetHighlight(false, false); } } if (this.isStarted() && !this.isExecuted()) { GUILayout.Label(" waiting " + this.spendTime + "s"); } if (selectedPartIndex < commandParts.Count) { this.selectedPartFlightID = commandParts[selectedPartIndex].flightID; } base.postWindowGUI(windowID); }
override public void postLoad(ConfigNode node) { if (selectedPartSFlightID != 0 && selectedPartTFlightID != 0 && selectedKerbalName != null) //We check if a previous flightID was set on the parts. When switching MechJeb Cores and performing save/load of the script, the port order may change so we try to rely on the flight ID to select the right part. { int i = 0; foreach (Part part in crewableParts) { if (part.flightID == selectedPartSFlightID) { this.selectedPartIndexS = i; } if (part.flightID == selectedPartTFlightID) { this.selectedPartIndexT = i; } i++; } i = 0; foreach (String kerbalName in kerbalsNames) { if (kerbalName.CompareTo(this.selectedKerbalName) == 0) { this.selectedKerbal = i; } i++; } } }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("Throttle at "); burnIndex = GuiUtils.ComboBox.Box(burnIndex, burnRates.ToArray(), burnRates); base.postWindowGUI(windowID); }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("Tra."); selectedKerbal = GuiUtils.ComboBox.Box(selectedKerbal, kerbalsNames.ToArray(), kerbalsNames); GUILayout.Label("Fr."); selectedPartIndexS = GuiUtils.ComboBox.Box(selectedPartIndexS, crewablePartsNamesS.ToArray(), crewablePartsNamesS); if (!partHighlightedS) { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view", true), GUILayout.ExpandWidth(false))) { partHighlightedS = true; crewableParts [selectedPartIndexS].SetHighlight(true, false); } } else { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view_a", true), GUILayout.ExpandWidth(false))) { partHighlightedS = false; crewableParts [selectedPartIndexS].SetHighlight(false, false); } } GUILayout.Label("To"); selectedPartIndexT = GuiUtils.ComboBox.Box(selectedPartIndexT, crewablePartsNamesT.ToArray(), crewablePartsNamesT); if (!partHighlightedT) { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view", true), GUILayout.ExpandWidth(false))) { partHighlightedT = true; crewableParts [selectedPartIndexT].SetHighlight(true, false); } } else { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view_a", true), GUILayout.ExpandWidth(false))) { partHighlightedT = false; crewableParts [selectedPartIndexT].SetHighlight(false, false); } } if (selectedPartIndexS < crewableParts.Count) { this.selectedPartSFlightID = crewableParts[selectedPartIndexS].flightID; } if (selectedPartIndexT < crewableParts.Count) { this.selectedPartTFlightID = crewableParts[selectedPartIndexT].flightID; } if (selectedKerbal < kerbalsList.Count) { this.selectedKerbalName = kerbalsList[selectedKerbal].name; } base.postWindowGUI(windowID); }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("Load"); scriptSlot = GuiUtils.ComboBox.Box(scriptSlot, scriptsList.ToArray(), this); autoStart = GUILayout.Toggle(autoStart, "Start"); base.postWindowGUI(windowID); }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("Staging "); nextStage = GUILayout.Toggle(nextStage, "Next stage"); if (!nextStage) { stage = GuiUtils.ComboBox.Box(stage, stagesList.ToArray(), this); } base.postWindowGUI(windowID); }
override public void readModuleConfiguration() { deployGear = module_autopilot.deployGears; deployChutes = module_autopilot.deployChutes; limitChutesStage = module_autopilot.limitChutesStage; touchdownSpeed = module_autopilot.touchdownSpeed; if (core.target.PositionTargetExists) { landTarget = true; targetLattitude = core.target.targetLatitude; targetLongitude = core.target.targetLongitude; } }
override public void postLoad(ConfigNode node) { if (selectedPartFlightID != 0) //We check if a previous flightID was set on the parts. When switching MechJeb Cores and performing save/load of the script, the port order may change so we try to rely on the flight ID to select the right part. { int i = 0; foreach (Part part in commandParts) { if (part.flightID == selectedPartFlightID) { this.selectedPartIndex = i; } i++; } } }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("Target"); targetType = GuiUtils.ComboBox.Box(targetType, targetTypes.ToArray(), targetTypes); selectedCelestialBodyIndex = GuiUtils.ComboBox.Box(selectedCelestialBodyIndex, bodiesNamesList.ToArray(), bodiesNamesList); if (targetType == 1) { //TODO : Does not work for the moment with Lat/Long //GuiUtils.SimpleTextBox ("Lat", targetLatitude, "°", 30f); //GuiUtils.SimpleTextBox ("Long", targetLongitude, "°", 30); } base.postWindowGUI(windowID); }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("kOS"); if (kosPartsNames.Count > 0) { selectedPartIndex = GuiUtils.ComboBox.Box(selectedPartIndex, kosPartsNames.ToArray(), kosPartsNames); if (!partHighlighted) { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view", true), GUILayout.ExpandWidth(false))) { partHighlighted = true; kosParts[selectedPartIndex].SetHighlight(true, false); } } else { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view_a", true), GUILayout.ExpandWidth(false))) { partHighlighted = false; kosParts[selectedPartIndex].SetHighlight(false, false); } } command = GUILayout.TextField(command, GUILayout.Width(120), GUILayout.ExpandWidth(true)); openTerminal = GUILayout.Toggle(openTerminal, "Open Terminal"); waitFinish = GUILayout.Toggle(waitFinish, "Wait Finish"); closeTerminal = GUILayout.Toggle(closeTerminal, "Close Terminal"); } else { GUILayout.Label("-- NO kOS module on vessel --"); } if (selectedPartIndex < kosParts.Count) { this.selectedPartFlightID = kosParts[selectedPartIndex].flightID; } base.postWindowGUI(windowID); }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("SAS"); actionType = GuiUtils.ComboBox.Box(actionType, actionTypes.ToArray(), actionTypes); onActiveVessel = GUILayout.Toggle(onActiveVessel, "On active Vessel"); if (!onActiveVessel) { selectedPartIndex = GuiUtils.ComboBox.Box(selectedPartIndex, commandPartsNames.ToArray(), commandPartsNames); if (commandParts[selectedPartIndex] != null) { if (!partHighlighted) { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view", true), GUILayout.ExpandWidth(false))) { partHighlighted = true; commandParts[selectedPartIndex].SetHighlight(true, false); } } else { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view_a", true), GUILayout.ExpandWidth(false))) { partHighlighted = false; commandParts[selectedPartIndex].SetHighlight(false, false); } } } } if (selectedPartIndex < commandParts.Count) { this.selectedPartFlightID = commandParts[selectedPartIndex].flightID; } base.postWindowGUI(windowID); }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("IR"); if (irsequencerPartsNames.Count > 0) { actionType = GuiUtils.ComboBox.Box(actionType, actionTypes.ToArray(), actionTypes); selectedPartIndex = GuiUtils.ComboBox.Box(selectedPartIndex, irsequencerPartsNames.ToArray(), irsequencerPartsNames); if (old_selectedPartIndex != selectedPartIndex) { //Change in the selected sequencer part. We change the list of sequences this.populateSequencesList(); } if (!partHighlighted) { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view", true), GUILayout.ExpandWidth(false))) { partHighlighted = true; irsequencerParts[selectedPartIndex].SetHighlight(true, false); } } else { if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/view_a", true), GUILayout.ExpandWidth(false))) { partHighlighted = false; irsequencerParts[selectedPartIndex].SetHighlight(false, false); } } if (currentIrsequencerSequenceNames.Count > 0) { selectedSequenceIndex = GuiUtils.ComboBox.Box(selectedSequenceIndex, currentIrsequencerSequenceNames.ToArray(), currentIrsequencerSequenceNames); if (actionType == 0) { waitFinish = GUILayout.Toggle(waitFinish, "Wait finish"); } } else { GUILayout.Label("-- NO Sequence in this sequencer --"); } if (GUILayout.Button(GameDatabase.Instance.GetTexture("MechJeb2/Icons/refresh", true), GUILayout.ExpandWidth(false))) { this.updateSequencesList(); } } else { GUILayout.Label("-- NO IR Sequencer on vessel --"); } if (selectedPartIndex < irsequencerParts.Count) { this.selectedPartFlightID = irsequencerParts[selectedPartIndex].flightID; } if (selectedSequenceIndex < currentIrsequencerSequences.Count) { this.selectedSequenceGuid = this.getSequenceGuid(currentIrsequencerSequences[selectedSequenceIndex]); } base.postWindowGUI(windowID); }