Exemple #1
0
        private void InitializeFoldouts()
        {
            var disableIfCompiling = new ButtonDisableCondition(() => m_Application.isCompiling,
                                                                L10n.Tr("You need to wait until the compilation is finished to perform this action."));
            var disableIfInstallOrUninstallInProgress = new ButtonDisableCondition(() => m_PackageDatabase.isInstallOrUninstallInProgress,
                                                                                   L10n.Tr("You need to wait until other install or uninstall operations are finished to perform this action."));
            var disableIfNoNetwork = new ButtonDisableCondition(() => !m_Application.isInternetReachable,
                                                                L10n.Tr("You need to restore your network connection to perform this action."));

            // Standalone foldouts
            m_UnlockFoldout = new UnlockFoldout(m_PageManager);
            m_UnlockFoldout.button.onAction += Refresh;

            m_NoActionFoldout = new NoActionsFoldout(m_PageManager);

            m_CheckUpdateFoldout = new CheckUpdateFoldout(m_PageManager, m_AssetStoreCache, m_AssetStoreCallQueue);

            m_StandaloneFoldouts = new MultiSelectFoldout[] { m_UnlockFoldout, m_NoActionFoldout, m_CheckUpdateFoldout };

            // Foldout groups
            m_InstallFoldoutGroup = new InstallFoldoutGroup(m_Application, m_PackageDatabase);
            m_InstallFoldoutGroup.mainButton.SetGlobalDisableConditions(disableIfCompiling, disableIfInstallOrUninstallInProgress);

            m_RemoveFoldoutGroup = new RemoveFoldoutGroup(m_Application, m_PackageManagerPrefs, m_PackageDatabase, m_PageManager);
            m_RemoveFoldoutGroup.mainButton.SetGlobalDisableConditions(disableIfCompiling, disableIfInstallOrUninstallInProgress);

            m_UpdateFoldoutGroup = new UpdateFoldoutGroup(m_Application, m_PackageDatabase, m_PageManager);
            m_UpdateFoldoutGroup.mainButton.SetGlobalDisableConditions(disableIfCompiling, disableIfInstallOrUninstallInProgress);

            m_DownloadFoldoutGroup = new DownloadFoldoutGroup(m_AssetStoreDownloadManager, m_AssetStoreCache, m_PackageDatabase);
            m_DownloadFoldoutGroup.mainButton.SetGlobalDisableConditions(disableIfCompiling, disableIfNoNetwork);
            m_DownloadFoldoutGroup.cancelButton.SetGlobalDisableConditions(disableIfCompiling);

            m_DownloadUpdateFoldoutGroup = new DownloadUpdateFoldoutGroup(m_AssetStoreDownloadManager, m_AssetStoreCache, m_PackageDatabase);
            m_DownloadUpdateFoldoutGroup.mainButton.SetGlobalDisableConditions(disableIfCompiling, disableIfNoNetwork);
            m_DownloadUpdateFoldoutGroup.cancelButton.SetGlobalDisableConditions(disableIfCompiling);

            m_UpmFoldoutGroups        = new MultiSelectFoldoutGroup[] { m_InstallFoldoutGroup, m_RemoveFoldoutGroup, m_UpdateFoldoutGroup };
            m_AssetStoreFoldoutGroups = new MultiSelectFoldoutGroup[] { m_DownloadFoldoutGroup, m_DownloadUpdateFoldoutGroup };

            // Add foldouts to the UI in the correct order. Note that the order here is not the same as the initialization order from above.
            foldoutsContainer.Add(m_UnlockFoldout);

            foldoutsContainer.Add(m_InstallFoldoutGroup.mainFoldout);
            foldoutsContainer.Add(m_InstallFoldoutGroup.inProgressFoldout);
            foldoutsContainer.Add(m_RemoveFoldoutGroup.mainFoldout);
            foldoutsContainer.Add(m_RemoveFoldoutGroup.inProgressFoldout);
            foldoutsContainer.Add(m_UpdateFoldoutGroup.mainFoldout);
            foldoutsContainer.Add(m_UpdateFoldoutGroup.inProgressFoldout);

            foldoutsContainer.Add(m_DownloadFoldoutGroup.mainFoldout);
            foldoutsContainer.Add(m_DownloadFoldoutGroup.inProgressFoldout);
            foldoutsContainer.Add(m_DownloadUpdateFoldoutGroup.mainFoldout);
            foldoutsContainer.Add(m_DownloadUpdateFoldoutGroup.inProgressFoldout);

            foldoutsContainer.Add(m_CheckUpdateFoldout);
            foldoutsContainer.Add(m_NoActionFoldout);
        }
