示例#1
0
        IEnumerator OpenCustomSolutionAsync()
        {
            yield return(UpdateCustomSolutionAsync());

            yield return(_prjCommandHandler.ProcessPrjCommand(
                             "Opening solution", PrjHelper.OpenCustomSolutionAsync()));
        }
        IEnumerator ShowCreateNewProjectPopupAsync()
        {
            while (!_windowInitializer.IsInitialized)
            {
                yield return(null);
            }

            var userInput = _view.PromptForInput("Enter new project name:", "Untitled");

            yield return(userInput);

            if (userInput.Current == null)
            {
                // User Cancelled
                yield break;
            }

            var projName = userInput.Current;

            yield return(_commandHandler.ProcessPrjCommand(
                             "Creating Project '{0}'".Fmt(projName), PrjHelper.CreateProjectAsync(projName)));

            yield return(_commandHandler.ProcessPrjCommand(
                             "Initializing directory links", PrjHelper.UpdateLinksAsyncForProject(projName)));

            yield return(_commandHandler.ProcessPrjCommand(
                             "Opening Unity", PrjHelper.OpenUnityForProjectAsync(projName)));

            EditorApplication.Exit(0);
        }
示例#3
0
        IEnumerator ApplyProjectChangeAsync()
        {
            _projectHandler.OverwriteConfig();

            yield return(_prjCommandHandler.ProcessPrjCommand(
                             "Updating directory links", PrjHelper.UpdateLinksAsync()));

            yield return(_prjCommandHandler.ProcessPrjCommand(
                             "Updating custom solution", PrjHelper.UpdateCustomSolutionAsync()));
        }
        IEnumerator CreateNewPackageAsync()
        {
            var userInput = _view.PromptForInput("Enter new package name:", "Untitled");

            yield return(userInput);

            if (userInput.Current == null)
            {
                // User Cancelled
                yield break;
            }

            yield return(_prjCommandHandler.ProcessPrjCommand(
                             "Creating Package '{0}'".Fmt(userInput.Current), PrjHelper.CreatePackageAsync(userInput.Current)));

            yield return(_packageHandler.RefreshPackagesAsync());
        }
示例#5
0
        public IEnumerator InstallReleasesAsync(List <ReleaseInfo> releaseInfos)
        {
            // Need to make sure we have the most recent package list so we can determine whether this is
            // an upgrade / downgrade / etc.
            yield return(_packageHandler.RefreshPackagesAsync());

            Assert.That(releaseInfos.Select(x => x.Id).GetDuplicates().IsEmpty(), "Found duplicate releases selected - are you installing multiple versions of the same release?");

            var packageRoot = _model.TryGetCurrentPackageFolderPath();

            Assert.IsNotNull(packageRoot, "Please select a package folder before attempting to install a release");

            foreach (var releaseInfo in releaseInfos)
            {
                var userChoice = CheckShouldInstall(releaseInfo);

                yield return(userChoice);

                switch (userChoice.Current)
                {
                case InstallReleaseUserChoices.Cancel:
                {
                    yield break;
                }

                case InstallReleaseUserChoices.Install:
                {
                    yield return(_prjCommandHandler.ProcessPrjCommand(
                                     "Installing release '{0}'".Fmt(releaseInfo.Name), PrjHelper.InstallReleaseAsync(packageRoot, releaseInfo)));

                    break;
                }

                case InstallReleaseUserChoices.Skip:
                {
                    // Do nothing
                    break;
                }

                default:
                {
                    Assert.Throw();
                    break;
                }
                }
            }

            yield return(_packageHandler.RefreshPackagesAsync());
        }
示例#6
0
        public IEnumerator DeletePackages(List <PackageInfo> packages)
        {
            var choice = _view.PromptForUserChoice(
                "<color=yellow>Are you sure you want to delete the following packages?</color>\n\n{0}\n\n<color=yellow>Please note the following:</color>\n\n- This change is not undoable\n- Any changes that you've made since installing will be lost\n- Any projects or other packages that still depend on this package may be put in an invalid state by deleting it".Fmt(packages.Select(x => "- " + x.Name).Join("\n")),
                new[] { "Delete", "Cancel" }, null, "DeleteSelectedPopupTextStyle", 0, 1);

            yield return(choice);

            if (choice.Current == 0)
            {
                yield return(_prjCommandHandler.ProcessPrjCommand(
                                 "Deleting packages", PrjHelper.DeletePackagesAsync(packages)));

                yield return(RefreshPackagesAsync());
            }
        }