Exemplo n.º 1
0
    public static void OnEditorGUIExpired(string toolName)
    {
        MadGUI.Error("This is an evaluation version of " + toolName + " and your evaluation period has expired. If you want to continue using " + toolName + " please purchase it or send a request for another evaluation period.");

        EditorGUILayout.Space();

        if (MadGUI.Button("Purchase", Color.yellow))
        {
            Application.OpenURL(PurchaseUrl);
        }

        EditorGUILayout.Space();

        if (MadGUI.Button("Request Another Evaluation Period", Color.magenta))
        {
            RequestExtend(toolName);
        }

        if (MadGUI.Button("I Have An Evaluation Key!", Color.green))
        {
            var builder = new MadInputDialog.Builder("Enter Key", "Enter new evaluation key.", (key) => {
                if (!string.IsNullOrEmpty(key))
                {
                    Extend(key.Trim());
                }
            });
            builder.BuildAndShow();
        }
    }
    private void TopPanel()
    {
        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("For Configuration: ");
        if (MadGUI.Button(configuration.name, Color.cyan))
        {
            Selection.activeObject = configuration;
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();

        int extensionCount = configuration.extensions.Count;

        if (extensionCount > 0)
        {
            MadGUI.LookLikeControls(120, 150);
            selectedExtensionIndex = MadGUI.DynamicPopup(selectedExtensionIndex, "Current Extension:", extensionCount, (index) => {
                var extension = configuration.extensions[index];
                return(extension.name);
            });
            MadGUI.LookLikeControls(0);

            GUILayout.FlexibleSpace();
            if (MadGUI.Button("Remove", Color.red))
            {
                RemoveExtension(selectedExtensionIndex);
            }
        }
        else
        {
            GUILayout.Label("There's no extensions yet.");
        }

        GUILayout.Space(10);

        if (MadGUI.Button("Create New Extension", Color.green))
        {
            var builder = new MadInputDialog.Builder("Create New Extension", "Enter a new extension name.", (result) => {
                if (!string.IsNullOrEmpty(result))
                {
                    var extension = CreateNewExtension(result);
                    if (extension != null)
                    {
                        currentExtension = extension;
                    }
                }
            });
            builder.BuildAndShow();
        }
        EditorGUILayout.EndHorizontal();
    }
    void OnGUI()
    {
        var arrayList = new MadGUI.ArrayList <MadLevelConfiguration.Group>(conf.groups, @group => {
            if (MadGUI.Button(@group.name))
            {
                var builder = new MadInputDialog.Builder("Rename group " + @group.name, "New name for group " + @group.name,
                                                         newName => TryRename(@group, newName));
                builder.BuildAndShow();
            }
            return(@group);
        });

        arrayList.beforeRemove += @group => {
            if (
                !EditorUtility.DisplayDialog("Remove Group",
                                             "Are you sure that you want to remove group " + @group.name + "?", "Yes", "No"))
            {
                return(false);
            }

            if (group.GetLevels().Count > 0)
            {
                MadUndo.RecordObject2(conf, "Remove Group");

                if (EditorUtility.DisplayDialog("Remove Levels As Well?",
                                                "Do you want to remove all levels in this group as well? "
                                                + "If no, all levels will be moved to default group.", "Yes", "No"))
                {
                    var levels = group.GetLevels();
                    conf.levels.RemoveAll((level) => levels.Contains(level));
                }
                else
                {
                    var defaultGroup = conf.defaultGroup;
                    var levels       = group.GetLevels();
                    foreach (var level in levels)
                    {
                        level.groupId = defaultGroup.id;
                    }
                }
            }

            return(true);
        };

        arrayList.beforeAdd = () => MadUndo.RecordObject2(conf, "Add Group");

        arrayList.createFunctionGeneric = CreateGroup;

        if (arrayList.Draw())
        {
            EditorUtility.SetDirty(conf);
        }
    }
Exemplo n.º 4
0
    public static void RequestExtend(string toolName)
    {
        var builder = new MadInputDialog.Builder("Request Evalutaion", "Please enter your e-mail address. New evaluation key will be sent to it.", (email) => {
            if (!string.IsNullOrEmpty(email))
            {
                Evaluate(email, toolName);
            }
        });

        builder.BuildAndShow();
    }
Exemplo n.º 5
0
    public static void EnterEvaluationKeyDialog()
    {
        var builder = new MadInputDialog.Builder("Enter Key", "Enter new evaluation key.", (key) => {
            if (!string.IsNullOrEmpty(key))
            {
                Extend(key.Trim());
            }
        });

        builder.BuildAndShow();
    }
    private void RenameGroup(MadLevelConfiguration.Group currentGroup)
    {
        var builder = new MadInputDialog.Builder("Enter Group Name", "Enter a new name for group \"" + currentGroup.name + "\".", (name) => {
            if (!string.IsNullOrEmpty(name))
            {
                currentGroup.name = name;
                EditorUtility.SetDirty(configuration);
            }
        });

        builder.defaultValue = currentGroup.name;
        builder.allowEmpty   = false;
        builder.BuildAndShow();
    }
 private void RenameGroup(MadLevelConfiguration.Group currentGroup) {
     var builder = new MadInputDialog.Builder("Enter Group Name", "Enter a new name for group \"" + currentGroup.name + "\".", (name) => {
         if (!string.IsNullOrEmpty(name)) {
             currentGroup.name = name;
             EditorUtility.SetDirty(configuration);
         }
     });
     builder.defaultValue = currentGroup.name;
     builder.allowEmpty = false;
     builder.BuildAndShow();
 }
Exemplo n.º 8
0
 public static void RequestExtend(string toolName) {
     var builder = new MadInputDialog.Builder("Request Evalutaion", "Please enter your e-mail address. New evaluation key will be sent to it.", (email) => {
         if (!string.IsNullOrEmpty(email)) {
             Evaluate(email, toolName);
         }
     });
     builder.BuildAndShow();
 }
Exemplo n.º 9
0
 public static void EnterEvaluationKeyDialog() {
     var builder = new MadInputDialog.Builder("Enter Key", "Enter new evaluation key.", (key) => {
         if (!string.IsNullOrEmpty(key)) {
             Extend(key.Trim());
         }
     });
     builder.BuildAndShow();
 }
Exemplo n.º 10
0
    private void TopPanel() {
        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("For Configuration: ");
        if (MadGUI.Button(configuration.name, Color.cyan)) {
            Selection.activeObject = configuration;
        }
        
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();

        int extensionCount = configuration.extensions.Count;

        if (extensionCount > 0) {
            MadGUI.LookLikeControls(120, 150);
            selectedExtensionIndex = MadGUI.DynamicPopup(selectedExtensionIndex, "Current Extension:", extensionCount, (index) => {
                var extension = configuration.extensions[index];
                return extension.name;
            });
            MadGUI.LookLikeControls(0);

            GUILayout.FlexibleSpace();
            if (MadGUI.Button("Remove", Color.red)) {
                RemoveExtension(selectedExtensionIndex);
            }
        } else {
            GUILayout.Label("There's no extensions yet.");
        }

        GUILayout.Space(10);

        if (MadGUI.Button("Create New Extension", Color.green)) {
            var builder = new MadInputDialog.Builder("Create New Extension", "Enter a new extension name.", (result) => {
                if (!string.IsNullOrEmpty(result)) {
                    var extension = CreateNewExtension(result);
                    if (extension != null) {
                        currentExtension = extension;
                    }

                }
            });
            builder.BuildAndShow();
        }
        EditorGUILayout.EndHorizontal();
    }
Exemplo n.º 11
0
    public static void OnEditorGUIExpired(string toolName) {
        MadGUI.Error("This is an evaluation version of " + toolName + " and your evaluation period has expired. If you want to continue using " + toolName + " please purchase it or send a request for another evaluation period.");

        EditorGUILayout.Space();

        if (MadGUI.Button("Purchase", Color.yellow)) {
            Application.OpenURL(PurchaseUrl);
        }

        EditorGUILayout.Space();

        if (MadGUI.Button("Request Another Evaluation Period", Color.magenta)) {
            RequestExtend(toolName);
        }

        if (MadGUI.Button("I Have An Evaluation Key!", Color.green)) {
            var builder = new MadInputDialog.Builder("Enter Key", "Enter new evaluation key.", (key) => {
                if (!string.IsNullOrEmpty(key)) {
                    Extend(key.Trim());
                }
            });
            builder.BuildAndShow();
        }
    }