Exemple #2
0
        public PackageDetailsVersionsTab(ResourceLoader resourceLoader,
                                         ApplicationProxy applicationProxyProxy,
                                         PackageManagerPrefs packageManagerPrefs,
                                         PackageDatabase packageDatabase,
                                         PageManager pageManager,
                                         PackageManagerProjectSettingsProxy settingsProxy,
                                         UpmCache upmCache,
                                         IOProxy ioProxy)
        {
            m_Id                  = k_Id;
            m_DisplayName         = L10n.Tr("Version History");
            m_ResourceLoader      = resourceLoader;
            m_ApplicationProxy    = applicationProxyProxy;
            m_PackageManagerPrefs = packageManagerPrefs;
            m_PackageDatabase     = packageDatabase;
            m_PageManager         = pageManager;
            m_SettingsProxy       = settingsProxy;
            m_UpmCache            = upmCache;
            m_IOProxy             = ioProxy;

            m_DisableIfCompiling = new ButtonDisableCondition(() => m_ApplicationProxy.isCompiling,
                                                              L10n.Tr("You need to wait until the compilation is finished to perform this action."));
            m_DisableIfInstallOrUninstallInProgress = new ButtonDisableCondition(() => m_PackageDatabase.isInstallOrUninstallInProgress,
                                                                                 L10n.Tr("You need to wait until other install or uninstall operations are finished to perform this action."));

            m_Container = new VisualElement {
                name = "versionsTab"
            };
            Add(m_Container);

            m_VersionHistoryList = new VisualElement {
                name = "versionsList"
            };
            m_Container.Add(m_VersionHistoryList);

            m_VersionsToolbar = new VisualElement {
                name = "versionsToolbar"
            };
            m_Container.Add(m_VersionsToolbar);

            m_VersionsShowOthersButton = new Button {
                name = "versionsShowAllButton", text = L10n.Tr("See other versions")
            };
            m_VersionsToolbar.Add(m_VersionsShowOthersButton);

            m_VersionsShowOthersButton.clickable.clicked += ShowOthersVersion;
        }
