Esempio n. 1
0
        private Action <KitsObject, ImportedKit, DisplayedKitStatus> SelectKit()
        {
            return(delegate(KitsObject availableKit, ImportedKit importedKit, DisplayedKitStatus status) {
                string kitName = importedKit != null ? importedKit.Name : availableKit.Name;

                if (Update.PeriodicUpdateManager.IsPluginUpdateRequired(kitName))
                {
                    EditorUtility.DisplayDialog(
                        "A plugin update is required",
                        kitName + " requires a newer version of the Fabric Plugin, please update by clicking 'View Update'.",
                        "OK"
                        );
                    return;
                }

                if (importedKit != null)
                {
                    // If the latest version of a kit is installed, or the latest version is imported into the project,
                    // start the normal kit flow.
                    if (status == DisplayedKitStatus.Installed || importedKit.Instance.Version() == new System.Version(availableKit.Version))
                    {
                        Settings.Instance.FlowSequence = 0;
                        Settings.Instance.Kit = importedKit.Name;
                        this.kit = importedKit;
                        return;
                    }
                }

                // Kit is imported, but not at the latest version, or the kit is not imported. This means
                // we need to download the newest version.
                FabricInstaller.Config config = new FabricInstaller.Config(
                    availableKit.PackageUrl,
                    availableKit.PackageName,
                    availableKit.ReleaseNotesUrl
                    );

                kit = null;

                Settings.Instance.FlowSequence = (int)UpdateFlow.Kit;
                Settings.Instance.Kit = kitName;

                List <string> kitsToUpdateDueToDependencies = Update.PeriodicUpdateManager.Resolve(Settings.Instance.Kit);

                if (kitsToUpdateDueToDependencies.Count == 0)
                {
                    ShowUpdatePage(() => { return config; }, UpdateFlow.Kit)();
                    return;
                }

                //TODO: implement dependency resolution
                Utils.Log("There is a dependency issue that needs resolution");
            });
        }
Esempio n. 2
0
        private Action <KitsObject, ImportedKit, bool> SelectKit()
        {
            return(delegate(KitsObject availableKit, ImportedKit importedKit, bool checkForConflicts) {
                if (Update.PeriodicUpdateManager.IsPluginUpdateRequired(availableKit.Name))
                {
                    EditorUtility.DisplayDialog(
                        "A plugin update is required",
                        availableKit.Name + " requires a newer version of the Fabric Plugin, please update by clicking 'View Update'.",
                        "OK"
                        );
                    return;
                }

                Settings.Instance.Kit = availableKit.Name;

                if (importedKit != null && KitUtils.IsUpToDate(availableKit, importedKit))
                {
                    // Delegate to the kit's controller.
                    this.kit = importedKit;
                    Settings.Instance.FlowSequence = 0;
                    return;
                }

                // We need to download the latest version of the kit, because it's either not imported or needs updating.

                this.kit = null;
                Settings.Instance.FlowSequence = (int)UpdateFlow.Kit;

                FabricInstaller.Config config = new FabricInstaller.Config(
                    availableKit.PackageUrl,
                    availableKit.PackageName,
                    availableKit.ReleaseNotesUrl
                    );

                if (!checkForConflicts || !HasConflictingDependencies(Settings.Instance.Kit))
                {
                    ShowUpdatePage(() => { return config; }, UpdateFlow.Kit)();
                    return;
                }

                Settings.Instance.Conflict = Settings.Instance.Kit;
                ShowConflictPage();
            });
        }