コード例 #1
0
        /// <summary>
        /// Called internally to go from installing a package to installing a sample.
        /// </summary>
        /// <param name="contentToInstall">The Content Pack that contains a sample to install</param>
        static void InstallContentSample(ContentPack contentToInstall)
        {
            ConditionalLog($"InstallContentSample {contentToInstall.DisplayName}");

            // Content must be installed or installing to add a sample
            if (!(contentToInstall.InstallStatus.HasFlag(InstallationStatus.Installed) || contentToInstall.InstallStatus.HasFlag(InstallationStatus.Installing)))
            {
                return;
            }

            StartEditorUpdates();
            contentToInstall.InstallStatus |= InstallationStatus.InstallQueued;

            // We stick the sample event at the beginning of the list because it happens automatically after an install
            QueuedEvents.Insert(0, new ContentEvent {
                action = PackageAction.SampleInstall, targetPack = contentToInstall
            });
            OnContentChanged?.Invoke();
        }
コード例 #2
0
        /// <summary>
        /// Called internally to go from installing a package to making it writeable.
        /// </summary>
        /// <param name="contentToEmbed">The Content Pack to make a writeable package</param>
        static void EmbedContent(ContentPack contentToEmbed)
        {
            ConditionalLog($"EmbedContent {contentToEmbed.DisplayName}");

            // Content must be installed or installing to embed
            if (!(contentToEmbed.InstallStatus.HasFlag(InstallationStatus.Installed) || contentToEmbed.InstallStatus.HasFlag(InstallationStatus.Installing)))
            {
                return;
            }

            StartEditorUpdates();
            contentToEmbed.InstallStatus |= InstallationStatus.InstallQueued;

            // We stick the embed event at the beginning of the list because it happens automatically after an install
            QueuedEvents.Insert(0, new ContentEvent {
                action = PackageAction.Embed, targetPack = contentToEmbed
            });
            OnContentChanged?.Invoke();
        }