Exemple #3
0
        private void InitializeButtons()
        {
            m_DisableIfCompiling = new ButtonDisableCondition(() => m_Application.isCompiling,
                                                              L10n.Tr("You need to wait until the compilation is finished to perform this action."));
            m_DisableIfInstallOrUninstallInProgress = new ButtonDisableCondition(() => m_PackageDatabase.isInstallOrUninstallInProgress,
                                                                                 L10n.Tr("You need to wait until other install or uninstall operations are finished to perform this action."));
            m_DisableIfNoNetwork = new ButtonDisableCondition(() => !m_Application.isInternetReachable,
                                                              L10n.Tr("You need to restore your network connection to perform this action."));

            m_UnlockButton           = new PackageUnlockButton(m_PageManager);
            m_UnlockButton.onAction += RefreshBuiltInButtons;
            m_BuiltInActions.Add(m_UnlockButton.element);

            m_AddButton = new PackageAddButton(m_Application, m_PackageDatabase);
            m_AddButton.SetGlobalDisableConditions(m_DisableIfInstallOrUninstallInProgress, m_DisableIfCompiling);
            m_AddButton.onAction += RefreshBuiltInButtons;
            m_BuiltInActions.Add(m_AddButton.element);

            m_UpdateButton = new PackageUpdateButton(m_Application, m_PackageDatabase, m_PageManager);
            m_UpdateButton.SetGlobalDisableConditions(m_DisableIfInstallOrUninstallInProgress, m_DisableIfCompiling);
            m_UpdateButton.onAction += RefreshBuiltInButtons;
            m_BuiltInActions.Add(m_UpdateButton.element);

            m_GitUpdateButton = new PackageGitUpdateButton(m_PackageDatabase);
            m_GitUpdateButton.SetGlobalDisableConditions(m_DisableIfInstallOrUninstallInProgress, m_DisableIfCompiling);
            m_GitUpdateButton.onAction += RefreshBuiltInButtons;
            m_BuiltInActions.Add(m_GitUpdateButton.element);

            m_RemoveButton = new PackageRemoveButton(m_Application, m_PackageManagerPrefs, m_PackageDatabase, m_PageManager);
            m_RemoveButton.SetGlobalDisableConditions(m_DisableIfInstallOrUninstallInProgress, m_DisableIfCompiling);
            m_RemoveButton.onAction += RefreshBuiltInButtons;
            m_BuiltInActions.Add(m_RemoveButton.element);

            m_RemoveCustomButton = new PackageRemoveCustomButton(m_Application, m_PackageDatabase, m_PageManager);
            m_RemoveCustomButton.SetGlobalDisableConditions(m_DisableIfInstallOrUninstallInProgress, m_DisableIfCompiling);
            m_RemoveCustomButton.onAction += RefreshBuiltInButtons;
            m_BuiltInActions.Add(m_RemoveCustomButton.element);

            m_ResetButton = new PackageResetButton(m_Application, m_PackageDatabase, m_PageManager);
            m_ResetButton.SetGlobalDisableConditions(m_DisableIfInstallOrUninstallInProgress, m_DisableIfCompiling);
            m_ResetButton.onAction += RefreshBuiltInButtons;
            m_ResetButton.element.SetIcon("customizedIcon");
            m_BuiltInActions.Add(m_ResetButton.element);

            m_ImportButton = new PackageImportButton(m_AssetStoreDownloadManager, m_PackageDatabase);
            m_ImportButton.SetGlobalDisableConditions(m_DisableIfCompiling);
            m_ImportButton.onAction += RefreshBuiltInButtons;
            m_BuiltInActions.Add(m_ImportButton.element);

            m_RedownloadButton = new PackageRedownloadButton(m_AssetStoreDownloadManager, m_AssetStoreCache, m_PackageDatabase);
            m_RedownloadButton.SetGlobalDisableConditions(m_DisableIfCompiling);
            m_RedownloadButton.onAction += RefreshBuiltInButtons;
            m_BuiltInActions.Add(m_RedownloadButton.element);

            m_DownloadButton = new PackageDownloadButton(m_AssetStoreDownloadManager, m_AssetStoreCache, m_PackageDatabase);
            m_DownloadButton.SetGlobalDisableConditions(m_DisableIfNoNetwork, m_DisableIfCompiling);
            m_DownloadButton.onAction += Refresh;
            m_BuiltInActions.Add(m_DownloadButton.element);

            m_DownloadUpdateButton = new PackageDownloadUpdateButton(m_AssetStoreDownloadManager, m_AssetStoreCache, m_PackageDatabase);
            m_DownloadUpdateButton.SetGlobalDisableConditions(m_DisableIfNoNetwork, m_DisableIfCompiling);
            m_DownloadUpdateButton.onAction += Refresh;
            m_BuiltInActions.Add(m_DownloadUpdateButton.element);

            m_DowngradeButton = new PackageDowngradeButton(m_AssetStoreDownloadManager, m_AssetStoreCache, m_PackageDatabase);
            m_DowngradeButton.SetGlobalDisableConditions(m_DisableIfNoNetwork, m_DisableIfCompiling);
            m_DowngradeButton.onAction += Refresh;
            m_BuiltInActions.Add(m_DowngradeButton.element);

            m_SignInButton = new PackageSignInButton(m_UnityConnectProxy);
            m_SignInButton.SetGlobalDisableConditions(m_DisableIfNoNetwork);
            m_SignInButton.onAction += RefreshBuiltInButtons;
            m_BuiltInActions.Add(m_SignInButton.element);

            // Since pause, resume, cancel buttons are only used to control the download progress, we want to put them in the progress container instead
            m_CancelButton = new PackageCancelDownloadButton(m_AssetStoreDownloadManager, m_PackageDatabase);
            m_CancelButton.SetGlobalDisableConditions(m_DisableIfCompiling);
            m_CancelButton.onAction += Refresh;
            m_ProgressContainer.Add(m_CancelButton.element);

            m_PauseButton = new PackagePauseDownloadButton(m_AssetStoreDownloadManager, m_PackageDatabase);
            m_PauseButton.SetGlobalDisableConditions(m_DisableIfCompiling);
            m_PauseButton.onAction += RefreshProgressControlButtons;
            m_ProgressContainer.Add(m_PauseButton.element);

            m_ResumeButton = new PackageResumeDownloadButton(m_AssetStoreDownloadManager, m_PackageDatabase);
            m_ResumeButton.SetGlobalDisableConditions(m_DisableIfNoNetwork, m_DisableIfCompiling);
            m_ResumeButton.onAction += RefreshProgressControlButtons;
            m_ProgressContainer.Add(m_ResumeButton.element);
        }