A9Í2018.1.6f1ţ˙˙˙˙˙’3$řĚuń옲e+ Í=^7€˙˙˙˙€Ś€˛€ЀŚ€Ś€Ś€#Ś€+H€3˙˙˙˙€1€1€˙˙˙˙@ހ€ Q€j€ H€<˙˙˙˙ €1€1€˙˙˙˙ @ހ€ Q€j€Ő€I˙˙˙˙€1€1€˙˙˙˙Ŕހ€H€j€˙˙˙˙€1€1€˙˙˙˙@ހ€Q€j€™€PAssetMetaDataguiddata[0]data[1]data[2]data[3]pathNameoriginalNamelabelsassetStoreRef ˙˙ŢšőRkVc}­j˘9Ź­;Ę7€˙˙˙˙€Ś€˛€ Ő€ ހ#€.€,€†€Ä€ ހ#€.€,€H€Ť€˙˙˙˙€1€1€˙˙˙˙ @ހ€ Q€j€ ń€5˙˙˙˙ €1€1€˙˙˙˙ €ހ€€j€˙˙˙˙€G›€˙˙˙˙€H€]˙˙˙˙€1€1€˙˙˙˙@ހ€Q€j€H€b˙˙˙˙€1€1€˙˙˙˙@ހ€Q€j€H€k˙˙˙˙€1€1€˙˙˙˙@ހ€Q€j€y€ € ހ#€.€,€Ő€p˙˙˙˙ €1€1€˙˙˙˙!Ŕހ€"€j€˙˙˙˙#€H€›€˙˙˙˙$€1€1€˙˙˙˙%@ހ€&Q€j€'y€ € (ހ#)€.€,*€ €„+@ž€“ ,@ހ#-€.€,.€H€˜˙˙˙˙/€1€1€˙˙˙˙0@ހ€1Q€j€2H€Ł˙˙˙˙3€1€1€˙˙˙˙4@ހ€5Q€j€6H€ľ˙˙˙˙7€1€1€˙˙˙˙8@ހ€9Q€j€:MonoImporterPPtrm_FileIDm_PathIDm_ExternalObjectsSourceAssetIdentifiertypeassemblynamem_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariants˙˙˙8-l'€Łć„hŒÎA,Œ€7€˙˙˙˙€Ś€˛€Ő€ ހ€.€€†€Ä€ ހ€.€€H€Ť€˙˙˙˙€1€1€˙˙˙˙ @ހ€ Q€j€ H€ę€˙˙˙˙ €1€1€˙˙˙˙ @ހ€Q€j€ń€(˙˙˙˙€1€1€˙˙˙˙€ހ€€j€˙˙˙˙€H€›€˙˙˙˙€1€1€˙˙˙˙@ހ€Q€j€y€ € ހ€.€€y€< ހ€.€€ހCH€T˙˙˙˙€1€1€˙˙˙˙ @ހ€!Q€j€"H€`˙˙˙˙#€1€1€˙˙˙˙$@ހ€%Q€j€&H€l˙˙˙˙'€1€1€˙˙˙˙(@ހ€)Q€j€*L€{+PPtrm_FileIDm_PathIDm_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespacem_AssemblyNamem_IsEditorScript„ˆDŕyŻĐý(}ÂKŮ:@ĐĽíăýmÎü[Packages/com.unity.package-manager-ui/Editor/Sources/Services/Packages/PackageCollection.csPackageCollectionI(using System; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace UnityEditor.PackageManager.UI { internal class PackageCollection { private static readonly PackageCollection instance = new PackageCollection(); public static PackageCollection Instance { get { return instance; } } public event Action OnPackageAdded = delegate { }; public event Action> OnPackagesChanged = delegate { }; public event Action OnFilterChanged = delegate { }; [SerializeField] private List packageInfos; [SerializeField] private Dictionary Packages; private IEnumerable LastListOfflinePackages = null; private IEnumerable LastListPackages = null; private IEnumerable LastSearchPackages = null; private ISearchOperation searchOperation; private IListOperation listOperation; private IListOperation listOperationOffline; private PackageFilter filter; public PackageFilter Filter { get { return filter; } // For public usage, use SetFilter() instead private set { var changed = value != filter; filter = value; if (changed) OnFilterChanged(filter); } } private PackageCollection() { packageInfos = new List(); Packages = new Dictionary(); Filter = PackageFilter.Local; FetchAllCaches(); } // Return Packages from internal cache. public IEnumerable PackageInfos { get { return packageInfos; } } public bool SetFilter(PackageFilter filter, bool refresh = true) { if (filter == Filter) return false; Filter = filter; if (refresh) UpdatePackageCollection(); return true; } private void Reset() { LastListOfflinePackages = null; LastListPackages = null; LastSearchPackages = null; listOperation = null; listOperationOffline = null; searchOperation = null; ClearPackagesInternal(); FetchAllCaches(); } public void UpdatePackageCollection(bool reset = false) { if (reset) Reset(); switch (Filter) { case PackageFilter.All: SearchPackages(); break; case PackageFilter.None: case PackageFilter.Local: ListPackages(); break; default: Debug.LogError("Unknown package filter."); break; } } public bool HasFetchedPackageList() { return LastListPackages != null || LastListOfflinePackages != null; } private void FetchListOfflineCache() { if (listOperationOffline == null && LastListOfflinePackages == null) { listOperationOffline = OperationFactory.Instance.CreateListOperation(true); listOperationOffline.GetPackageListAsync(infos => { LastListOfflinePackages = infos; }, error => { ClearPackages(); }); } } private void FetchListCache() { if (listOperation == null && LastListPackages == null) { var operation = OperationFactory.Instance.CreateListOperation(); listOperation = operation; operation.GetPackageListAsync(infos => { LastListPackages = infos; }, error => { ClearPackages(); }); } } private void FetchSearchCache() { if (searchOperation == null && LastSearchPackages == null) { var operation = OperationFactory.Instance.CreateSearchOperation(); searchOperation = operation; operation.GetAllPackageAsync(infos => { LastSearchPackages = infos; }, error => { ClearPackages(); }); } } private void FetchAllCaches() { FetchListOfflineCache(); FetchListCache(); FetchSearchCache(); } private void ListPackagesOffline() { if (LastListPackages != null) SetListPackageInfos(LastListPackages); if (listOperationOffline == null) FetchListOfflineCache(); if (LastListOfflinePackages == null) { listOperationOffline.OnOperationFinalized -= OnListOperationOfflineFinalized; // Make sure we cancel previous listeners listOperationOffline.OnOperationFinalized += OnListOperationOfflineFinalized; } else { SetListPackageInfos(LastListOfflinePackages); } } private void OnListOperationOfflineFinalized() { SetListPackageInfos(LastListOfflinePackages); } private void ListPackagesOnline() { if (listOperation == null) FetchListCache(); if (LastListPackages == null) { listOperation.OnOperationFinalized -= OnListOperationFinalized; // Make sure we cancel previous listeners listOperation.OnOperationFinalized += OnListOperationFinalized; } else { SetListPackageInfos(LastListPackages); } } private void OnListOperationFinalized() { listOperation = null; SetListPackageInfos(LastListPackages); } private void CancelListOffline() { if (listOperationOffline != null) { listOperationOffline.Cancel(); listOperationOffline = null; } } private void ListPackages() { ListPackagesOffline(); ListPackagesOnline(); } private void SearchPackages() { if (searchOperation == null) FetchSearchCache(); if (LastSearchPackages == null) { searchOperation.OnOperationFinalized -= OnSearchOperationFinalized; // Make sure we cancel previous listeners searchOperation.OnOperationFinalized += OnSearchOperationFinalized; } else { SetSearchPackageInfos(LastSearchPackages); } } private void OnSearchOperationFinalized() { SetSearchPackageInfos(LastSearchPackages); } private void SetSearchPackageInfos(IEnumerable searchPackageInfos) { searchOperation = null; var copyPackageInfo = new List(packageInfos); copyPackageInfo.AddRange(searchPackageInfos.Where(pi => !Packages.ContainsKey(pi.Name) || Packages[pi.Name].Current == null || Packages[pi.Name].Current.Version != pi.Version)); LastSearchPackages = copyPackageInfo; // Don't update the current list if the filter changed since the operation started if (Filter == PackageFilter.All) { ClearPackageInfosInternal(); AddPackageInfos(LastSearchPackages); } } public void SetListPackageInfos(IEnumerable packageInfos) { // Don't update the current list if the filter changed since the operation started if (Filter == PackageFilter.Local) { CancelListOffline(); ClearPackageInfosInternal(); AddPackageInfos(packageInfos); } } private IEnumerable OrderedPackages() { return Packages.Values.OrderBy(pkg => pkg.Versions.LastOrDefault() == null ? pkg.Name : pkg.Versions.Last().DisplayName).AsEnumerable(); } public void AddPackageInfo(PackageInfo packageInfo) { AddPackageInfoInternal(packageInfo); OnPackagesChanged(OrderedPackages()); } public void AddPackageInfos(IEnumerable packageInfos) { if (packageInfos == null) packageInfos = Enumerable.Empty(); foreach (var packageInfo in packageInfos.OrderBy(p => p.DisplayName)) { AddPackageInfoInternal(packageInfo); } OnPackagesChanged(OrderedPackages()); } private void AddPackageInfoInternal(PackageInfo packageInfo) { packageInfos.Add(packageInfo); if (Packages.ContainsKey(packageInfo.Name)) return; var packageQuery = from pkg in packageInfos where pkg.Name == packageInfo.Name select pkg; var package = new Package(packageInfo.Name, packageQuery); Packages[packageInfo.Name] = package; OnPackageAdded(package); } public void ClearPackages() { listOperation = null; listOperationOffline = null; searchOperation = null; ClearPackagesInternal(); OnPackagesChanged(OrderedPackages()); } private void ClearPackageInfosInternal() { packageInfos.Clear(); } private void ClearPackagesInternal() { ClearPackageInfosInternal(); Packages.Clear(); } public Package GetPackageByName(string name) { Package package; Packages.TryGetValue(name, out package); return package; } } } PackageCollectionUnityEditor.PackageManager.UI!Unity.PackageManagerUI.Editor.dll