Exemple #1
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);
            }
        }