コード例 #1
0
        private AssetManagerInfo _Read(StringStreamReader reader)
        {
            Version = reader.ReadString();

            Date = DateTime.Parse(reader.ReadString());

            var count = reader.ReadNumber();

            for (var i = 0; i < count; ++i)
            {
                var key   = reader.ReadIndexString("/");
                var value = new AssetPackInfo()._Read(reader);
                Packs.Add(key, value);
            }

            count = reader.ReadNumber();
            for (var i = 0; i < count; ++i)
            {
                var key   = reader.ReadIndexString("/");
                var value = new AssetInfo()._Read(reader);
                Assets.Add(key, value);
            }

            return(this);
        }
コード例 #2
0
ファイル: AssetManager.cs プロジェクト: Hengle/Unity3D-1
        private AssetPack _GetAssetPack(string path, bool checkDependency, AssetType assetType)
        {
            AssetPack pack = null;

            lock (this.packs) {
                var loadType = this.info._LoadType;
                var packInfo = _FindAssetPackInfo(path);
                if (null == packInfo)
                {
                    var assetInfo = _FindAssetInfo(path);
                    if (null != assetInfo)
                    {
                        path     = assetInfo.PackPath; // Override path with pack path
                        packInfo = _FindAssetPackInfo(path);
                        if (null == packInfo)
                        {
                            Logger <IAssetManager> .E("!IMPOSSIBLE!");
                        }
                    }
                    else
                    {
                        packInfo = new AssetPackInfo {
                            Type = AssetPackType.FLAT,
                        };
                        if (File.Exists(PathUtility.ComposeDataPath(path)))     // Check if it exists but not managed by AssetManager
                        {
                            loadType = AssetPackLoadType.PERSISTENTDATAPATH;
                        }
                        else if (AssetType.SCENE == assetType)                  // Unity scene type
                        {
                            loadType = AssetPackLoadType.INTERNALSCENE;
                        }
                        else
                        {
                            loadType = AssetPackLoadType.RESOURCES;
                            if (AssetType.SPRITEATLAS == assetType)             // Resources sprite atlas
                            {
                                packInfo.Type = AssetPackType.BUNDLE;
                            }
                        }
                        this.info.Packs.Add(path, packInfo);
                    }
                }

                if (!this.packs.TryGetValue(path, out pack))
                {
                    pack = new AssetPack(this, path, packInfo.Type, (path.StartsWith("http") ? AssetPackLoadType.REMOTE : loadType), checkDependency);
                    _RetainAssetPack(pack);
                }
            }

            return(pack);
        }