/*[KSPEvent(name = "toggleDirection", active = true, guiActive = true, guiName = "toggle direction")]
         * public void toggleDirectionEvent()
         * {
         *  directionInt++;
         *  if (directionInt > 5) directionInt = 0;
         *  switch (directionInt)
         *  {
         *      case 0:
         *          direction = Vector3.up;
         *          vectorName = "up";
         *          break;
         *      case 1:
         *          direction = -Vector3.up;
         *          vectorName = "-up";
         *          break;
         *      case 2:
         *          direction = Vector3.right;
         *          vectorName = "right";
         *          break;
         *      case 3:
         *          direction = -Vector3.right;
         *          vectorName = "-right";
         *          break;
         *      case 4:
         *          direction = Vector3.forward;
         *          vectorName = "forward";
         *          break;
         *      case 5:
         *          direction = -Vector3.forward;
         *          vectorName = "-forward";
         *          break;
         *      default:
         *          direction = Vector3.forward;
         *          vectorName = "default";
         *          break;
         *  }
         * }*/

        public override void OnStart(PartModule.StartState state)
        {
            engine           = new FSengineWrapper(part);
            defaultMaxThrust = engine.maxThrust;
            if (useAtmospehricNerfModule == 1)
            {
                atmosphericNerf = part.Modules.OfType <FSpropellerAtmosphericNerf>().FirstOrDefault();
            }
            thrustTransform = part.FindModelTransform("thrustTransform");
        }
Пример #2
0
        public override void OnStart(PartModule.StartState state)
        {
            engine = new FSengineWrapper(part);
            if (usesDeployAnimation == 1)
            {
                deployAnimation = part.Modules.OfType <FSanimateGeneric>().FirstOrDefault();
            }

            atmosphericNerf = part.Modules.OfType <FSpropellerAtmosphericNerf>().FirstOrDefault();
            if (rotorparent != "")
            {
                RotorParent     = part.FindModelTransform(rotorparent);
                spinRotorObject = true;
            }
            else
            {
                spinRotorObject = false;
            }
        }
Пример #3
0
        public override void OnStart(PartModule.StartState state)
        {
            base.OnStart(state);

            if (popupWindowID == 0)
            {
                popupWindowID = FSGUIwindowID.getNextID();
                Log.dbg("Assigned window ID: {0}", popupWindowID);
            }

            partTransform = part.FindModelTransform(targetPartObject);
            buildAngleList();

            elementSteerRoll      = new PopupElement("Use roll steering", new PopupButton("Yes", "No", 0f, toggleSteerRoll));
            elementSteerYaw       = new PopupElement("Use yaw steering", new PopupButton("Yes", "No", 0f, toggleSteerYaw));
            elementSteerPitch     = new PopupElement("Use pitch steering", new PopupButton("Yes", "No", 0f, toggleSteerPitch));
            elementSteerPitchType = new PopupElement("Pitch type", new PopupButton("Throttle", "Rotation", 0f, toggleSteerPitchType));
            elementSteerPitchType.buttons.Add(new PopupButton("Front", "Rear", 0f, toggleSteerPitchLocation));

            elementVTOLSteeringMode = new PopupElement("Mode", new PopupButton("Off", 0f, buttonSetVTOLSteering));
            elementVTOLSteeringMode.buttons.Add(new PopupButton("Single", 0f, buttonSetVTOLSteering));
            elementVTOLSteeringMode.buttons.Add(new PopupButton("Double", 0f, buttonSetVTOLSteering));
            elementVTOLSteeringMode.buttons.Add(new PopupButton("Custom", 0f, buttonSetVTOLSteering));
            elementVTOLSteeringMode.titleSize = 30f;

            #region in editor
            if (HighLogic.LoadedSceneIsEditor)
            {
                elementInfoText = new PopupElement("Presets set to 0 are excluded.");
                popup           = new FSGUIPopup(part, "FSVTOLrotator", 0, popupWindowID, new Rect(550f, 200f, 325f, 150f), "VTOL presets", elementInfoText); //FSGUIwindowID.VTOLrotator
                popup.sections[0].elements.Add(new PopupElement("Settings are per engine!"));

                elementTestAngle = new PopupElement(new PopupButton("Use Preset " + selectedListAngle, 100f, testUseAngle));
                popup.sections[0].elements.Add(elementTestAngle);
                elementTestAngle.buttons.Add(new PopupButton("Next", 40f, testNextAngle));
                elementTestAngle.buttons.Add(new PopupButton("Reset", 50f, testReset));

                elementStepSize           = new PopupElement("Step size", stepAngle.ToString());
                elementStepSize.titleSize = 135f;
                elementStepSize.inputSize = 55f;
                popup.sections[0].elements.Add(elementStepSize);

                elementMaxDownAngle           = new PopupElement("Max negative rot.,", maxDownAngle.ToString());
                elementMaxDownAngle.titleSize = 135f;
                elementMaxDownAngle.inputSize = 55f;
                popup.sections[0].elements.Add(elementMaxDownAngle);

                for (int i = 0; i <= 5; i++) // ------------- hard coded ---------------------------
                {
                    elementPresets.Add(new PopupElement());
                    float presetAngle = 0f;
                    if (i < availableAnglesList.Count)
                    {
                        presetAngle = availableAnglesList[i];
                    }
                    elementPresets[i]           = new PopupElement("Preset " + i, presetAngle.ToString());
                    elementPresets[i].titleSize = 135f;
                    elementPresets[i].inputSize = 55f;
                    popup.sections[0].elements.Add(elementPresets[i]);
                }

                popup.sections[0].elements.Add(new PopupElement("--- VTOL steering ---"));
                popup.sections[0].elements.Add(elementVTOLSteeringMode);
                popup.sections[0].elements.Add(elementSteerRoll);
                popup.sections[0].elements.Add(elementSteerYaw);
                popup.sections[0].elements.Add(elementSteerPitch);
                popup.sections[0].elements.Add(elementSteerPitchType);
                updateButtonTexts();

                popup.useInFlight = false;
                popup.useInEditor = true;
                //popup.useInActionEditor = true;
            }
            #endregion

            #region in flight
            if (HighLogic.LoadedSceneIsFlight)
            {
                atmosphericNerf = part.Modules.OfType <FSpropellerAtmosphericNerf>().FirstOrDefault();
                // --- moved the element creation to the top, for use in both editor and flight
                popup = new FSGUIPopup(part, "FSVTOLrotator", 0, popupWindowID, new Rect(500f, 300f, 250f, 100f), "VTOL steering", elementSteerRoll); //FSGUIwindowID.VTOLrotator
                popup.sections[0].elements.Add(elementSteerYaw);
                popup.sections[0].elements.Add(elementSteerPitch);
                popup.sections[0].elements.Add(elementSteerPitchType);

                popup.useInFlight       = true;
                popup.useInActionEditor = false;

                if (VTOLSteeringMode != "Custom")
                {
                    updateSteeringSetup(VTOLSteeringMode);
                }
                else
                {
                    Events["showPopupEvent"].guiActive = true;
                }

                updateButtonTexts();
            }
            #endregion
        }
