public void Register(EditorAsset asset) { if (!mEditorAssets.Contains(asset)) { mEditorAssets.Add(asset); } if (mDict_EditorAssets_KeyName.ContainsKey(asset.AssetPathLower)) { mDict_EditorAssets_KeyName[asset.AssetPathLower] = asset; } else { mDict_EditorAssets_KeyName.Add(asset.AssetPathLower, asset); } if (mDict_EditorAssets_KeyHashCode.ContainsKey(asset.AssetHashCode)) { mDict_EditorAssets_KeyHashCode[asset.AssetHashCode] = asset; } else { mDict_EditorAssets_KeyHashCode.Add(asset.AssetHashCode, asset); } }
public bool TryGetEditorAsset(int hashCode, out EditorAsset asset) { if (mDict_EditorAssets_KeyHashCode.TryGetValue(hashCode, out asset)) { if (asset.LoadState == AssetLoadState.Unloaded) { mEditorAssets.Remove(asset); mDict_EditorAssets_KeyHashCode.Remove(asset.AssetHashCode); mDict_EditorAssets_KeyName.Remove(asset.AssetPathLower); asset = null; return(false); } else { return(true); } } else { return(false); } }