private void menuDefault() { textArray[0] = "Please insert"; textArray[1] = "boot disk"; if (buttonArray[(int)ButtonNames.back]) { menuState = menuSplashScreen; } clearButtons(); }
private void menuGunner() { textArray[5] = " Gunner module not"; textArray[6] = " installed. Contact"; textArray[7] = " your customer rep"; textArray[8] = " for a quote today!"; textArray[linesPerPage - 1] = "root/gunner"; if (buttonArray[(int)ButtonNames.back]) { menuState = menuMainMenu; } clearButtons(); }
private void menuAbort() { textArray[5] = "--ABORT SEQUENCE--"; FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Abort); if (!pauseInitialized) { pause(120); } else { if (!pause()) { menuState = menuMainMenu; } } }
// Use this for initialization void Start() { buttonObjectNames = new string[4] { button1, button2, button3, button4 }; //actionGroupList = new ActionGroupList(vessel); for (int i = 0; i < numButtons; i++) { GameObject buttonObject = base.internalProp.FindModelTransform(buttonObjectNames[i]).gameObject; FSgenericButtonHandlerID buttonHandler = buttonObject.AddComponent <FSgenericButtonHandlerID>(); buttonHandler.ID = i; buttonHandler.mouseDownFunction = buttonClick; } targetScript = base.internalProp.FindModelComponent <FSmonitorScript>(); targetScript.textMode = FSmonitorScript.TextMode.singleString; textArray = new string[linesPerPage]; for (int i = 0; i < textArray.Length; i++) { textArray[i] = ""; } buttonArray = new bool[numButtons]; for (int i = 0; i < buttonArray.Length; i++) { buttonArray[i] = false; } // action group numbers gearGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Gear); brakeGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Brakes); SASGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.SAS); lightGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Light); useInfoPopup = getInfoPopupObject(); menuState = menuSplashScreen; refTransform = new GameObject().transform; refTransform.parent = part.transform; refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); shipHeadingTool = new Firespitter.ShipHeading(refTransform); }
private void menuFuel() { updateFuel(); int r = 0; foreach (KeyValuePair <string, Vector2d> kvp in resourceDictionary) { textArray[r] = kvp.Key + ": " + (int)kvp.Value.x + " / " + (int)kvp.Value.y; r++; } textArray[linesPerPage - 1] = "root/fuel"; if (buttonArray[(int)ButtonNames.back]) { menuState = menuMainMenu; } clearButtons(); }
private void menuSplashScreen() { textArray[0] = "Firespitter v4.1"; textArray[2] = "Booting OS"; textArray[4] = "Checking RAM "; textArray[5] = RAMcount + "/512KB"; if (RAMcount < 512) { RAMcount += 8; pause(10); } else { if (!pause()) { menuState = getMenuHandlerFromEnum(startState); } } }
private void menuInfo() { if (useInfoPopup) { for (int i = 0; i < infoPopupStrings.Length; i++) { textArray[i] = infoPopupStrings[i]; } textArray[linesPerPage - 1] = "root/settings/info"; if (buttonArray[(int)ButtonNames.confirm]) { getInfoPopupText(); } } else { menuState = menuMainMenu; } if (buttonArray[(int)ButtonNames.back]) { menuState = menuMainMenu; } clearButtons(); }
// Use this for initialization void Start() { buttonObjectNames = new string[4] { button1, button2, button3, button4 }; //actionGroupList = new ActionGroupList(vessel); for (int i = 0; i < numButtons; i++) { GameObject buttonObject = base.internalProp.FindModelTransform(buttonObjectNames[i]).gameObject; FSgenericButtonHandlerID buttonHandler = buttonObject.AddComponent<FSgenericButtonHandlerID>(); buttonHandler.ID = i; buttonHandler.mouseDownFunction = buttonClick; } targetScript = base.internalProp.FindModelComponent<FSmonitorScript>(); targetScript.textMode = FSmonitorScript.TextMode.singleString; textArray = new string[linesPerPage]; for (int i = 0; i < textArray.Length; i++) { textArray[i] = ""; } buttonArray = new bool[numButtons]; for (int i = 0; i < buttonArray.Length; i++) { buttonArray[i] = false; } // action group numbers gearGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Gear); brakeGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Brakes); SASGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.SAS); lightGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Light); useInfoPopup = getInfoPopupObject(); menuState = menuSplashScreen; refTransform = new GameObject().transform; refTransform.parent = part.transform; refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); shipHeadingTool = new Firespitter.ShipHeading(refTransform); }
private void menuSettings() { menuSelectionTop = 2; menuSelectionBottom = 3; textArray[0] = "Settings"; textArray[2] = " Units: " + unitType; textArray[3] = " Speed: " + speedMode; if (useInfoPopup) { textArray[4] = " Craft info"; menuSelectionBottom++; } textArray[linesPerPage - 1] = "root/settings"; textArray[menuSelection] += " <<<"; if (buttonArray[(int)ButtonNames.up]) { menuSelection--; } if (buttonArray[(int)ButtonNames.down]) { menuSelection++; } if (menuSelection < menuSelectionTop) { menuSelection = menuSelectionTop; //up pressed } if (menuSelection > menuSelectionBottom) { menuSelection = menuSelectionBottom; // down pressed } if (menuSelection > linesPerPage - 1) { menuSelection = linesPerPage - 1; // down pressed } if (buttonArray[(int)ButtonNames.confirm]) //confirm pressed { switch (menuSelection) { case 2: if (unitType == "Metric") { unitType = "Aviation"; } else { unitType = "Metric"; } break; case 3: if (speedMode == "Surface") { speedMode = "Orbit"; } else if (speedMode == "Orbit") { speedMode = "Target"; } else if (speedMode == "Target") { speedMode = "Surface"; } break; case 4: if (useInfoPopup) { getInfoPopupText(); menuState = menuInfo; } break; } } if (buttonArray[(int)ButtonNames.back]) { menuState = menuMainMenu; } clearButtons(); }
private void menuMainMenu() { updateActionGroupStates(); menuSelectionTop = 2; menuSelectionBottom = Enum.GetValues(typeof(MainMenuItems)).Length + 1; textArray[0] = "Main Menu"; textArray[(int)MainMenuItems.flightdata + menuSelectionTop] = " Flight data"; textArray[(int)MainMenuItems.settings + menuSelectionTop] = " Settings"; textArray[(int)MainMenuItems.abort + menuSelectionTop] = " ABORT!"; textArray[(int)MainMenuItems.fuel + menuSelectionTop] = " Fuel"; textArray[(int)MainMenuItems.hover + menuSelectionTop] = " Hover"; string gearStateString = "Up"; if (gearState) { gearStateString = "Down"; } textArray[(int)MainMenuItems.gear + menuSelectionTop] = " Gear " + gearStateString; string brakeStateString = "Off"; if (brakeState) { brakeStateString = "On"; } textArray[(int)MainMenuItems.brakes + menuSelectionTop] = " Brakes " + brakeStateString; string SASStateString = "Off"; if (SASState) { SASStateString = "On"; } textArray[(int)MainMenuItems.SAS + menuSelectionTop] = " (A)SAS " + SASStateString; string lightStateString = "Off"; if (lightState) { lightStateString = "On"; } textArray[(int)MainMenuItems.light + menuSelectionTop] = " Lights " + lightStateString; textArray[(int)MainMenuItems.reboot + menuSelectionTop] = " Reboot"; textArray[linesPerPage - 1] = "root/main_menu"; textArray[menuSelection] += " <<<"; if (buttonArray[(int)ButtonNames.up]) { menuSelection--; } if (buttonArray[(int)ButtonNames.down]) { menuSelection++; } if (menuSelection < menuSelectionTop) { menuSelection = menuSelectionTop; //up pressed } if (menuSelection > menuSelectionBottom) { menuSelection = menuSelectionBottom; // down pressed } if (menuSelection > linesPerPage - 1) { menuSelection = linesPerPage - 1; // down pressed } if (buttonArray[(int)ButtonNames.confirm]) //confirm pressed { switch (menuSelection) { case (int)MainMenuItems.flightdata + 2: menuState = menuFlightData; break; case (int)MainMenuItems.settings + 2: menuState = menuSettings; break; case (int)MainMenuItems.abort + 2: pauseInitialized = false; menuState = menuAbort; break; case (int)MainMenuItems.fuel + 2: menuState = menuFuel; break; case (int)MainMenuItems.gear + 2: FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Gear); break; case (int)MainMenuItems.brakes + 2: FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Brakes); break; case (int)MainMenuItems.SAS + 2: FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.SAS); break; case (int)MainMenuItems.light + 2: FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Light); break; case (int)MainMenuItems.hover + 2: toggleHover(); break; case (int)MainMenuItems.reboot + 2: menuState = menuSplashScreen; RAMcount = 0; break; } } clearButtons(); }
private void menuFlightData() { updateFlightData(); updateFuel(); int i = 0; // putting ++i in the [] gives it the value before incrementation textArray[++i] = "climbRate: " + climbrateString; textArray[++i] = "radar alt: " + radarAltitudeString; textArray[++i] = "sea alt : " + altitudeString; textArray[++i] = "speed : " + speedString; textArray[++i] = "heading : " + Math.Round(FlightGlobals.ship_heading, 1).ToString().PadLeft(6) + " deg"; textArray[++i] = "hover ht.: " + hoverString; //Vector3 orientation = Firespitter.Tools.ShipHeading.orientation(vessel); Vector3 worldUp = Firespitter.Tools.WorldUp(vessel); refTransform.position = vessel.ReferenceTransform.position; // part.transform.position; // refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); //refTransform.rotation = vessel.ReferenceTransform.rotation; // part.transform.rotation; //Vector3 pitch = shipHeadingTool.getPitchRaw(refTransform, worldUp); //Vector3 roll = shipHeadingTool.getRollRaw(refTransform, worldUp); float pitch = shipHeadingTool.getPitch(refTransform, worldUp); float roll = shipHeadingTool.getRoll(refTransform, worldUp); textArray[++i] = "pitch" + Math.Round(pitch, 1).ToString().PadLeft(6) + " deg"; textArray[++i] = "roll" + Math.Round(roll, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "pitchX" + Math.Round(pitch.x, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "pitcY" + Math.Round(pitch.y, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "pitchZ" + Math.Round(pitch.z, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "yaw" + Math.Round(orientation.y, 1).ToString().PadLeft(6) + " deg"; i++; foreach (KeyValuePair<string, Vector2d> kvp in resourceDictionary) { if (kvp.Key == "LiquidFuel" || kvp.Key == "ElectricCharge") { string fuelName = kvp.Key; if (kvp.Key == "ElectricCharge") fuelName = "Battery "; else if (kvp.Key == "LiquidFuel") fuelName = "Lqd Fuel "; textArray[++i] = fuelName + ": " + (int)kvp.Value.x + " / " + (int)kvp.Value.y; } } textArray[linesPerPage - 1] = "root/flight_data"; if (buttonArray[(int)ButtonNames.back]) menuState = menuMainMenu; clearButtons(); }
private void menuFuel() { updateFuel(); int r = 0; foreach (KeyValuePair<string, Vector2d> kvp in resourceDictionary) { textArray[r] = kvp.Key + ": " + (int)kvp.Value.x + " / " + (int)kvp.Value.y; r++; } textArray[linesPerPage - 1] = "root/fuel"; if (buttonArray[(int)ButtonNames.back]) menuState = menuMainMenu; clearButtons(); }
private void menuFlightData() { updateFlightData(); updateFuel(); int i = 0; // putting ++i in the [] gives it the value before incrementation textArray[++i] = "climbRate: " + climbrateString; textArray[++i] = "radar alt: " + radarAltitudeString; textArray[++i] = "sea alt : " + altitudeString; textArray[++i] = "speed : " + speedString; textArray[++i] = "heading : " + Math.Round(FlightGlobals.ship_heading, 1).ToString().PadLeft(6) + " deg"; textArray[++i] = "hover ht.: " + hoverString; //Vector3 orientation = Firespitter.Tools.ShipHeading.orientation(vessel); Vector3 worldUp = Firespitter.Tools.WorldUp(vessel); refTransform.position = vessel.ReferenceTransform.position; // part.transform.position; // refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); //refTransform.rotation = vessel.ReferenceTransform.rotation; // part.transform.rotation; //Vector3 pitch = shipHeadingTool.getPitchRaw(refTransform, worldUp); //Vector3 roll = shipHeadingTool.getRollRaw(refTransform, worldUp); float pitch = shipHeadingTool.getPitch(refTransform, worldUp); float roll = shipHeadingTool.getRoll(refTransform, worldUp); textArray[++i] = "pitch" + Math.Round(pitch, 1).ToString().PadLeft(6) + " deg"; textArray[++i] = "roll" + Math.Round(roll, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "pitchX" + Math.Round(pitch.x, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "pitcY" + Math.Round(pitch.y, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "pitchZ" + Math.Round(pitch.z, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "yaw" + Math.Round(orientation.y, 1).ToString().PadLeft(6) + " deg"; i++; foreach (KeyValuePair <string, Vector2d> kvp in resourceDictionary) { if (kvp.Key == "LiquidFuel" || kvp.Key == "ElectricCharge") { string fuelName = kvp.Key; if (kvp.Key == "ElectricCharge") { fuelName = "Battery "; } else if (kvp.Key == "LiquidFuel") { fuelName = "Lqd Fuel "; } textArray[++i] = fuelName + ": " + (int)kvp.Value.x + " / " + (int)kvp.Value.y; } } textArray[linesPerPage - 1] = "root/flight_data"; if (buttonArray[(int)ButtonNames.back]) { menuState = menuMainMenu; } clearButtons(); }
private void menuDefault() { textArray[0] = "Please insert"; textArray[1] = "boot disk"; if (buttonArray[(int)ButtonNames.back]) menuState = menuSplashScreen; clearButtons(); }
private void menuAbort() { textArray[5] = "--ABORT SEQUENCE--"; FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Abort); if (!pauseInitialized) { pause(120); } else { if (!pause()) menuState = menuMainMenu; } }
private void menuSplashScreen() { textArray[0] = "Firespitter v4.1"; textArray[2] = "Booting OS"; textArray[4] = "Checking RAM "; textArray[5] = RAMcount + "/512KB"; if (RAMcount < 512) { RAMcount += 8; pause(10); } else { if (!pause()) menuState = getMenuHandlerFromEnum(startState); } }
private void menuSettings() { menuSelectionTop = 2; menuSelectionBottom = 3; textArray[0] = "Settings"; textArray[2] = " Units: " + unitType; textArray[3] = " Speed: " + speedMode; if (useInfoPopup) { textArray[4] = " Craft info"; menuSelectionBottom++; } textArray[linesPerPage - 1] = "root/settings"; textArray[menuSelection] += " <<<"; if (buttonArray[(int)ButtonNames.up]) menuSelection--; if (buttonArray[(int)ButtonNames.down]) menuSelection++; if (menuSelection < menuSelectionTop) menuSelection = menuSelectionTop; //up pressed if (menuSelection > menuSelectionBottom) menuSelection = menuSelectionBottom; // down pressed if (menuSelection > linesPerPage - 1) menuSelection = linesPerPage - 1; // down pressed if (buttonArray[(int)ButtonNames.confirm]) //confirm pressed { switch (menuSelection) { case 2: if (unitType == "Metric") unitType = "Aviation"; else unitType = "Metric"; break; case 3: if (speedMode == "Surface") speedMode = "Orbit"; else if (speedMode == "Orbit") speedMode = "Target"; else if (speedMode == "Target") speedMode = "Surface"; break; case 4: if (useInfoPopup) { getInfoPopupText(); menuState = menuInfo; } break; } } if (buttonArray[(int)ButtonNames.back]) menuState = menuMainMenu; clearButtons(); }
private void menuMainMenu() { updateActionGroupStates(); menuSelectionTop = 2; menuSelectionBottom = Enum.GetValues(typeof(MainMenuItems)).Length + 1; textArray[0] = "Main Menu"; textArray[(int)MainMenuItems.flightdata + menuSelectionTop] = " Flight data"; textArray[(int)MainMenuItems.settings + menuSelectionTop] = " Settings"; textArray[(int)MainMenuItems.abort + menuSelectionTop] = " ABORT!"; textArray[(int)MainMenuItems.fuel + menuSelectionTop] = " Fuel"; textArray[(int)MainMenuItems.hover + menuSelectionTop] = " Hover"; string gearStateString = "Up"; if (gearState) gearStateString = "Down"; textArray[(int)MainMenuItems.gear + menuSelectionTop] = " Gear " + gearStateString; string brakeStateString = "Off"; if (brakeState) brakeStateString = "On"; textArray[(int)MainMenuItems.brakes + menuSelectionTop] = " Brakes " + brakeStateString; string SASStateString = "Off"; if (SASState) SASStateString = "On"; textArray[(int)MainMenuItems.SAS + menuSelectionTop] = " (A)SAS " + SASStateString; string lightStateString = "Off"; if (lightState) lightStateString = "On"; textArray[(int)MainMenuItems.light + menuSelectionTop] = " Lights " + lightStateString; textArray[(int)MainMenuItems.reboot + menuSelectionTop] = " Reboot"; textArray[linesPerPage - 1] = "root/main_menu"; textArray[menuSelection] += " <<<"; if (buttonArray[(int)ButtonNames.up]) menuSelection--; if (buttonArray[(int)ButtonNames.down]) menuSelection++; if (menuSelection < menuSelectionTop) menuSelection = menuSelectionTop; //up pressed if (menuSelection > menuSelectionBottom) menuSelection = menuSelectionBottom; // down pressed if (menuSelection > linesPerPage - 1) menuSelection = linesPerPage - 1; // down pressed if (buttonArray[(int)ButtonNames.confirm]) //confirm pressed { switch (menuSelection) { case (int)MainMenuItems.flightdata + 2: menuState = menuFlightData; break; case (int)MainMenuItems.settings + 2: menuState = menuSettings; break; case (int)MainMenuItems.abort + 2: pauseInitialized = false; menuState = menuAbort; break; case (int)MainMenuItems.fuel + 2: menuState = menuFuel; break; case (int)MainMenuItems.gear + 2: FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Gear); break; case (int)MainMenuItems.brakes + 2: FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Brakes); break; case (int)MainMenuItems.SAS + 2: FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.SAS); break; case (int)MainMenuItems.light + 2: FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Light); break; case (int)MainMenuItems.hover + 2: toggleHover(); break; case (int)MainMenuItems.reboot + 2: menuState = menuSplashScreen; RAMcount = 0; break; } } clearButtons(); }
private void menuInfo() { if (useInfoPopup) { for (int i = 0; i < infoPopupStrings.Length; i++) { textArray[i] = infoPopupStrings[i]; } textArray[linesPerPage - 1] = "root/settings/info"; if (buttonArray[(int)ButtonNames.confirm]) getInfoPopupText(); } else menuState = menuMainMenu; if (buttonArray[(int)ButtonNames.back]) menuState = menuMainMenu; clearButtons(); }
private void menuGunner() { textArray[5] = " Gunner module not"; textArray[6] = " installed. Contact"; textArray[7] = " your customer rep"; textArray[8] = " for a quote today!"; textArray[linesPerPage - 1] = "root/gunner"; if (buttonArray[(int)ButtonNames.back]) menuState = menuMainMenu; clearButtons(); }