Example #1
0
 public void NotifyGalleryImageClicked(ImageDisplayComponent display)
 {
     if (this.galleryImageClicked != null)
     {
         this.galleryImageClicked(display);
     }
 }
Example #2
0
 // ---------[ EVENT HANDLING ]---------
 public void NotifyLogoClicked(ImageDisplayComponent display)
 {
     if (this.logoClicked != null)
     {
         this.logoClicked(display);
     }
 }
Example #3
0
 public void NotifyYouTubeThumbnailClicked(ImageDisplayComponent display)
 {
     if (this.youTubeThumbnailClicked != null)
     {
         this.youTubeThumbnailClicked(display);
     }
 }
Example #4
0
        // ---------[ DATA PRESENTATION ]---------
        private void PresentLogoData()
        {
            if (m_logoData.mediaType == ImageDisplayData.MediaType.None)
            {
                if (m_logoDisplay != null)
                {
                    #if UNITY_EDITOR
                    if (!Application.isPlaying)
                    {
                        GameObject.DestroyImmediate(m_logoDisplay.gameObject);
                    }
                    else
                    #endif
                    {
                        GameObject.Destroy(m_logoDisplay.gameObject);
                    }
                }
            }
            else if (logoPrefab != null)
            {
                if (logoDisplay == null)
                {
                    m_logoDisplay = InstantiatePrefab(logoPrefab);
                    m_logoDisplay.transform.SetSiblingIndex(0);
                    m_logoDisplay.onClick += NotifyLogoClicked;
                }

                m_logoDisplay.data = m_logoData;
            }

            if (Application.isPlaying && this.isActiveAndEnabled)
            {
                LayoutRebuilder.MarkLayoutForRebuild(container);
            }
        }
Example #5
0
        private void MediaPreview_GalleryImage(ImageDisplayComponent display)
        {
            ImageDisplayData imageData = display.data;

            selectedMediaPreview.data = imageData;

            if (imageData.GetImageTexture(selectedMediaPreview.useOriginal) == null)
            {
                bool original            = selectedMediaPreview.useOriginal;
                ModGalleryImageSize size = (original ? ModGalleryImageSize.Original : ImageDisplayData.galleryThumbnailSize);

                ModManager.GetModGalleryImage(profile, display.data.fileName,
                                              size,
                                              (t) =>
                {
                    if (Application.isPlaying &&
                        selectedMediaPreview.data.Equals(imageData))
                    {
                        imageData.SetImageTexture(original, t);
                        selectedMediaPreview.data = imageData;
                    }
                },
                                              WebRequestError.LogAsWarning);
            }
        }
Example #6
0
        public override void DisplayMedia(int modId,
                                          LogoImageLocator logoLocator,
                                          IEnumerable <GalleryImageLocator> galleryImageLocators,
                                          IEnumerable <string> youTubeURLs)
        {
            ClearDisplays();

            if (logoLocator != null &&
                logoPrefab != null)
            {
                var display = InstantiatePrefab(logoPrefab);
                display.DisplayLogo(modId, logoLocator);
                display.onClick += NotifyLogoClicked;

                this.m_logoDisplay = display;
            }

            if (youTubeURLs != null &&
                youTubeThumbnailPrefab != null)
            {
                foreach (string url in youTubeURLs)
                {
                    var display = InstantiatePrefab(youTubeThumbnailPrefab);
                    display.DisplayYouTubeThumbnail(modId, Utility.ExtractYouTubeIdFromURL(url));
                    display.onClick += NotifyYouTubeThumbnailClicked;

                    m_youTubeDisplays.Add(display);
                }
            }

            if (galleryImageLocators != null &&
                galleryImagePrefab != null)
            {
                foreach (GalleryImageLocator locator in galleryImageLocators)
                {
                    var display = InstantiatePrefab(galleryImagePrefab);
                    display.DisplayGalleryImage(modId, locator);
                    display.onClick += NotifyGalleryImageClicked;

                    m_galleryDisplays.Add(display);
                }
            }

            if (Application.isPlaying && this.isActiveAndEnabled)
            {
                LayoutRebuilder.MarkLayoutForRebuild(container);
            }
        }
Example #7
0
        private void ClearDisplays()
        {
            #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                foreach (ImageDisplayComponent display in allDisplays)
                {
                    GameObject.DestroyImmediate(display.gameObject);
                }
            }
            else
            #endif
            {
                foreach (ImageDisplayComponent display in allDisplays)
                {
                    GameObject.Destroy(display.gameObject);
                }
            }

            this.m_logoDisplay = null;
            this.m_youTubeDisplays.Clear();
            this.m_galleryDisplays.Clear();
        }
Example #8
0
        private void MediaPreview_YouTubeThumbnail(ImageDisplayComponent display)
        {
            ImageDisplayData displayData = display.data;

            selectedMediaPreview.data = displayData;
        }