Esempio n. 1
0
        //ロード処理(暗号化済みファイルから)
        void LoadWWWCriptFile(WWW www)
        {
            byte[] readBytes = www.bytes;
            switch (FileType)
            {
            case AssetFileType.Text:                                    //テキスト
                text = System.Text.Encoding.UTF8.GetString(fileIO.Decode(readBytes));
                break;

            case AssetFileType.Bytes:                                   //バイナリ
                bytes = fileIO.Decode(readBytes);
                break;

            case AssetFileType.Texture:                         //テクスチャ
                fileIO.DecodeNoCompress(readBytes);             //圧縮なしでデコード
                //サイズとTextureFormatはLoadImage後無視される。ミップマップの反映のみ
                texture = new Texture2D(1, 1, TextureFormat.ARGB32, FileInfo.IsTextureMipmap);
                if (texture.LoadImage(readBytes))
                {
                    texture.name     = FileInfo.FilePath;
                    texture.wrapMode = TextureWrapMode.Clamp;
                    //ReadWriteフラグの設定
                    if (RowData != null && RowData.ParseCellOptional("ReadWrite", false))
                    {
                        texture.Apply(false, false);
                    }
                    else
                    {
                        texture.Apply(false, true);
                    }
                }
                else
                {
                    Debug.LogError(" Filed load image " + FileInfo.FilePath);
                }

                break;

            case AssetFileType.Sound:                                   //サウンド
                fileIO.DecodeNoCompress(readBytes);                     //圧縮なしでデコード
                sound      = FileIOManagerBase.ReadAudioFromMem(this.FileName, readBytes);
                sound.name = FileInfo.FilePath;
                break;

            case AssetFileType.Csv:                                     //CSV
                csv = new StringGrid(this.FileName, FileInfo.IsTsv ? CsvType.Tsv : CsvType.Csv, System.Text.Encoding.UTF8.GetString(fileIO.Decode(readBytes)));
                break;

            case AssetFileType.UnityObject:
                Debug.LogError("AssetBundle not support load from utage cript cache file");
                break;

            default:
                break;
            }
        }
        //ロード処理(暗号化済みキャッシュファイルから)
        void LoadWWWCriptCacheFile(WWW www)
        {
#if !(UNITY_WEBPLAYER || UNITY_WEBGL)
            byte[] readBytes = www.bytes;
            switch (FileType)
            {
            case AssetFileType.Text:                                    //テキスト
                text = System.Text.Encoding.UTF8.GetString(fileIO.Decode(readBytes));
                break;

            case AssetFileType.Bytes:                                   //バイナリ
                bytes = fileIO.Decode(readBytes);
                break;

            case AssetFileType.Texture:                         //テクスチャ
                fileIO.DecodeNoCompress(readBytes);             //圧縮なしでデコード
                //サイズとTextureFormatはLoadImage後無視される。ミップマップの反映のみ
                texture = new Texture2D(1, 1, TextureFormat.ARGB32, FileInfo.IsTextureMipmap);
                texture.LoadImage(readBytes);
                texture.name     = FileInfo.FilePath;
                texture.wrapMode = TextureWrapMode.Clamp;
                texture.Apply(false, false);
                break;

            case AssetFileType.Sound:                                   //サウンド
                fileIO.DecodeNoCompress(readBytes);                     //圧縮なしでデコード
                sound      = FileIOManagerBase.ReadAudioFromMem(this.Key, readBytes);
                sound.name = FileInfo.FilePath;
                break;

            case AssetFileType.Csv:                                     //CSV
                csv = new StringGrid(this.LoadingPath, FileInfo.IsTsv ? CsvType.Tsv : CsvType.Csv, System.Text.Encoding.UTF8.GetString(fileIO.Decode(readBytes)));
                break;

            case AssetFileType.UnityObject:
                Debug.LogError("AssetBundle not support load from utage cript cache file");
                break;

            default:
                break;
            }
#endif
        }