示例#1
0
 public void UF_SetTexture(string textureName)
 {
     if (string.IsNullOrEmpty(textureName))
     {
         UF_SetRawTexture(null);
     }
     else
     {
         Texture2D t2d = TextureManager.UF_GetInstance().UF_LoadTexture(textureName);
         UF_SetRawTexture(t2d);
     }
 }
示例#2
0
 public int UF_SetWebTextureWithCallback(string url, DelegateBoolMethod callback)
 {
     //自动调整为不渲染颜色
     this.color = new Color(1, 1, 1, 0);
     if (string.IsNullOrEmpty(url))
     {
         UF_SetRawTexture(null);
         return(0);
     }
     m_OnWebTextureLoaded = callback;
     return(TextureManager.UF_GetInstance().UF_LoadTextureFromCacheOrDownload(url, UF_OnWebTextureLoaded));
 }
示例#3
0
        public void UF_SetTexture(string textureName)
        {
            Texture2D texture = TextureManager.UF_GetInstance().UF_LoadTexture(textureName);

            if (texture != null)
            {
                foreach (Material mat in m_ListMats.Keys)
                {
                    if (mat != null)
                    {
                        UF_SetMaterialTexture(mat, "_MainTex", texture);
                    }
                }
            }
        }
示例#4
0
        private bool UF_LoadTexture(string fName)
        {
            string path = fName;

            Texture2D tex = null;

            if (folderType == FolderType.Persistent)
            {
                path = GlobalPath.PersistentPath + "/" + path;
                tex  = TextureManager.UF_GetInstance().UF_LoadTextureLocal(path);
            }
            else if (folderType == FolderType.StreamingAssets)
            {
#if UNITY_ANDROID && !UNITY_EDITOR
                var bytes = GHelper.UF_LoadAndroidAssetFile(path);
                if (bytes != null && bytes.Length > 0)
                {
                    tex = TextureManager.UF_GetInstance().UF_LoadTextureBytes(bytes, System.IO.Path.GetFileNameWithoutExtension(path));
                }
#else
                path = GlobalPath.StreamingAssetsPath + "/" + path;
                tex  = TextureManager.UF_GetInstance().UF_LoadTextureLocal(path);
#endif
            }
            else if (folderType == FolderType.AssetsBundle)
            {
                tex = TextureManager.UF_GetInstance().UF_LoadTexture(fName);
            }

            if (tex != null)
            {
                target.texture = tex;
                if (enableOnAccessable)
                {
                    target.enabled = true;
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#5
0
        public void UF_SetLocalTexture(string textureFile)
        {
            Texture2D t2d = TextureManager.UF_GetInstance().UF_LoadTextureLocal(textureFile);

            UF_SetRawTexture(t2d);
        }