public void GetFeatured(VideoDataManager.DataListQueryCompleteDelegate onQueryComplete) { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); FactionType faction = currentPlayer.Faction; string[] tags = (faction == FactionType.Empire) ? this.EmpireFeaturedTags : this.RebelFeaturedTags; string[] keywords = new string[0]; this.SearchSubCategories(VideoSection.FEATURED, tags, keywords, onQueryComplete); }
public QueryData(VideoSection section, string[] tags, string[] keywords, VideoDataManager.DataListQueryCompleteDelegate callback) { this.tags = tags; this.keywords = keywords; this.callbacks = new List <VideoDataManager.DataListQueryCompleteDelegate>(); this.callbacks.Add(callback); this.Active = true; this.allResults = new List <KeyValuePair <List <string>, bool> >(); this.Section = section; }
private void GetFeaturedAll(VideoDataManager.DataListQueryCompleteDelegate onQueryComplete) { if (this.IsFeedLoaded) { List <string> videoGuidList = this.Sections.ContainsKey("featured_videos_section") ? this.Sections["featured_videos_section"] : null; onQueryComplete(videoGuidList); return; } this.onFeaturedQueryComplete.Add(onQueryComplete); this.GetFeed(new VideoDataManager.DataListQueryCompleteDelegate(this.OnFeaturedFeedAllLoaded)); }
public void SearchSubCategory(string tag, VideoDataManager.DataListQueryCompleteDelegate onQueryComplete) { List <string> list; this.Tags.TryGetValue(tag, out list); if (list == null) { Service.Get <Engine>().StartCoroutine(this.Query(this.urlBuilder.Tag(tag), new VideoDataManager.QueryCompleteDelegate(this.ParseTag), onQueryComplete, tag)); return; } onQueryComplete(list); }
private void ParseTag(string json, object callback, object data) { VideoDataManager.DataListQueryCompleteDelegate dataListQueryCompleteDelegate = (VideoDataManager.DataListQueryCompleteDelegate)callback; string key = (string)data; List <string> list = null; if (!string.IsNullOrEmpty(json)) { list = VideoDataParser.ParseTag(json); this.Tags[key] = list; } dataListQueryCompleteDelegate(list); }
public void GetFeed(VideoDataManager.DataListQueryCompleteDelegate onQueryComplete) { if (this.IsFeedLoaded) { List <string> list = new List <string>(); foreach (VideoData current in this.VideoDatas.Values) { list.Add(current.Guid); } onQueryComplete((list.Count == 0) ? null : list); return; } Service.Get <Engine>().StartCoroutine(this.Query(this.urlBuilder.UserFeed(), new VideoDataManager.QueryCompleteDelegate(this.ParseFeed), onQueryComplete, null)); }
public void SearchSubCategories(VideoSection section, string[] tags, string[] keywords, VideoDataManager.DataListQueryCompleteDelegate onQueryComplete) { string environmentTag = this.GetEnvironmentTag(); if (!string.IsNullOrEmpty(environmentTag) && Array.IndexOf <string>(tags, environmentTag) < 0) { string[] array = new string[tags.Length + 1]; Array.Copy(tags, array, tags.Length); array[tags.Length] = environmentTag; tags = array; } if (tags.Length == 0 && keywords.Length == 0) { this.GetFeed(onQueryComplete); return; } if (this.activeQuery != null && !this.activeQuery.QueryMatch(section, tags, keywords)) { this.activeQuery.Active = false; } if (this.activeQuery != null && this.activeQuery.Active) { this.activeQuery.AddCallback(onQueryComplete); return; } this.activeQuery = new QueryData(section, tags, keywords, onQueryComplete); for (int i = 0; i < tags.Length; i++) { List <string> list; this.Tags.TryGetValue(tags[i], out list); if (list == null) { Service.Get <Engine>().StartCoroutine(this.Query(this.urlBuilder.Tag(tags[i]), new VideoDataManager.QueryCompleteDelegate(this.ParseTagWithQuery), this.activeQuery, tags[i])); } else { this.activeQuery.AddResult(new List <string>(list), false); this.activeQuery.FilterResults(); } } if (keywords.Length != 0) { string text = string.Join(" ", keywords); List <string> list2; this.Keywords.TryGetValue(text, out list2); if (list2 == null) { Service.Get <Engine>().StartCoroutine(this.Query(this.urlBuilder.Search(text, true, -1, -1), new VideoDataManager.QueryCompleteDelegate(this.ParseKeywords), this.activeQuery, text)); } else { this.activeQuery.AddResult(new List <string>(list2), false); this.activeQuery.FilterResults(); } } if (section == VideoSection.FEATURED) { this.GetFeaturedAll(new VideoDataManager.DataListQueryCompleteDelegate(this.OnCategoriesQueried)); return; } if (keywords.Length == 0) { this.GetFeed(new VideoDataManager.DataListQueryCompleteDelegate(this.OnCategoriesQueried)); } }
public void GetAllEnvironmentVideos(VideoDataManager.DataListQueryCompleteDelegate onQueryComplete) { string[] tags = new string[0]; string[] keywords = new string[0]; Service.Get <VideoDataManager>().SearchSubCategories(VideoSection.ALL, tags, keywords, onQueryComplete); }
public void AddCallback(VideoDataManager.DataListQueryCompleteDelegate cb) { this.callbacks.Add(cb); }