public void DisplayLogo(int modId, LogoImageLocator locator) { Debug.Assert(locator != null); ImageDisplayData displayData = ImageDisplayData.CreateForModLogo(modId, locator); m_data = displayData; PresentData(); }
private void CollectDelegates() { m_getDelegates = new List <GetDataDelegate>(); m_setDelegates = new List <SetDataDelegate>(); m_displayDelegates = new List <DisplayProfileDelegate>(); m_missingDisplayParsers = new List <ProfileParserDelegate>(); m_loadingDelegates = new List <DisplayLoadingDelegate>(); // - profile - if (profileDisplay != null) { profileDisplay.Initialize(); m_getDelegates.Add((ref ModDisplayData d) => { d.profile = profileDisplay.data; }); m_setDelegates.Add((d) => { profileDisplay.data = d.profile; }); m_displayDelegates.Add((p) => profileDisplay.DisplayProfile(p)); m_loadingDelegates.Add(() => profileDisplay.DisplayLoading()); } else { m_missingDisplayParsers.Add((ModProfile p, ref ModDisplayData d) => { d.profile = ModProfileDisplayData.CreateFromProfile(p); }); } // - media - if (mediaContainer != null) { mediaContainer.Initialize(); m_getDelegates.Add((ref ModDisplayData d) => { d.logo = mediaContainer.logoData; d.youTubeThumbnails = mediaContainer.youTubeData.ToArray(); d.galleryImages = mediaContainer.galleryData.ToArray(); }); m_setDelegates.Add((d) => { mediaContainer.logoData = d.logo; mediaContainer.youTubeData = d.youTubeThumbnails; mediaContainer.galleryData = d.galleryImages; }); m_displayDelegates.Add((p) => mediaContainer.DisplayMedia(p)); m_loadingDelegates.Add(() => mediaContainer.DisplayLoading()); } else { m_missingDisplayParsers.Add(ParseProfileMedia); } // - logo - // NOTE(@jackson): Logo Data overrides Media Container Logo Data if (logoDisplay != null) { logoDisplay.Initialize(); m_getDelegates.Add((ref ModDisplayData d) => { d.logo = logoDisplay.data; }); m_setDelegates.Add((d) => { logoDisplay.data = d.logo; }); m_displayDelegates.Add((p) => logoDisplay.DisplayLogo(p.id, p.logoLocator)); m_loadingDelegates.Add(() => logoDisplay.DisplayLoading()); } else { m_missingDisplayParsers.Add((ModProfile p, ref ModDisplayData d) => { ImageDisplayData logoData; if (p.logoLocator != null) { logoData = ImageDisplayData.CreateForModLogo(p.id, p.logoLocator); } else { logoData = new ImageDisplayData(); } d.logo = logoData; }); } // - submittor - if (submittorDisplay.profile != null) { submittorDisplay.profile.Initialize(); m_getDelegates.Add((ref ModDisplayData d) => { d.submittorProfile = submittorDisplay.profile.data; }); m_setDelegates.Add((d) => { submittorDisplay.profile.data = d.submittorProfile; }); m_displayDelegates.Add((p) => submittorDisplay.profile.DisplayProfile(p.submittedBy)); m_loadingDelegates.Add(() => submittorDisplay.profile.DisplayLoading()); } else { m_missingDisplayParsers.Add((ModProfile p, ref ModDisplayData d) => { d.submittorProfile = UserProfileDisplayData.CreateFromProfile(p.submittedBy); }); } if (submittorDisplay.avatar != null) { submittorDisplay.avatar.Initialize(); m_getDelegates.Add((ref ModDisplayData d) => { d.submittorAvatar = submittorDisplay.avatar.data; }); m_setDelegates.Add((d) => { submittorDisplay.avatar.data = d.submittorAvatar; }); m_displayDelegates.Add((p) => submittorDisplay.avatar.DisplayAvatar(p.submittedBy.id, p.submittedBy.avatarLocator)); m_loadingDelegates.Add(() => submittorDisplay.avatar.DisplayLoading()); } else { m_missingDisplayParsers.Add((ModProfile p, ref ModDisplayData d) => { ImageDisplayData avatarData; if (p.submittedBy != null && p.submittedBy.avatarLocator != null) { avatarData = ImageDisplayData.CreateForUserAvatar(p.submittedBy.id, p.submittedBy.avatarLocator); } else { avatarData = new ImageDisplayData(); } d.submittorAvatar = avatarData; }); } // - build - if (buildDisplay != null) { buildDisplay.Initialize(); m_getDelegates.Add((ref ModDisplayData d) => { d.currentBuild = buildDisplay.data; }); m_setDelegates.Add((d) => { buildDisplay.data = d.currentBuild; }); m_displayDelegates.Add((p) => buildDisplay.DisplayModfile(p.currentBuild)); m_loadingDelegates.Add(() => buildDisplay.DisplayLoading()); } else { m_missingDisplayParsers.Add((ModProfile p, ref ModDisplayData d) => { d.currentBuild = ModfileDisplayData.CreateFromModfile(p.currentBuild); }); } // - tags - // NOTE(@jackson): tags has no display/missing parse delegate as it requires categories if (tagsDisplay != null) { tagsDisplay.Initialize(); m_getDelegates.Add((ref ModDisplayData d) => { d.tags = tagsDisplay.data.ToArray(); }); m_setDelegates.Add((d) => { tagsDisplay.data = d.tags; }); m_loadingDelegates.Add(() => tagsDisplay.DisplayLoading()); } // - stats - if (statisticsDisplay != null) { statisticsDisplay.Initialize(); m_getDelegates.Add((ref ModDisplayData d) => { d.statistics = statisticsDisplay.data; }); m_setDelegates.Add((d) => { statisticsDisplay.data = d.statistics; }); m_loadingDelegates.Add(() => statisticsDisplay.DisplayLoading()); } // - download - if (downloadDisplay != null) { downloadDisplay.Initialize(); // m_getDelegates.Add((ref ModDisplayData d) => // { // d.submittedBy = creatorView.data; // }); // m_setDelegates.Add((d) => // { // creatorView.data = d.submittedBy; // }); } }