コード例 #1
0
        public static void TargetWindowShipEditor(int id)
        {
            GUIStyle guiStyleLabel;
            GUIStyle guiStyleLabelNorm = new GUIStyle(GUI.skin.GetStyle("Label"));
            GUIStyle guiStyleLabelBold = new GUIStyle(GUI.skin.GetStyle("Label"));

            guiStyleLabelBold.fontStyle = FontStyle.Bold;

            GUIStyle guiStyleButton;
            GUIStyle guiStyleButtonNorm = new GUIStyle(GUI.skin.GetStyle("Button"));
            GUIStyle guiStyleButtonBold = new GUIStyle(GUI.skin.GetStyle("Button"));

            guiStyleButtonBold.fontStyle = FontStyle.Bold;

            GUIStyle guiStyleButtonRed = new GUIStyle(GUI.skin.GetStyle("Button"));

            guiStyleButtonRed.fontStyle        = FontStyle.Bold;
            guiStyleButtonRed.normal.textColor = Color.red;
            guiStyleButtonRed.hover.textColor  = Color.red;

            // Close Button
            if (GUI.Button(new Rect(AHEditor.rectTargetShipEditorWindow.size.x - 20, 2, 18, 18), "X"))
            {
                AHEditor.CloseTargetShipEditorWindow();
            }

            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            if (vab)
            {
                guiStyleButton = guiStyleButtonBold;
            }
            else
            {
                guiStyleButton = guiStyleButtonNorm;
            }
            if (GUILayout.Button(/*VAB*/ Localizer.Format("#autoLOC_AH_0019"), guiStyleButton))
            {
                vab = true;
            }

            if (vab)
            {
                guiStyleButton = guiStyleButtonNorm;
            }
            else
            {
                guiStyleButton = guiStyleButtonBold;
            }
            if (GUILayout.Button(/*SPH*/ Localizer.Format("#autoLOC_AH_0020"), guiStyleButton))
            {
                vab = false;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(35f);
            if (relay)
            {
                guiStyleButton = guiStyleButtonNorm;
            }
            else
            {
                guiStyleButton = guiStyleButtonBold;
            }
            if (GUILayout.Button(/*All*/ Localizer.Format("#autoLOC_AH_0021"), guiStyleButton))
            {
                relay = false;
            }

            if (relay)
            {
                guiStyleButton = guiStyleButtonBold;
            }
            else
            {
                guiStyleButton = guiStyleButtonNorm;
            }
            if (GUILayout.Button(/*Relay*/ Localizer.Format("#autoLOC_AH_0003"), guiStyleButton))
            {
                relay = true;
            }
            GUILayout.Space(35f);
            GUILayout.EndHorizontal();

            scrollVectorEditor = GUILayout.BeginScrollView(scrollVectorEditor);
            if (vab)
            {
                if (relay)
                {
                    displayList = AHEditor.guiExternListShipEditorVabRelay;
                }
                else
                {
                    displayList = AHEditor.guiExternListShipEditorVabAll;
                }
            }
            else
            {
                if (relay)
                {
                    displayList = AHEditor.guiExternListShipEditorSphRelay;
                }
                else
                {
                    displayList = AHEditor.guiExternListShipEditorSphAll;
                }
            }

            foreach (Dictionary <string, string> vesselInfo in displayList)
            {
                if ((vab && (vesselInfo ["type"] != "VAB")) || (!vab && (vesselInfo ["type"] != "SPH")))
                {
                    continue;
                }

                GUILayout.BeginHorizontal();
                if (GUILayout.Button(Localizer.Format("#autoLOC_AH_0022"), GUILayout.Width(60f)))
                {
                    AHEditor.SetTarget(vesselInfo ["pid"]);
                }

                if (AHEditor.targetPid == vesselInfo ["pid"])
                {
                    guiStyleLabel = guiStyleLabelBold;
                }
                else
                {
                    guiStyleLabel = guiStyleLabelNorm;
                }
                GUILayout.Label(
                    "("
                    + AHUtil.TruePower(Double.Parse(vesselInfo ["powerRelay"])).ToString("N0")
                    + ")  "
                    + vesselInfo ["name"], guiStyleLabel);
                if (GUILayout.Button("X", guiStyleButtonRed, GUILayout.Width(22f)))
                {
                    AHEditor.RemoveShipFromShipList(vesselInfo ["pid"]);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();

            GUILayout.EndVertical();
        }
コード例 #2
0
        public static void TargetWindow(int id)
        {
            // Close Button
            if (GUI.Button(new Rect(AHEditor.rectTargetWindow.size.x - 20, 2, 18, 18), "X"))
            {
                AHEditor.CloseTargetWindow();
            }

            GUIStyle guiStyle;
            GUIStyle guiStyleNorm = new GUIStyle(GUI.skin.GetStyle("Button"));
            GUIStyle guiStyleBold = new GUIStyle(GUI.skin.GetStyle("Button"));

            guiStyleBold.fontStyle = FontStyle.Bold;

            GUILayout.BeginVertical();

            for (int i = 0; i < 3; i++)
            {
                string dsnStr;
                if (i / 2f == AHEditor.trackingStationLevel)
                {
                    dsnStr = "** " + /*DSN Level*/ Localizer.Format("#autoLOC_AH_0015") + " " + (i + 1) + "  (" + GameVariables.Instance.GetDSNRange(i / 2f).ToString("N0") + ") **";
                }
                else
                {
                    dsnStr = /*DSN Level*/ Localizer.Format("#autoLOC_AH_0015") + " " + (i + 1) + "  (" + GameVariables.Instance.GetDSNRange(i / 2f).ToString("N0") + ")";
                }

                if ((AHEditor.targetType == AHEditorTargetType.DSN) &&
                    (AHEditor.targetName == /*DSN Level*/ Localizer.Format("#autoLOC_AH_0015") + " " + (i + 1).ToString()))
                {
                    guiStyle = guiStyleBold;
                }
                else
                {
                    guiStyle = guiStyleNorm;
                }

                if (GUILayout.Button(dsnStr, guiStyle))
                {
                    AHEditor.SetTarget(i / 2f);
                }
            }

            GUILayout.BeginHorizontal();
            if (AHEditor.targetType == AHEditorTargetType.FLIGHT)
            {
                guiStyle = guiStyleBold;
            }
            else
            {
                guiStyle = guiStyleNorm;
            }
            if (GUILayout.Button(/*In-Flight Ships*/ Localizer.Format("#autoLOC_AH_0016"), guiStyle))
            {
                AHEditor.CloseTargetShipEditorWindow();
                AHEditor.CloseTargetPartWindow();
                AHEditor.showTargetShipFlightWindow = true;
            }

            if (AHEditor.targetType == AHEditorTargetType.EDITOR)
            {
                guiStyle = guiStyleBold;
            }
            else
            {
                guiStyle = guiStyleNorm;
            }
            if (GUILayout.Button(/*Editor Ships*/ Localizer.Format("#autoLOC_AH_0017"), guiStyle))
            {
                AHEditor.CloseTargetShipFlightWindow();
                AHEditor.CloseTargetPartWindow();
                AHEditor.showTargetShipEditorWindow = true;
            }

            if (AHEditor.targetType == AHEditorTargetType.PART)
            {
                guiStyle = guiStyleBold;
            }
            else
            {
                guiStyle = guiStyleNorm;
            }
            if (GUILayout.Button(/*Antenna Parts*/ Localizer.Format("#autoLOC_AH_0018"), guiStyle))
            {
                AHEditor.CloseTargetShipEditorWindow();
                AHEditor.CloseTargetShipFlightWindow();
                AHEditor.showTargetPartWindow = true;
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
            GUI.DragWindow();
        }