public void NextImage() { SetMetadataToEmpty(true); m_imageSphereController.SetImageAtIndexToLoading(m_imageSphereIndex, false); if (m_appDirector.GetState() == AppDirector.AppState.kGallery) { m_gallery.NextImage(m_imageSphereIndex); } else { m_posts.NextPost(m_imageSphereIndex); } }
private IEnumerator LoadImageFromURLIntoImageSphereInternal(ImageSphereController imageSphereController, int sphereIndex, int postImageIndex, string url, string imageIdentifier, bool showLoading) { if (postImageIndex != Helper.kIgnoreImageIndex && !m_posts.IsValidRequest(postImageIndex)) { yield break; } yield return(m_appDirector.VerifyInternetConnection()); m_isLoading = true; if (showLoading) { m_loadingIcon.Display(); } if (Debug.isDebugBuild) { Debug.Log("------- VREEL: Downloading image and getting stream through GetImageStreamFromURL() with url: " + url); } yield return(m_threadJob.WaitFor()); bool debugOn = Debug.isDebugBuild; Stream imageStream = null; int contentLength = 0; m_threadJob.Start(() => contentLength = GetImageStreamFromURL(url, ref imageStream, debugOn) ); yield return(m_threadJob.WaitFor()); if (contentLength > 0) { int textureIndex = GetAvailableTextureIndex(); yield return(m_cppPlugin.LoadImageFromStreamIntoImageSphere(imageSphereController, sphereIndex, imageStream, imageIdentifier, textureIndex, contentLength)); imageStream.Close(); } else { imageSphereController.SetImageAtIndexToLoading(sphereIndex, true); } m_isLoading = false; if (showLoading) { m_loadingIcon.Hide(); } }