Beispiel #1
0
 private void getWindowID()
 {
     if (windowID == 0)
     {
         windowID = FSGUIwindowID.getNextID();
     }
 }
    //private void setLaunchEventText()
    //{
    //    if (moveAtLaunch)
    //    {
    //        Events["toggleMoveAtLaunchEvent"].guiName = "Launch on runway";
    //    }
    //    else
    //    {
    //        Events["toggleMoveAtLaunchEvent"].guiName = "Launch in water";
    //    }
    //}

    public override void OnStart(PartModule.StartState state)
    {
        //setLaunchEventText();
        if (HighLogic.LoadedSceneIsFlight)
        {
            windowID        = FSGUIwindowID.getNextID();
            fileNameElement = new PopupElement("Name", "New");
            PopupElement saveButtonElement = new PopupElement(new PopupButton("Save", 0f, savePositionToFile));
            saveButtonElement.buttons.Add(new PopupButton("Cancel", 0f, cancelSave));
            popup = new FSGUIPopup(part, "FSmoveCraftAtLaunch", 0, windowID, FSGUIwindowID.standardRect, "Save Position", fileNameElement);
            popup.sections[0].elements.Add(saveButtonElement);
            popup.showCloseButton   = true;
            popup.useInEditor       = false;
            popup.useInActionEditor = false;
            popup.useInFlight       = true;
        }

        files = Directory.GetFiles(Firespitter.Tools.PlugInDataPath, "*.pos");
    }
Beispiel #3
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
    }
 public FSinputVisualizer()
 {
     windowID = FSGUIwindowID.getNextID();
 }
Beispiel #5
0
    public override void OnStart(PartModule.StartState state)
    {
        base.OnStart(state);
        if (popupWindowID == 0)
        {
            popupWindowID = FSGUIwindowID.getNextID();
        }
        firstPresetLine = 1;
        PopupElement element = new PopupElement(new PopupButton("+", 25f, adjustTrimFromButton));

        element.buttons.Add(new PopupButton("-", 25f, adjustTrimFromButton));
        element.buttons.Add(new PopupButton("Add", 43f, addPresetLine));
        element.buttons.Add(new PopupButton("Del", 43f, removePresetLine));
        popup = new FSGUIPopup(part, "FStrimAdjustment", moduleID, popupWindowID, new Rect(100f, 200f, 180f, 150f), axis + " Trim Adjustment", element);//FSGUIwindowID.trimAdjustment + moduleID


        if (HighLogic.LoadedSceneIsEditor)
        {
            //popup.showMenu = true;
            elementShowOnFlightStart           = new PopupElement("Show on Launch?", new PopupButton("Y", "N", 30f, toggleShowOnFlightStart));
            elementShowOnFlightStart.titleSize = 120f;
            popup.sections[0].elements.Add(elementShowOnFlightStart);
            elementShowOnFlightStart.buttons[0].toggle(showOnFlightStart);
            firstPresetLine = 2;
        }
        else
        {
            if (HighLogic.LoadedSceneIsFlight && showOnFlightStart)
            {
                popup.showMenu = true;
            }
            else
            {
                popup.showMenu = false;
            }
        }

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

        addPresetLine(presetTrim0);
        if (presetTrim1 != 0f)
        {
            addPresetLine(presetTrim1);
        }
        if (presetTrim2 != 0f)
        {
            addPresetLine(presetTrim2);
        }

        if (HighLogic.LoadedSceneIsEditor)
        {
            popup.windowRect.x = 450f;
        }

        Actions["togglePopupAction"].guiName      = "Toggle " + axis + " Popup";
        Actions["usePreset1Action"].guiName       = "Use " + axis + " Preset 1";
        Events["togglePopupEvent"].guiName        = "Toggle " + axis + " Popup";
        Actions["increaseTrimAction"].guiName     = axis + " trim + 1 step";
        Actions["decreaseTrimAction"].guiName     = axis + " trim - 1 step";
        Actions["increaseTrimMoreAction"].guiName = "" + axis + " trim +" + MoreTrimActionMultiplier + " steps";
        Actions["decreaseTrimMoreAction"].guiName = "" + axis + " trim -" + MoreTrimActionMultiplier + " steps";
    }
 public HelpPopup(string _windowTitle, string _text)
 {
     text        = _text;
     windowTitle = _windowTitle;
     GUIlayer    = FSGUIwindowID.getNextID();
 }