Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        public override void DisplayLoading()
        {
            ClearDisplays();

            if (Application.isPlaying && this.isActiveAndEnabled)
            {
                LayoutRebuilder.MarkLayoutForRebuild(container);
            }
        }
 private void LateLayoutUpdate()
 {
     if (this.isActiveAndEnabled)
     {
         StartCoroutine(EndOfFrameUpdateCoroutine());
     }
     else
     {
         LayoutRebuilder.MarkLayoutForRebuild(container);
     }
 }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
        private void PresentYouTubeData()
        {
            #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                foreach (ImageDisplayComponent display in m_youTubeDisplays)
                {
                    GameObject.DestroyImmediate(display.gameObject);
                }
            }
            else
            #endif
            {
                foreach (ImageDisplayComponent display in m_youTubeDisplays)
                {
                    GameObject.Destroy(display.gameObject);
                }
            }
            m_youTubeDisplays.Clear();

            int siblingIndex = 0;
            if (logoDisplay != null)
            {
                ++siblingIndex;
            }

            if (youTubeThumbnailPrefab != null)
            {
                foreach (var imageData in m_youTubeData)
                {
                    var display = InstantiatePrefab(youTubeThumbnailPrefab);
                    display.data = imageData;
                    display.transform.SetSiblingIndex(siblingIndex);
                    display.onClick += NotifyYouTubeThumbnailClicked;

                    this.m_youTubeDisplays.Add(display);

                    ++siblingIndex;
                }
            }

            if (Application.isPlaying && this.isActiveAndEnabled)
            {
                LayoutRebuilder.MarkLayoutForRebuild(container);
            }
        }
Ejemplo n.º 6
0
        private void PresentGalleryData()
        {
            #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                foreach (ImageDisplayComponent display in m_galleryDisplays)
                {
                    GameObject.DestroyImmediate(display.gameObject);
                }
            }
            else
            #endif
            {
                foreach (ImageDisplayComponent display in m_galleryDisplays)
                {
                    GameObject.Destroy(display.gameObject);
                }
            }
            m_galleryDisplays.Clear();

            if (galleryImagePrefab != null)
            {
                foreach (var imageData in m_galleryData)
                {
                    var display = InstantiatePrefab(galleryImagePrefab);
                    display.data     = imageData;
                    display.onClick += NotifyGalleryImageClicked;

                    this.m_galleryDisplays.Add(display);
                }
            }

            if (Application.isPlaying && this.isActiveAndEnabled)
            {
                LayoutRebuilder.MarkLayoutForRebuild(container);
            }
        }
        private System.Collections.IEnumerator EndOfFrameUpdateCoroutine()
        {
            yield return(null);

            LayoutRebuilder.MarkLayoutForRebuild(container);
        }
Ejemplo n.º 8
0
 public void OnEnable()
 {
     LayoutRebuilder.MarkLayoutForRebuild(container);
 }