Пример #4
0
        public override void OnStart(PartModule.StartState state)
        {
            base.OnStart(state);

            if (popupWindowID == 0)
            {
                popupWindowID = FSGUIwindowID.getNextID();
                //Debug.Log("Assigned window ID: " + popupWindowID);
            }

            partTransform = part.FindModelTransform(targetPartObject);
            buildAngleList();

            elementSteerRoll = new PopupElement("Use roll steering", new PopupButton("Yes", "No", 0f, toggleSteerRoll));
            elementSteerYaw = new PopupElement("Use yaw steering", new PopupButton("Yes", "No", 0f, toggleSteerYaw));
            elementSteerPitch = new PopupElement("Use pitch steering", new PopupButton("Yes", "No", 0f, toggleSteerPitch));
            elementSteerPitchType = new PopupElement("Pitch type", new PopupButton("Throttle", "Rotation", 0f, toggleSteerPitchType));
            elementSteerPitchType.buttons.Add(new PopupButton("Front", "Rear", 0f, toggleSteerPitchLocation));

            elementVTOLSteeringMode = new PopupElement("Mode", new PopupButton("Off", 0f, buttonSetVTOLSteering));
            elementVTOLSteeringMode.buttons.Add(new PopupButton("Single", 0f, buttonSetVTOLSteering));
            elementVTOLSteeringMode.buttons.Add(new PopupButton("Double", 0f, buttonSetVTOLSteering));
            elementVTOLSteeringMode.buttons.Add(new PopupButton("Custom", 0f, buttonSetVTOLSteering));
            elementVTOLSteeringMode.titleSize = 30f;

            #region in editor
            if (HighLogic.LoadedSceneIsEditor)
            {
                elementInfoText = new PopupElement("Presets set to 0 are excluded.");
                popup = new FSGUIPopup(part, "FSVTOLrotator", 0, popupWindowID, new Rect(550f, 200f, 325f, 150f), "VTOL presets", elementInfoText); //FSGUIwindowID.VTOLrotator
                popup.sections[0].elements.Add(new PopupElement("Settings are per engine!"));

                elementTestAngle = new PopupElement(new PopupButton("Use Preset " + selectedListAngle, 100f, testUseAngle));
                popup.sections[0].elements.Add(elementTestAngle);
                elementTestAngle.buttons.Add(new PopupButton("Next", 40f, testNextAngle));
                elementTestAngle.buttons.Add(new PopupButton("Reset", 50f, testReset));

                elementStepSize = new PopupElement("Step size", stepAngle.ToString());
                elementStepSize.titleSize = 135f;
                elementStepSize.inputSize = 55f;
                popup.sections[0].elements.Add(elementStepSize);

                elementMaxDownAngle = new PopupElement("Max negative rot.,", maxDownAngle.ToString());
                elementMaxDownAngle.titleSize = 135f;
                elementMaxDownAngle.inputSize = 55f;
                popup.sections[0].elements.Add(elementMaxDownAngle);

                for (int i = 0; i <= 5; i++) // ------------- hard coded ---------------------------
                {
                    elementPresets.Add(new PopupElement());
                    float presetAngle = 0f;
                    if (i < availableAnglesList.Count)
                    {
                        presetAngle = availableAnglesList[i];
                    }
                    elementPresets[i] = new PopupElement("Preset " + i, presetAngle.ToString());
                    elementPresets[i].titleSize = 135f;
                    elementPresets[i].inputSize = 55f;
                    popup.sections[0].elements.Add(elementPresets[i]);
                }

                popup.sections[0].elements.Add(new PopupElement("--- VTOL steering ---"));
                popup.sections[0].elements.Add(elementVTOLSteeringMode);
                popup.sections[0].elements.Add(elementSteerRoll);
                popup.sections[0].elements.Add(elementSteerYaw);
                popup.sections[0].elements.Add(elementSteerPitch);
                popup.sections[0].elements.Add(elementSteerPitchType);
                updateButtonTexts();

                popup.useInFlight = false;
                popup.useInEditor = true;
                //popup.useInActionEditor = true;            
            }
            #endregion

            #region in flight
            if (HighLogic.LoadedSceneIsFlight)
            {
                atmosphericNerf = part.Modules.OfType<FSpropellerAtmosphericNerf>().FirstOrDefault();
                // --- moved the element creation to the top, for use in both editor and flight
                popup = new FSGUIPopup(part, "FSVTOLrotator", 0, popupWindowID, new Rect(500f, 300f, 250f, 100f), "VTOL steering", elementSteerRoll); //FSGUIwindowID.VTOLrotator
                popup.sections[0].elements.Add(elementSteerYaw);
                popup.sections[0].elements.Add(elementSteerPitch);
                popup.sections[0].elements.Add(elementSteerPitchType);

                popup.useInFlight = true;
                popup.useInActionEditor = false;

                if (VTOLSteeringMode != "Custom")
                {
                    updateSteeringSetup(VTOLSteeringMode);
                }
                else
                {
                    Events["showPopupEvent"].guiActive = true;
                }

                updateButtonTexts();
            }
            #endregion
        }
