Example #1
0
        void RefreshDetails()
        {
            m_MenuButton.SetSketchDetails(m_SketchIndex, SketchSet.Type);

            m_SizeOk = true;
            if (m_SketchSet.Type == SketchSetType.Liked)
            {
                if (m_SketchSet.IsSketchIndexValid(m_SketchIndex))
                {
                    SceneFileInfo sfi = m_SketchSet.GetSketchSceneFileInfo(m_SketchIndex);
                    if (sfi.TriangleCount is int triCount)
                    {
                        m_SizeOk = triCount <
                                   QualityControls.m_Instance.AppQualityLevels.MaxPolySketchTriangles;
                    }
                }
            }
            if (m_Warning != null)
            {
                m_Warning.GetComponent <Renderer>().material = m_SizeOk ? m_WarningMaterial : m_ErrorMaterial;
            }
        }
Example #2
0
        protected override void RefreshPage()
        {
            m_SketchSet.RequestOnlyLoadedMetadata(GetIconLoadIndices());
            m_AllIconTexturesAssigned = false;
            m_AllSketchesAreAvailable = false;

            // Disable all.
            foreach (var i in m_IconsOnFirstPage)
            {
                i.SetActive(false);
            }
            foreach (var i in m_IconsOnNormalPage)
            {
                i.SetActive(false);
            }

            // Base Refresh updates the modal parts of the panel, and we always want those refreshed.
            base.RefreshPage();

            bool polyDown = VrAssetService.m_Instance.NoConnection &&
                            (m_CurrentSketchSet == SketchSetType.Curated ||
                             m_CurrentSketchSet == SketchSetType.Liked);

            m_NoPolyConnectionMessage.SetActive(polyDown);

            bool outOfDate = !polyDown && !VrAssetService.m_Instance.Available &&
                             (m_CurrentSketchSet == SketchSetType.Curated ||
                              m_CurrentSketchSet == SketchSetType.Liked);

            m_OutOfDateMessage.SetActive(outOfDate);

            if (outOfDate || polyDown)
            {
                m_NoSketchesMessage.SetActive(false);
                m_NoDriveSketchesMessage.SetActive(false);
                m_NotLoggedInMessage.SetActive(false);
                m_NoLikesMessage.SetActive(false);
                m_ContactingServerMessage.SetActive(false);
                m_NoShowcaseMessage.SetActive(false);
                return;
            }

            bool refreshIcons = m_SketchSet.NumSketches > 0;

            // Show no sketches if we don't have sketches.
            m_NoSketchesMessage.SetActive(
                (m_CurrentSketchSet == SketchSetType.User) && (m_SketchSet.NumSketches <= 0));
            m_NoDriveSketchesMessage.SetActive(
                (m_CurrentSketchSet == SketchSetType.Drive) && (m_SketchSet.NumSketches <= 0));

            // Show sign in popup if signed out for liked or drive sketchsets
            bool showNotLoggedIn = !App.GoogleIdentity.LoggedIn &&
                                   (m_CurrentSketchSet == SketchSetType.Liked ||
                                    m_CurrentSketchSet == SketchSetType.Drive);

            refreshIcons = refreshIcons && !showNotLoggedIn;
            m_NotLoggedInMessage.SetActive(showNotLoggedIn && m_CurrentSketchSet == SketchSetType.Liked);
            m_NotLoggedInDriveMessage.SetActive(showNotLoggedIn &&
                                                m_CurrentSketchSet == SketchSetType.Drive);

            // Show no likes text & gallery button if we don't have liked sketches.
            m_NoLikesMessage.SetActive(
                (m_CurrentSketchSet == SketchSetType.Liked) &&
                (m_SketchSet.NumSketches <= 0) &&
                !m_SketchSet.IsActivelyRefreshingSketches &&
                App.GoogleIdentity.LoggedIn);

            // Show Contacting Server if we're talking to Poly.
            m_ContactingServerMessage.SetActive(
                (m_CurrentSketchSet == SketchSetType.Curated ||
                 m_CurrentSketchSet == SketchSetType.Liked ||
                 m_CurrentSketchSet == SketchSetType.Drive) &&
                (m_SketchSet.NumSketches <= 0) &&
                (m_SketchSet.IsActivelyRefreshingSketches && App.GoogleIdentity.LoggedIn));

            // Show Showcase error if we're in Showcase and don't have sketches.
            m_NoShowcaseMessage.SetActive(
                (m_CurrentSketchSet == SketchSetType.Curated) &&
                (m_SketchSet.NumSketches <= 0) &&
                !m_SketchSet.IsActivelyRefreshingSketches);

            // Refresh all icons if necessary.
            if (!refreshIcons)
            {
                return;
            }

            for (int i = 0; i < Icons.Count; i++)
            {
                LoadSketchButton icon = Icons[i] as LoadSketchButton;
                // Default to loading image
                icon.SetButtonTexture(m_LoadingImageTexture);
                icon.ThumbnailLoaded = false;

                // Set sketch index relative to page based index
                int iSketchIndex = m_IndexOffset + i;
                if (iSketchIndex >= m_SketchSet.NumSketches)
                {
                    iSketchIndex = -1;
                }
                icon.SketchIndex = iSketchIndex;
                icon.ResetScale();

                // Init icon according to availability of sketch
                GameObject go = icon.gameObject;
                if (m_SketchSet.IsSketchIndexValid(iSketchIndex))
                {
                    string sSketchName = m_SketchSet.GetSketchName(iSketchIndex);
                    icon.SetDescriptionText(App.ShortenForDescriptionText(sSketchName));
                    SceneFileInfo info = m_SketchSet.GetSketchSceneFileInfo(iSketchIndex);
                    if (info.Available)
                    {
                        m_SketchSet.PrecacheSketchModels(iSketchIndex);
                    }

                    if (info.TriangleCount is int triCount)
                    {
                        icon.WarningVisible = triCount >
                                              QualityControls.m_Instance.AppQualityLevels.WarningPolySketchTriangles;
                    }
                    else
                    {
                        icon.WarningVisible = false;
                    }
                    go.SetActive(true);
                }
                else
                {
                    go.SetActive(false);
                }
            }
        }