Exemplo n.º 1
0
        protected void drawLoadAndCancelButtons(EditorBayItem editorBayItem)
        {
            Color         oldColor = GUI.backgroundColor;
            ShipConstruct ship     = EditorLogic.fetch.ship;

            //Load button
            GUILayout.BeginHorizontal();
            GUI.backgroundColor = XKCDColors.LemonYellow;
            if (GUILayout.Button(launchIcon, buttonOptions))
            {
                loadVessel(editorBayItem);

                /*
                 * //Launch the vessel. This will fill the ship with a default crew, which isn't what we want.
                 * if (isVAB)
                 *  HighLogic.CurrentGame.editorFacility = EditorFacility.VAB;
                 * else
                 *  HighLogic.CurrentGame.editorFacility = EditorFacility.SPH;
                 *
                 * VesselCrewManifest manifest = KSP.UI.CrewAssignmentDialog.Instance.GetManifest();
                 * if (manifest == null)
                 *  manifest = HighLogic.CurrentGame.CrewRoster.DefaultCrewForVessel(EditorLogic.fetch.ship.SaveShip(), null, true);
                 *
                 * FlightDriver.StartWithNewLaunch(editorBayItem.vesselFilePath, EditorLogic.FlagURL, EditorLogic.fetch.launchSiteName, manifest);
                 */
            }
            launchIcon          = selectLoadIcon();
            GUI.backgroundColor = oldColor;

            //Cancel Integration button
            GUI.backgroundColor = XKCDColors.ColorTranslator.FromHtml("#fe7e56");
            if (GUILayout.Button(exitIcon, buttonOptions))
            {
                //Return workers
                BARISScenario.Instance.ReturnWorkers(editorBayItem);

                //Clear the bay
                editorBayItem.Clear();
                BARISLaunchButtonManager.editorBayItem = null;

                //Delete the vessel file
                editorBayItem.DeleteSnapshot();

                BARISScenario.Instance.SetEditorBay(editorBayItem);

                //Save the game
                GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
            }
            exitIcon            = selectExitIcon();
            GUI.backgroundColor = oldColor;
            GUILayout.EndHorizontal();
        }
Exemplo n.º 2
0
        protected void drawLoadAndCancelButtons(EditorBayItem editorBayItem)
        {
            Color         oldColor = GUI.backgroundColor;
            ShipConstruct ship     = EditorLogic.fetch.ship;

            //Load button
            GUILayout.BeginHorizontal();
            GUI.backgroundColor = XKCDColors.LemonYellow;
            if (KACWrapper.InstanceExists && KACWrapper.APIReady && editorBayItem.isCompleted)
            {
                if (GUILayout.Button(launchIcon, buttonOptions))
                {
                    loadVessel(editorBayItem);
                }
                launchIcon = selectLoadIcon();
            }
            else if (!KACWrapper.AssemblyExists || !KACWrapper.APIReady)
            {
                if (GUILayout.Button(launchIcon, buttonOptions))
                {
                    loadVessel(editorBayItem);
                }
                launchIcon = selectLoadIcon();
            }
            GUI.backgroundColor = oldColor;

            //Cancel Integration button
            GUI.backgroundColor = XKCDColors.ColorTranslator.FromHtml("#fe7e56");
            if (GUILayout.Button(exitIcon, buttonOptions))
            {
                //Return workers
                BARISScenario.Instance.ReturnWorkers(editorBayItem);

                //Clear the bay
                editorBayItem.Clear();
                BARISLaunchButtonManager.editorBayItem = null;

                //Delete the vessel file
                editorBayItem.DeleteSnapshot();

                BARISScenario.Instance.SetEditorBay(editorBayItem);

                //Save the game
                GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
            }
            exitIcon            = selectExitIcon();
            GUI.backgroundColor = oldColor;
            GUILayout.EndHorizontal();
        }