/// <summary>Opens the web browser for the displaying YouTube Thumbnail.</summary> public virtual void OpenVideoInBrowser() { if (!string.IsNullOrEmpty(this.m_youTubeId)) { UIUtilities.OpenYouTubeVideoURL(this.m_youTubeId); } }
protected virtual void Start() { Debug.Assert(modView != null); var tagCategories = ModBrowser.instance.gameProfile.tagCategories; if (tagCategories != null) { this.m_tagCategories = tagCategories; } if (modView.statisticsDisplay != null) { modView.statisticsDisplay.Initialize(); } // add listeners modView.subscribeRequested += (v) => ModBrowser.instance.SubscribeToMod(v.data.profile.modId); modView.unsubscribeRequested += (v) => ModBrowser.instance.UnsubscribeFromMod(v.data.profile.modId); modView.enableModRequested += (v) => ModBrowser.instance.EnableMod(v.data.profile.modId); modView.disableModRequested += (v) => ModBrowser.instance.DisableMod(v.data.profile.modId); modView.ratePositiveRequested += (v) => ModBrowser.instance.AttemptRateMod(v.data.profile.modId, ModRatingValue.Positive); modView.rateNegativeRequested += (v) => ModBrowser.instance.AttemptRateMod(v.data.profile.modId, ModRatingValue.Negative); ModMediaContainer mediaContainer = modView.mediaContainer as ModMediaContainer; if (selectedMediaPreview != null) { selectedMediaPreview.Initialize(); selectedMediaPreview.onClick += (d) => { if (d.data.descriptor == ImageDescriptor.YouTubeThumbnail) { UIUtilities.OpenYouTubeVideoURL(d.data.youTubeId); } }; if (mediaContainer != null) { mediaContainer.logoClicked += MediaPreview_Logo; mediaContainer.galleryImageClicked += MediaPreview_GalleryImage; mediaContainer.youTubeThumbnailClicked += MediaPreview_YouTubeThumbnail; } } if ((versionHistoryContainer != null && versionHistoryItemPrefab == null) || (versionHistoryItemPrefab != null && versionHistoryContainer == null)) { Debug.LogWarning("[mod.io] In order to display a version history both the " + "versionHistoryItemPrefab and versionHistoryContainer variables must " + "be set for the InspectorView.", this); } Debug.Assert(!(versionHistoryItemPrefab != null && versionHistoryItemPrefab.GetComponent <ModfileDisplayComponent>() == null), "[mod.io] The versionHistoryItemPrefab requires a ModfileDisplayComponent on the root Game Object."); this.m_isInitialized = true; Refresh(); }
// ---------[ INITIALIZATION ]--------- public void Initialize() { // TODO(@jackson): Asserts ModMediaContainer mediaContainer = null; if (modView != null) { modView.Initialize(); if (modView.statisticsDisplay != null) { modView.statisticsDisplay.Initialize(); } mediaContainer = modView.mediaContainer as ModMediaContainer; } if (selectedMediaPreview != null) { selectedMediaPreview.Initialize(); selectedMediaPreview.onClick += (d) => { if (d.data.mediaType == ImageDisplayData.MediaType.YouTubeThumbnail) { UIUtilities.OpenYouTubeVideoURL(d.data.youTubeId); } }; if (mediaContainer != null) { mediaContainer.logoClicked += MediaPreview_Logo; mediaContainer.galleryImageClicked += MediaPreview_GalleryImage; mediaContainer.youTubeThumbnailClicked += MediaPreview_YouTubeThumbnail; } } if ((versionHistoryContainer != null && versionHistoryItemPrefab == null) || (versionHistoryItemPrefab != null && versionHistoryContainer == null)) { Debug.LogWarning("[mod.io] In order to display a version history both the " + "versionHistoryItemPrefab and versionHistoryContainer variables must " + "be set for the InspectorView.", this); } Debug.Assert(!(versionHistoryItemPrefab != null && versionHistoryItemPrefab.GetComponent <ModfileDisplayComponent>() == null), "[mod.io] The versionHistoryItemPrefab requires a ModfileDisplayComponent on the root Game Object."); }