Example #1
0
    public void Draw()
    {
        ES2EditorWindowStyle style = ES2EditorWindow.instance.style;

        float mainButtonHeight = style.menuMainButtonStyle.fixedHeight;
        float menuHeight       = style.menuStyle.fixedHeight;

        style.menuSubButtonStyle.fixedHeight = menuHeight - mainButtonHeight;

        //SetGUIStyles();
        Rect rect = EditorGUILayout.GetControlRect(false, menuHeight, style.menuStyle);

        GUI.BeginGroup(rect, style.menuStyle);

        for (int i = 0; i < mainButtons.Length; i++)
        {
            if (GUI.Button(new Rect((rect.width / mainButtons.Length) * i, rect.y, rect.width / mainButtons.Length, mainButtonHeight), new GUIContent(mainButtons [i], style.windowIcon), style.menuMainButtonStyle))
            {
                selectedSubMenuItemIndex = 0;
                selectedMenuItemIndex    = i;
            }
        }

        string[] activeSubButtons = subButtons[selectedMenuItemIndex];

        for (int i = 0; i < activeSubButtons.Length; i++)
        {
            if (GUI.Button(new Rect((rect.width / activeSubButtons.Length) * i, rect.y + mainButtonHeight, rect.width / activeSubButtons.Length, menuHeight - mainButtonHeight), activeSubButtons[i], style.menuSubButtonStyle))
            {
                selectedSubMenuItemIndex = i;
            }
        }

        GUI.EndGroup();
    }
    public void Draw()
    {
        ES2EditorWindowStyle style = ES2EditorWindow.instance.style;

        EditorGUILayout.BeginVertical(style.windowContentStyle);

        ES2EditorUtility.TextFieldReadOnly("Application.persistentDataPath", Application.persistentDataPath);

        EditorGUILayout.EndVertical();
    }
