void Install(BoltPackage package)
    {
        string       packageName = package.name;
        PackageFlags flags       = package.packageFlags;

        if ((flags & PackageFlags.WarnForProjectOverwrite) == PackageFlags.WarnForProjectOverwrite)
        {
            if (ProjectExists())
            {
                if (EditorUtility.DisplayDialog("Warning",
                                                "Importing this package will overwrite the existing bolt project file that contains all your states, events, etc. Are you sure?",
                                                "Yes", "No") == false)
                {
                    return;
                }
            }
        }

        if ((flags & PackageFlags.RunInitialSetup) == PackageFlags.RunInitialSetup)
        {
            InitialSetup();
        }

        AssetDatabase.ImportPackage(PackagePath(packageName), false);

        currentStage = BoltSetupStage.Bolt;
    }
    void DrawInstallOption(BoltInstalls install)
    {
        BoltPackage package = packageInfo[install];

        Action action = () =>
        {
            if (package.installTest())
            {
                ShowNotification(new GUIContent("Package already installed"));
                return;
            }

            Install(package);
        };

        bool packageExists = PackageExists(package.name);

        Action ignoredAction;

        if (packageExists == true)
        {
            ignoredAction = () => { ShowNotification(new GUIContent("One of the dependencies is missing")); };
        }
        else
        {
            if (install == BoltInstalls.Core)
            {
                ignoredAction = () =>
                {
                    ShowNotification(new GUIContent("Bolt Core is no longer required. You are ready to go."));
                };
            }
            else
            {
                ignoredAction = () =>
                {
                    ShowNotification(new GUIContent("Please contact us at [email protected]"));
                };
            }

            EditorGUI.BeginDisabledGroup(true);
        }

        DrawStepOption(samplesIcon, new GUIContent(package.title), new GUIContent(package.description),
                       package.installTest(), action, ignoredAction);

        if (packageExists == false)
        {
            EditorGUI.EndDisabledGroup();
        }
    }
Exemple #3
0
    void DrawInstallOption(BoltInstalls install)
    {
        BoltPackage package = packageInfo[install];

        Action action = () =>
        {
            if (package.installTest())
            {
                Debug.LogWarning("Package already installed");
                return;
            }

            Install(package);
        };

        if (PackageExists(package.name))
        {
            DrawStepOption(samplesIcon, new GUIContent(package.title), new GUIContent(package.description), package.installTest(), action);
        }
    }