Exemple #1
0
        public void DrawEditorGUI(int windowID)
        {
            GUILayout.BeginVertical();
            //provide toggles to turn highlighting on/off
            if (GUILayout.Button("Toggle Vessel Highlighting"))
            {
                highLight = !highLight;
                if (highLight)
                {
                    HighlightAll();
                }
                else
                {
                    UnHighlightAll();
                }
            }

            if (GUILayout.Button("Tanks: " + (tanksDry ? "Empty" : "Full")))
            {
                tanksDry = !tanksDry;
                if (highLight)
                {
                    HighlightAll();
                }
            }

            //list each stage, with info for each
            for (int i = 0; i < stages.Count; i++)
            //foreach (EditorStatItem stage in stages)
            {
                EditorStatItem stage = stages[i];

                GUILayout.BeginHorizontal();
                GUILayout.Label("Stage " + stage.stageNumber);
                double vel = tanksDry ? stage.EmptyVelocity : stage.FullVelocity;
                GUILayout.Label(vel.ToString("N1") + " m/s");
                GUILayout.Label(stage.GetRecoveryPercent(tanksDry) + "%");
                //    GUILayout.Label("("+stage.FullVelocity.ToString("N1") + ")");
                if (GUILayout.Button("Highlight"))
                {
                    //highlight this stage and unhighlight all others
                    bool status = stage.Highlighted;
                    if (highLight)
                    {
                        status = false;
                    }

                    UnHighlightAll();
                    stage.SetHighlight(!status, tanksDry);
                }
                GUILayout.EndHorizontal();
            }


            if (GUILayout.Button("Recalculate"))
            {
                Recalculate();
#if false
                BreakShipIntoStages();
                if (highLight)
                {
                    HighlightAll();
                }

                EditorGUIRect.height = 1; //reset the height so it is the smallest size it needs to be
#endif
            }
            GUILayout.EndVertical();

            /* if (GUI.Button(new Rect(EditorGUIRect.xMax-10, EditorGUIRect.yMin, 10, 10), "X"))
             * {
             *   UnHighlightAll();
             *   showEditorGUI = false;
             * }*/

            //Make it draggable
            if (!Input.GetMouseButtonDown(1) && !Input.GetMouseButtonDown(2))
            {
                GUI.DragWindow();
            }
        }
        public void DrawEditorGUI(int windowID)
        {
            GUILayout.BeginVertical();
            //provide toggles to turn highlighting on/off
            if (GUILayout.Button(Localizer.Format("#StageRecovery_Highlight")))//"Toggle Vessel Highlighting"
            {
                highLight = !highLight;
                if (highLight)
                {
                    HighlightAll();
                }
                else
                {
                    UnHighlightAll();
                }
            }

            if (GUILayout.Button(Localizer.Format("#StageRecovery_TanksDry", (tanksDry ? Localizer.Format("#StageRecovery_TanksEmpty") :Localizer.Format("#StageRecovery_TanksFull")))))//"Tanks: " + "Empty" : "Full"
            {
                tanksDry = !tanksDry;
                if (highLight)
                {
                    HighlightAll();
                }
            }

            //list each stage, with info for each
            for (int i = 0; i < stages.Count; i++)
            //foreach (EditorStatItem stage in stages)
            {
                EditorStatItem stage = stages[i];

                GUILayout.BeginHorizontal();
                GUILayout.Label(Localizer.Format("", stage.stageNumber));//"Stage " +
                double vel = tanksDry ? stage.EmptyVelocity : stage.FullVelocity;
                GUILayout.Label(vel.ToString("N1") + " m/s");
                GUILayout.Label(stage.GetRecoveryPercent(tanksDry) + "%");
                //    GUILayout.Label("("+stage.FullVelocity.ToString("N1") + ")");
                if (GUILayout.Button(Localizer.Format("#StageRecovery_Highlight2")))//"Highlight"
                {
                    //highlight this stage and unhighlight all others
                    bool status = stage.Highlighted;
                    if (highLight)
                    {
                        status = false;
                    }

                    UnHighlightAll();
                    stage.SetHighlight(!status, tanksDry);
                }
                GUILayout.EndHorizontal();
            }


            if (GUILayout.Button(Localizer.Format("#StageRecovery_Recalculate")))//"Recalculate"
            {
                Recalculate();
            }

            GUILayout.EndVertical();

            /* if (GUI.Button(new Rect(EditorGUIRect.xMax-10, EditorGUIRect.yMin, 10, 10), "X"))
             * {
             *   UnHighlightAll();
             *   showEditorGUI = false;
             * }*/

            //Make it draggable
            if (!Input.GetMouseButtonDown(1) && !Input.GetMouseButtonDown(2))
            {
                GUI.DragWindow();
            }
        }