Пример #5
0
        /*[KSPEvent(name = "toggleDirection", active = true, guiActive = true, guiName = "toggle direction")]
        public void toggleDirectionEvent()
        {
            directionInt++;
            if (directionInt > 5) directionInt = 0;
            switch (directionInt)
            {
                case 0:
                    direction = Vector3.up;
                    vectorName = "up";
                    break;
                case 1:
                    direction = -Vector3.up;
                    vectorName = "-up";
                    break;
                case 2:
                    direction = Vector3.right;
                    vectorName = "right";
                    break;
                case 3:
                    direction = -Vector3.right;
                    vectorName = "-right";
                    break;
                case 4:
                    direction = Vector3.forward;
                    vectorName = "forward";
                    break;
                case 5:
                    direction = -Vector3.forward;
                    vectorName = "-forward";
                    break;
                default:
                    direction = Vector3.forward;
                    vectorName = "default";
                    break;        
            }
        }*/

        public override void OnStart(PartModule.StartState state)
        {
            engine = new FSengineWrapper(part);
            defaultMaxThrust = engine.maxThrust;
            if (useAtmospehricNerfModule == 1)
                atmosphericNerf = part.Modules.OfType<FSpropellerAtmosphericNerf>().FirstOrDefault();
            thrustTransform = part.FindModelTransform("thrustTransform");
        }
Пример #6
0
 public override void OnStart(PartModule.StartState state)
 {
     engine = new FSengineWrapper(part);
     if (usesDeployAnimation == 1)
     {
         deployAnimation = part.Modules.OfType<FSanimateGeneric>().FirstOrDefault();
     }
     
     atmosphericNerf = part.Modules.OfType<FSpropellerAtmosphericNerf>().FirstOrDefault();
     if (rotorparent != "")
     {
         RotorParent = part.FindModelTransform(rotorparent);
         spinRotorObject = true;
     }
     else
     {
         spinRotorObject = false;
     }
 }