Ejemplo n.º 1
0
        public void LoadPackageFromFile(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            object data = SerializeHelper.DeserializeBinary(FileMgr.Instance.OpenReadStream(path));

            if (data == null)
            {
                Log.e("Failed Deserialize AssetDataTable:" + path);
                return;
            }

            AssetDataPackage.SerializeData sd = data as AssetDataPackage.SerializeData;

            if (sd == null)
            {
                Log.e("Failed Load AssetDataTable:" + path);
                return;
            }

            //string parentFolder = PathHelper.GetFolderPath(path);

            AssetDataPackage package = BuildAssetDataPackage(sd, path);

            string key = package.key;

            for (int i = m_AllAssetDataPackages.Count - 1; i >= 0; --i)
            {
                if (m_AllAssetDataPackages[i].key.Equals(key))
                {
                    var oldConfig = m_AllAssetDataPackages[i];
                    if (oldConfig.buildTime > package.buildTime)
                    {
                        return;
                    }
                    else
                    {
                        m_AllAssetDataPackages.RemoveAt(i);
                        break;
                    }
                }
            }

            m_AllAssetDataPackages.Add(package);
        }
Ejemplo n.º 2
0
 private AssetDataPackage BuildAssetDataPackage(AssetDataPackage.SerializeData data, string path)
 {
     return(new AssetDataPackage(data, path));
 }