コード例 #1
0
        public static void SetData(BinaryWriter _bw, Dictionary <string, AssetManagerData> _dataDic)
        {
            _bw.Write(_dataDic.Count);

            IEnumerator <KeyValuePair <string, AssetManagerData> > enumerator = _dataDic.GetEnumerator();

            while (enumerator.MoveNext())
            {
                _bw.Write(enumerator.Current.Key);

                AssetManagerData data = enumerator.Current.Value;

                _bw.Write(data.assetBundle);

                if (data.assetBundleDep != null)
                {
                    _bw.Write(data.assetBundleDep.Length);

                    for (int i = 0; i < data.assetBundleDep.Length; i++)
                    {
                        _bw.Write(data.assetBundleDep[i]);
                    }
                }
                else
                {
                    _bw.Write(0);
                }
            }
        }
コード例 #2
0
        public static Dictionary <string, AssetManagerData> GetData(byte[] _bytes)
        {
            Dictionary <string, AssetManagerData> dic = new Dictionary <string, AssetManagerData>();

            MemoryStream ms = new MemoryStream(_bytes);

            BinaryReader br = new BinaryReader(ms);

            int assetLength = br.ReadInt32();

            for (int i = 0; i < assetLength; i++)
            {
                string assetName = br.ReadString();

                AssetManagerData unit = new AssetManagerData();

                unit.assetBundle = br.ReadString();

                int length = br.ReadInt32();

                if (length > 0)
                {
                    unit.assetBundleDep = new string[length];

                    for (int m = 0; m < length; m++)
                    {
                        unit.assetBundleDep[m] = br.ReadString();
                    }
                }

                dic.Add(assetName, unit);
            }

            br.Close();

            ms.Close();

            ms.Dispose();

            return(dic);
        }
コード例 #3
0
        public AssetManagerUnit2(string _name)
        {
            name = _name;

            data = AssetManager.Instance.GetData(name);
        }