Ejemplo n.º 1
0
        public override AssetBundleDatabase Decode(Stream stream)
        {
            AssetBundleDatabase result;

            using (BinaryReader binaryReader = new BinaryReader(stream, Encoding.UTF8))
            {
                UInt16            num   = binaryReader.ReadUInt16();
                Int32             num2  = 0;
                AssetBundleData[] array = new AssetBundleData[num];
                for (Int32 i = 0; i < array.Length; i++)
                {
                    array[i] = new AssetBundleData
                    {
                        Name     = binaryReader.ReadString(),
                        Path     = binaryReader.ReadString(),
                        Version  = binaryReader.ReadInt32(),
                        Size     = binaryReader.ReadInt32(),
                        CrcValue = binaryReader.ReadUInt32()
                    };
                }
                for (Int32 j = 0; j < array.Length; j++)
                {
                    num = binaryReader.ReadUInt16();
                    AssetBundleData[] array2 = new AssetBundleData[num];
                    for (Int32 k = 0; k < array2.Length; k++)
                    {
                        UInt16 num3 = binaryReader.ReadUInt16();
                        array2[k] = array[num3];
                    }
                    array[j].BundleDependency = array2;
                    num = binaryReader.ReadUInt16();
                    String[] array3 = new String[num];
                    for (Int32 l = 0; l < array3.Length; l++)
                    {
                        num2++;
                        String text = binaryReader.ReadString();
                        array3[l] = text;
                    }
                    array[j].Assets = array3;
                }
                result = new AssetBundleDatabase(array, num2);
            }
            return(result);
        }
Ejemplo n.º 2
0
    void Start()
    {
        var database = new AssetBundleDatabase();

        var downloadRoot = "file:///" + Application.streamingAssetsPath + "/";

#if !USE_HANDLE_HOLDER
        _handles = new Kayac.LoadHandle[HandleCount];
#endif

        _loader = new Kayac.Loader(downloadRoot, database);
        // ログファイルへ
        _log   = new Kayac.FileLogHandler("log.txt");
        _texts = new UnityEngine.UI.Text[HandleCount];
        for (int i = 0; i < HandleCount; i++)
        {
            _texts[i] = Instantiate(_textPrefab, _textRoot, false);
        }
    }