Example #3
0
    public void Draw()
    {
        ES2EditorWindowStyle style = ES2EditorWindow.instance.style;

        EditorGUILayout.BeginVertical(style.windowContentStyle);

        if (System.IO.File.Exists(Application.dataPath + "/Easy Save 2/changelog.txt"))
        {
            ES2EditorUtility.TextArea("", System.IO.File.ReadAllText(Application.dataPath + "/Easy Save 2/changelog.txt"));
        }
        else
        {
            ES2EditorUtility.TextArea("", "Change Log could not be found");
        }

        EditorGUILayout.EndVertical();
    }
    public void Draw()
    {
        ES2EditorWindowStyle style = ES2EditorWindow.instance.style;

        EditorGUILayout.BeginVertical(style.windowContentStyle);

        EditorGUILayout.BeginHorizontal(style.sectionStyle);
        if (ES2EditorUtility.Button("Clear Default Save Folder"))
        {
            ES2EditorTools.ClearDefaultSaveFolder();
        }
        if (ES2EditorUtility.Button("Clear PlayerPrefs"))
        {
            ES2EditorTools.ClearPlayerPrefs();
        }
        if (ES2EditorUtility.Button("Open Default Save Folder"))
        {
            ES2EditorTools.ShowInFileBrowser(Application.persistentDataPath);
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal(style.sectionStyle);
        if (ES2EditorUtility.Button("Add Default Settings Object to Scene"))
        {
            GameObject g = new GameObject();
            g.name = "Easy Save Default Settings";
            g.AddComponent <ES2GlobalSettings>();
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal(style.sectionStyle);
        if (ES2EditorUtility.Button("Enable or Update Playmaker Action"))
        {
            AssetDatabase.ImportPackage(Application.dataPath + "/Easy Save 2/Disabled/ES2Playmaker.unitypackage", false);
            AssetDatabase.Refresh();
            EditorUtility.DisplayDialog("Easy Save 2 PlayMaker Action Enabled",
                                        "Easy Save 2 PlayMaker Action has been Enabled and Updated.", "Ok");
        }

        EditorGUILayout.EndHorizontal();


        EditorGUILayout.EndVertical();
    }
    public void Draw()
    {
        ES2EditorWindowStyle style = ES2EditorWindow.instance.style;

        EditorGUILayout.BeginVertical(style.windowContentStyle);

        ES2EditorUtility.Subheading("Default Settings");

        EditorGUILayout.BeginVertical(style.sectionStyle);

        ES2GlobalSettings globals = globalSettings;

        //globals.saveLocation = (ES2.SaveLocation)EditorGUILayout.EnumPopup("Default Save Location:", (System.Enum)globals.saveLocation);
        globals.PCDataPath  = ES2EditorUtility.TextField("Default Windows Path", globals.PCDataPath);
        globals.MacDataPath = ES2EditorUtility.TextField("Default OSX Path", globals.MacDataPath);

        EditorGUILayout.EndVertical();


        EditorGUILayout.BeginVertical(style.sectionStyle);
        globals.encrypt = ES2EditorUtility.Toggle("Encrypt Data", globals.encrypt);
        EditorGUILayout.BeginHorizontal();
        globals.encryptionPassword = ES2EditorUtility.TextField("Encryption Password", globals.encryptionPassword);
        globals.saveLocation       = (ES2Settings.SaveLocation)ES2EditorUtility.EnumField("Default Save Location", globals.saveLocation);
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical(style.sectionStyle);

        EditorGUILayout.BeginHorizontal();
        globals.webUsername = ES2EditorUtility.TextField("Web Username", globals.webUsername);
        globals.webPassword = ES2EditorUtility.TextField("Web Password", globals.webPassword);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.EndVertical();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(globals);
        }

        EditorGUILayout.EndVertical();
    }
    public void Draw()
    {
        ES2EditorWindowStyle style = ES2EditorWindow.instance.style;

        // Don't allow Auto Save to be modified when playing.
        if (Application.isPlaying)
        {
            EditorGUILayout.BeginHorizontal(style.windowContentStyle);
            GUIStyle centerStyle = new GUIStyle(style.contentTextStyle);
            centerStyle.stretchHeight = true;
            centerStyle.alignment     = TextAnchor.MiddleCenter;
            EditorGUILayout.LabelField("Auto Save can not be modified in Play mode.", centerStyle);
            EditorGUILayout.EndHorizontal();
            return;
        }

        // If a manager hasn't been added to the scene, require that it is added.
        ES2AutoSaveManager mgr = ES2EditorAutoSaveUtility.mgr;

        if (mgr == null)
        {
            EditorGUILayout.BeginVertical(style.windowContentStyle);
            if (ES2EditorUtility.Button("Click to enable Auto Save for this scene"))
            {
                ES2EditorAutoSaveUtility.AddManagerToScene();
            }
            EditorGUILayout.EndVertical();
            return;
        }

        Undo.RecordObject(mgr, "Auto Save Settings");

        EditorGUILayout.BeginVertical(style.windowContentStyle);

        EditorGUILayout.BeginHorizontal(style.sectionStyle);
        mgr.loadEvent = (ES2AutoSaveManager.LoadEvent)ES2EditorUtility.EnumField("When to Load", mgr.loadEvent);
        mgr.saveEvent = (ES2AutoSaveManager.SaveEvent)ES2EditorUtility.EnumField("When to Save", mgr.saveEvent);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal(style.sectionStyle);
        mgr.filePath = ES2EditorUtility.TextField("Filename/Path", mgr.filePath);
        mgr.tag      = ES2EditorUtility.TextField("Tag", mgr.tag);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginVertical(style.sectionStyle);

        mgr.encrypt = ES2EditorUtility.Toggle("Use Encryption", mgr.encrypt);


        if (mgr.encrypt)
        {
            EditorGUILayout.BeginHorizontal(style.indentStyle);
            mgr.encryptionPassword = ES2EditorUtility.TextField("Encryption Password", mgr.encryptionPassword);
            mgr.encryptionType     = (ES2Settings.EncryptionType)ES2EditorUtility.EnumField("Encryption Type", mgr.encryptionType);
            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginHorizontal(style.sectionStyle);

        mgr.deletePrefabsOnLoad = ES2EditorUtility.Toggle("Delete Instantiated Prefabs on Load", mgr.deletePrefabsOnLoad);
        mgr.convertPrefabsToSceneObjectsOnImport = ES2EditorUtility.Toggle("Convert Prefabs To Scene Objects Upon Dragging Into Scene", mgr.convertPrefabsToSceneObjectsOnImport);

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal(style.sectionStyle);

        bool autoSaveComponentsAreHidden = ES2EditorAutoSaveUtility.AutoSaveComponentsAreHidden();

        if (ES2EditorUtility.Toggle("Hide Auto Save Components in Editor", autoSaveComponentsAreHidden) != autoSaveComponentsAreHidden)
        {
            ES2EditorAutoSaveUtility.ToggleHideAutoSaveComponents();
        }

        ES2EditorAutoSaveUtility.AutomaticallyRefreshSceneAutoSaves = ES2EditorUtility.Toggle("Automatically refresh Auto Saves when window is open", ES2EditorAutoSaveUtility.AutomaticallyRefreshSceneAutoSaves);

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal(style.sectionStyle);
        if (ES2EditorUtility.Button("Refresh Auto Saves in Scene"))
        {
            ES2EditorAutoSaveUtility.RefreshSceneAutoSaves();
        }

        if (ES2EditorUtility.Button("Refresh Auto Saves in Prefabs"))
        {
            ES2EditorAutoSaveUtility.RefreshPrefabAutoSaves();
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();

        if (ES2EditorUtility.Button("Remove Auto Save from Scene"))
        {
            ES2EditorAutoSaveUtility.RemoveAutoSaveFromScene();
        }
        if (ES2EditorUtility.Button("Remove Auto Save from all Prefabs"))
        {
            ES2EditorAutoSaveUtility.RemoveAutoSaveFromAllPrefabs();
        }
        EditorGUILayout.EndHorizontal();


        EditorGUILayout.EndVertical();
    }