public static void AddEntry(GameObject go, string asset, string[] tokens) { AssetBridge bridge = go.GetComponent <AssetBridge>(); if (bridge == null) { bridge = go.AddComponent <AssetBridge>(); } AssetEntry entry = new AssetEntry(); entry.asset = asset; entry.tokens = tokens; AssetBridge.AddEntry(bridge, entry); }
private void Load(XElement rootElement, long cdnTime) { this.assets = new List <Asset>(); if (rootElement != null) { IEnumerable <XElement> retrievedAssets = rootElement.Elements("asset"); this.RemainingAssets = retrievedAssets.Count(); if (this.RemainingAssets == 0) { this.InvokeResultsAvailable(); return; } foreach (XElement assetElement in retrievedAssets) { AssetBridge asset = AssetBridge.Parse(assetElement); IMetadataStrategy metadataStrategy = this.metadataStrategyFactory(); asset.Source = this.GetCdnUri(asset.Source, cdnTime); if (metadataStrategy.CanRetrieveMetadata(asset.Source)) { metadataStrategy.GetManifestCompleted += (s, e) => { Metadata metadata = e.Metadata; this.AddNewAsset(asset.AzureId, asset.Type, asset.Title, asset.ThumbnailSource, asset.Source, asset.Duration, asset.IsAdaptiveStreaming, asset.DataStreams, asset.FrameRate, asset.Width, asset.Height, asset.X, asset.Y, asset.Fields, asset.Template, asset.ArchiveUrl, asset.CMSId, asset.VodUrl, metadata); }; metadataStrategy.GetMetadata(asset.Source); } else { this.AddNewAsset(asset.AzureId, asset.Type, asset.Title, asset.ThumbnailSource, asset.Source, asset.Duration, asset.IsAdaptiveStreaming, asset.DataStreams, asset.FrameRate, asset.Width, asset.Height, asset.X, asset.Y, asset.Fields, asset.Template, asset.ArchiveUrl, asset.CMSId, asset.VodUrl, null); } } } else { this.InvokeResultsAvailable(); } }
public static string[] GetEntryTokens(GameObject go, string asset) { AssetBridge bridge = go.GetComponent <AssetBridge>(); if (bridge == null) { return(null); } for (int i = 0; i < bridge.entries.Length; i++) { AssetEntry entry = bridge.entries[i]; if (entry.asset == asset) { return(entry.tokens); } } return(null); }