void Export()
 {
     ConfigParser.ExportAll();
 }
Esempio n. 2
0
        /// <summary>
        /// draw the editor window
        /// </summary>
        /// <param name="id"></param>
        private void DrawEditorWindow(int id)
        {
            if (isInitialized == false)
            {
                InititializeLayout();
            }

            GUILayout.BeginHorizontal();
            {
                GUI.enabled = false;
                GUILayout.Button("-KK-", DeadButton, GUILayout.Height(21));

                GUILayout.FlexibleSpace();

                GUILayout.Button("Statics Editor", DeadButton, GUILayout.Height(21));

                GUILayout.FlexibleSpace();

                GUI.enabled = true;

                if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(21)))
                {
                    ToggleEditor();
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(1);
            GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));

            GUILayout.Space(2);

            GUILayout.BeginHorizontal();
            {
                GUI.enabled = (mode != EditorMode.SPAWN);

                if (GUILayout.Button("" + "Spawn New", GUILayout.Height(23), GUILayout.Width(110)))
                {
                    EditorGUI.CloseEditors();
                    MapDecalEditor.Instance.Close();
                    mode = EditorMode.SPAWN;
                }

                GUI.enabled = true;
                GUILayout.Space(2);
                GUI.enabled = (mode != EditorMode.LOCAL);

                if (GUILayout.Button("Local Instances", GUILayout.Width(110), GUILayout.Height(23)))
                {
                    EditorGUI.CloseEditors();
                    MapDecalEditor.Instance.Close();
                    mode = EditorMode.LOCAL;
                    KerbalKonstructs.instance.DeletePreviewObject();
                }

                GUI.enabled = true;
                GUILayout.Space(2);
                GUI.enabled = (mode != EditorMode.PQS);

                if (GUILayout.Button("Edit MapDecals", GUILayout.Width(110), GUILayout.Height(23)))
                {
                    if (EditorGUI.instance.IsOpen())
                    {
                        EditorGUI.instance.Close();
                    }
                    mode = EditorMode.PQS;
                    KerbalKonstructs.instance.DeletePreviewObject();
                }


                GUI.enabled = true;
                GUILayout.Space(2);
                GUI.enabled = (mode != EditorMode.GROUP);

                if (GUILayout.Button("Edit Groups", GUILayout.Width(110), GUILayout.Height(23)))
                {
                    if (EditorGUI.instance.IsOpen())
                    {
                        EditorGUI.instance.Close();
                    }
                    MapDecalEditor.Instance.Close();

                    mode = EditorMode.GROUP;
                    KerbalKonstructs.instance.DeletePreviewObject();
                }

                GUI.enabled = true;

                GUILayout.FlexibleSpace();
                if (GUILayout.Button(new GUIContent("Export", "Export everyting into zip files"), UIMain.ButtonDefault, GUILayout.Width(90), GUILayout.Height(23)))
                {
                    ConfigParser.ExportAll();
                }
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(new GUIContent("Save", "Save all new and edited instances."), KerbalKonstructs.instance.hasDeletedInstances ? UIMain.ButtonTextOrange : UIMain.ButtonDefault, GUILayout.Width(90), GUILayout.Height(23)))
                {
                    KerbalKonstructs.instance.SaveObjects();
                    smessage = "Saved all changes to all objects.";
                    MiscUtils.HUDMessage(smessage, 10, 2);
                }
            }
            GUILayout.EndHorizontal();


            if (mode == EditorMode.SPAWN)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Space(15);
                if (GUILayout.Button("Category", DeadButton, GUILayout.Width(110), GUILayout.Height(23)))
                {
                    SortByCategory();
                }

                GUILayout.Space(5);
                if (GUILayout.Button("Title", DeadButton, GUILayout.Height(23)))
                {
                    SortByTitle();
                }
                GUILayout.FlexibleSpace();
                GUILayout.Button("Mesh", DeadButton, GUILayout.Width(140), GUILayout.Height(23));
                GUILayout.Space(15);
                GUILayout.EndHorizontal();
            }


            scrollPos = GUILayout.BeginScrollView(scrollPos);
            {
                switch (mode)
                {
                case EditorMode.SPAWN:
                    ShowModelsScroll();
                    break;

                case EditorMode.LOCAL:
                    ShowInstancesScroll();
                    break;

                case EditorMode.PQS:
                    ShowDecalsScroll();
                    break;

                case EditorMode.GROUP:
                    ShowGroupScroll();
                    break;
                }
            }
            GUILayout.EndScrollView();

            #region  Buttons below scroll view

            GUI.enabled = true;


            switch (mode)
            {
            case EditorMode.SPAWN:
                ShowModelsFooter();
                break;

            case EditorMode.LOCAL:
                ShowInstancesFootersLocal();
                break;

            case EditorMode.PQS:
                ShowDecalsFooter();
                break;

            case EditorMode.GROUP:
                ShowGroupFooter();
                break;
            }


            #endregion

            GUILayout.Space(1);
            GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));

            GUILayout.Space(2);

            if (GUI.tooltip != "")
            {
                var labelSize = GUI.skin.GetStyle("Label").CalcSize(new GUIContent(GUI.tooltip));
                GUI.Box(new Rect(Event.current.mousePosition.x - (25 + (labelSize.x / 2)), Event.current.mousePosition.y - 40, labelSize.x + 10, labelSize.y + 5), GUI.tooltip);
            }

            GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        }