GetAlphaTexturesForAtlas() private method

private GetAlphaTexturesForAtlas ( string atlasName ) : UnityEngine.Texture2D[]
atlasName string
return UnityEngine.Texture2D[]
Example #1
0
        private void RefreshState()
        {
            string[] atlasNames = Packer.atlasNames;
            if (!atlasNames.SequenceEqual(this.m_AtlasNames))
            {
                if (atlasNames.Length == 0)
                {
                    this.Reset();
                    return;
                }
                this.OnAtlasNameListChanged();
            }
            if (this.m_AtlasNames.Length == 0)
            {
                base.SetNewTexture(null);
                return;
            }
            if (this.m_SelectedAtlas >= this.m_AtlasNames.Length)
            {
                this.m_SelectedAtlas = 0;
            }
            string atlasName = this.m_AtlasNames[this.m_SelectedAtlas];

            Texture2D[] texturesForAtlas = Packer.GetTexturesForAtlas(atlasName);
            if (this.m_SelectedPage >= texturesForAtlas.Length)
            {
                this.m_SelectedPage = 0;
            }
            base.SetNewTexture(texturesForAtlas[this.m_SelectedPage]);
            Texture2D[] alphaTexturesForAtlas = Packer.GetAlphaTexturesForAtlas(atlasName);
            Texture2D   alphaTextureOverride  = (this.m_SelectedPage >= alphaTexturesForAtlas.Length) ? null : alphaTexturesForAtlas[this.m_SelectedPage];

            base.SetAlphaTextureOverride(alphaTextureOverride);
        }
Example #2
0
 private void RefreshState()
 {
     string[] atlasNames = Packer.atlasNames;
     if (!((IEnumerable <string>)atlasNames).SequenceEqual <string>((IEnumerable <string>) this.m_AtlasNames))
     {
         if (atlasNames.Length == 0)
         {
             this.Reset();
             return;
         }
         this.OnAtlasNameListChanged();
     }
     if (this.m_AtlasNames.Length == 0)
     {
         this.SetNewTexture((Texture2D)null);
     }
     else
     {
         if (this.m_SelectedAtlas >= this.m_AtlasNames.Length)
         {
             this.m_SelectedAtlas = 0;
         }
         string      atlasName         = this.m_AtlasNames[this.m_SelectedAtlas];
         Texture2D[] texturesForAtlas1 = Packer.GetTexturesForAtlas(atlasName);
         if (this.m_SelectedPage >= texturesForAtlas1.Length)
         {
             this.m_SelectedPage = 0;
         }
         this.SetNewTexture(texturesForAtlas1[this.m_SelectedPage]);
         Texture2D[] texturesForAtlas2 = Packer.GetAlphaTexturesForAtlas(atlasName);
         this.SetAlphaTextureOverride(this.m_SelectedPage >= texturesForAtlas2.Length ? (Texture2D)null : texturesForAtlas2[this.m_SelectedPage]);
     }
 }
        private void RefreshState()
        {
            // Check if atlas name list changed
            string[] atlasNames = Packer.atlasNames;
            if (!atlasNames.SequenceEqual(m_AtlasNames))
            {
                if (atlasNames.Length == 0)
                {
                    Reset();
                    return;
                }
                else
                {
                    OnAtlasNameListChanged();
                }
            }

            if (m_AtlasNames.Length == 0)
            {
                SetNewTexture(null);
                return;
            }

            // Validate selections
            if (m_SelectedAtlas >= m_AtlasNames.Length)
            {
                m_SelectedAtlas = 0;
            }
            string curAtlasName = m_AtlasNames[m_SelectedAtlas];

            Texture2D[] textures = Packer.GetTexturesForAtlas(curAtlasName);
            if (m_SelectedPage >= textures.Length)
            {
                m_SelectedPage = 0;
            }

            SetNewTexture(textures[m_SelectedPage]);

            // check if the atlas has alpha as an external texture (as in ETC1 atlases with alpha)
            Texture2D[] alphaTextures        = Packer.GetAlphaTexturesForAtlas(curAtlasName);
            Texture2D   selectedAlphaTexture = (m_SelectedPage < alphaTextures.Length) ? alphaTextures[m_SelectedPage] : null;

            SetAlphaTextureOverride(selectedAlphaTexture);
        }