public void TakePhoto() { mainARCamera.cullingMask &= ~(1 << LayerMask.NameToLayer("TransparentFX")); int resWidth = Screen.width; int resHeight = Screen.height; Debug.Log("Take still image with res (" + resWidth + ", " + resHeight + ")"); RenderTexture rt = new RenderTexture(resWidth, resHeight, 24); mainARCamera.targetTexture = rt; Texture2D screenShot = new Texture2D(resWidth, resHeight, TextureFormat.RGB24, false); mainARCamera.Render(); RenderTexture.active = rt; screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0); mainARCamera.targetTexture = null; RenderTexture.active = null; Destroy(rt); //_preview.texture = screenShot; byte[] stillImageResult = screenShot.EncodeToPNG(); long date_long = System.DateTime.UtcNow.Ticks; string filename = "AR_Photo-" + date_long.ToString() + ".png"; NativeGallery.SaveImageToGallery(stillImageResult, "album", filename, null); mainARCamera.cullingMask |= 1 << LayerMask.NameToLayer("TransparentFX"); }
private IEnumerator saveScreenshot() { if (customerName.text != "" && customerPhone.text != "") { customerPopup.SetActive(false); yield return(new WaitForEndOfFrame()); // Save the screenshot to Gallery/Photos pada folder DCIM->DailyCuts dengan nama CustomerName+CustomerPhone dengan format PNG Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(ss, "DailyCuts", "" + customerName.text + "#" + customerPhone.text + ".png")); saving.SetActive(true); yield return(new WaitForSeconds(2)); saving.SetActive(false); captureResult.SetActive(false); warning.SetActive(false); for (int i = 0; i < allUI.Length; i++) { allUI[i].SetActive(true); } Destroy(ss); } else { warning.SetActive(true); } }
IEnumerator GetTexture() { UnityWebRequest www = UnityWebRequestTexture.GetTexture("https://i.imgur.com/nGLe10N.png"); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Texture2D myTexture = ((DownloadHandlerTexture)www.downloadHandler).texture; QR.texture = myTexture; byte[] bytes = myTexture.EncodeToJPG(); NativeGallery.SaveImageToGallery(bytes, "Plants", "300.jpg"); //var mediaScanIntent = //new Intent(Intent.ActionMediaScannerScanFile); //mediaScanIntent.SetData(_uri); //SendBroadcast(mediaScanIntent); } }
public IEnumerator CaptureScreen() { // Wait till the last possible moment before screen rendering to hide the UI yield return(null); GameObject.Find("Canvas").GetComponent <Canvas>().enabled = false; // Wait for screen rendering to complete yield return(new WaitForEndOfFrame()); // Take screenshot Texture2D screenshot = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); screenshot.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); screenshot.Apply(); // Save the screenshot to Gallery Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(screenshot, "PSV speler foto's", screenshotName)); // To avoid memory leaks Destroy(screenshot); // Show UI after we're done GameObject.Find("Canvas").GetComponent <Canvas>().enabled = true; }
IEnumerator loadSpriteImageFromUrl(string URL, double ID) { // create image save name and type string QRID = newID + ".jpg"; // get the QR from the URL UnityWebRequest www = UnityWebRequestTexture.GetTexture(URL); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Debug.LogError("Texture succesfuly loaded"); Texture2D myTexture = ((DownloadHandlerTexture)www.downloadHandler).texture; // get the QR to display QRImage.texture = myTexture; // Show the id and Date to user showNewQRDate.text = currentDate.ToString(); showNewQRID.text = newID.ToString(); // Download QR to Photo Lib. byte[] bytes = myTexture.EncodeToJPG(); NativeGallery.SaveImageToGallery(bytes, "Saved QR Codes", QRID); } }
private void SavePhoto(Texture2D img) { if (img != null) { NativeGallery.SaveImageToGallery(img, "GalleryTest", "My img {0}.png"); } }
public IEnumerator CaptureScreenForImage(Canvas ignoredCanvas, Canvas ignoredSecondCanvas, string defaultGallery, string defaultScreenshotFileName, Action <string, Texture2D, CaptureType> callback = null) { ignoredCanvas.enabled = false; ignoredSecondCanvas.enabled = false; yield return(new WaitForEndOfFrame()); Texture2D screenshotTexture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); screenshotTexture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); screenshotTexture.Apply(); // Save the screenshot to Gallery/Photos Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(screenshotTexture, defaultGallery, defaultScreenshotFileName, (error) => { if (callback == null) { return; } callback.Invoke(error, screenshotTexture, CaptureType.Image); })); ignoredCanvas.enabled = true; ignoredSecondCanvas.enabled = true; }
//public Texture2D LoadTexture(string FilePath) //{ // Texture2D Tex2D; // byte[] FileData; // if (System.IO.File.Exists(FilePath)) // { // FileData = System.IO.File.ReadAllBytes(FilePath); // Tex2D = new Texture2D(resWidth * 3, resHeight * 3); // Create new "empty" texture // if (Tex2D.LoadImage(FileData)) // Load the imagedata into the texture (size is set automatically) // return Tex2D; // If data = readable -> return texture // } // return null; // Return null if load failed //} private IEnumerator TakeScreenshotAndSave() { takeHiResShot = true; _cm.ChangeCanvasState(CanvasManager.canvasState.offAll); yield return(new WaitForEndOfFrame()); Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); ss.ReadPixels(new Rect(0, 0, Screen.width * 3, Screen.height * 3), 0, 0); ss.Apply(); _cm.ChangeCanvasState(CanvasManager.canvasState.onAll); animationWolf.DefauldAnimState(); // Save the screenshot to Gallery/Photos string name = string.Format("{0}_Capture{1}_{2}.png", Application.productName, "{0}", System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(ss, "AR" + " Captures", name)); string filePath = Path.Combine(Application.temporaryCachePath, "shared img.png"); File.WriteAllBytes(filePath, ss.EncodeToPNG()); nativeShare = new NativeShare().AddFile(filePath); _cm.ChangeCanvasState(CanvasManager.canvasState.afterFoto, LoadNewSprite(ss)); takeHiResShot = false; }
public IEnumerator CaptureScreen() { // Wait till the last possible moment before screen rendering to hide the UI yield return(null); GameObject.Find("Canvas").GetComponent <Canvas>().enabled = false; // Wait for screen rendering to complete yield return(new WaitForEndOfFrame()); ScreenCapture.CaptureScreenshot("screenshot.png"); Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); ss.Apply(); // NativeGallery.SaveImageToGallery(ss, "Screenshot", DateTime.Now.ToString().Replace("/", "-")); // NativeGallery.SaveImageToGallery(ss, "Screenshot", "screenshot"+ ScreenCounter+".png"); NativeGallery.SaveImageToGallery(ss, "Screenshot", "screenshot" + DateTime.Now.ToString().Replace("/", "-") + ".png"); // To avoid memory leaks Destroy(ss); GameObject.Find("Canvas").GetComponent <Canvas>().enabled = true; }
private IEnumerator TakeScreenshotAndSave() { bool dontdoit = false; takingScreenshot = true; RegularCanvas.SetActive(false); if (RocketCanvas) { RocketCanvas.SetActive(false); } else { dontdoit = true; } yield return(new WaitForEndOfFrame()); Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); ss.Apply(); // Save the screenshot to Gallery/Photos string name = string.Format("{0}_Capture{1}_{2}.png", Application.productName, "{0}", System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); print("Permission result: " + NativeGallery.SaveImageToGallery(ss, Application.productName + " Captures", name)); takingScreenshot = false; RegularCanvas.SetActive(true); if (!dontdoit) { RocketCanvas.SetActive(true); } }
public void SaveToAndroidGallery() { Texture2D texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); texture.LoadImage(synthesizedImage); NativeGallery.SaveImageToGallery(texture, "FaceCody", string.Format("{0}+{1}.png", Global.targetImageName, Global.sourceImageName)); }
public static void SerializeDataToAlbum(Texture2D p_texture, string p_fileName) { FixInstanceName(); var v_extension = "." + CrossPickerServices.EncodeOption.ToString().ToLower(); if (!string.IsNullOrEmpty(p_fileName) && !p_fileName.EndsWith(v_extension)) { p_fileName += v_extension; } byte[] v_data = p_texture != null ? (CrossPickerServices.EncodeOption == CrossPickerServices.TextureEncoderEnum.JPG ? p_texture.EncodeToJPG() : p_texture.EncodeToPNG()) : null; NativeGallery.MediaSaveCallback v_mediaSaveDelegate = (error) => { if (string.IsNullOrEmpty(error)) { var v_temporarySavePath = CrossPickerServices.SaveTextureToTemporaryPath(v_data, System.IO.Path.GetFileName(p_fileName)); Instance.NativeImageSaveSuccess(v_temporarySavePath); } else { Instance.NativeImageSaveFailed(); } }; NativeGallery.SaveImageToGallery(v_data, Application.productName, p_fileName, v_mediaSaveDelegate); }
public IEnumerator ShareCore(Texture2D texture, bool isSaveGaralley = false, UnityAction onComplete = null) { this._isSharing = true; yield return(new WaitForEndOfFrame()); string fileName = this.GetFileName(); string filePath = this.GetSavePath(DirectoryName, fileName); //Pngに変換 byte[] bytes = texture.EncodeToPNG(); //保存 File.WriteAllBytes(filePath, bytes); if (isSaveGaralley) { var permission = NativeGallery.SaveImageToGallery(texture, DirectoryName, fileName); Debug.Log("Permision result:" + permission); } new NativeShare().AddFile(filePath) .SetSubject("Subject goes here").SetText("") .SetCallback((result, shareTarget) => { this._isSharing = false; Debug.Log("Share result: " + result + ", selected app: " + shareTarget); if (!ReferenceEquals(null, onComplete)) { onComplete(); } }) .Share(); }
private void TakePicture(int maxSize) { NativeCamera.Permission permission = NativeCamera.TakePicture((path) => { Debug.Log("Image path: " + path); text.text = "Image path: " + path; if (path != null) { // Create a Texture2D from the captured image Texture2D tex = NativeCamera.LoadImageAtPath(path, maxSize); if (tex == null) { Debug.Log("Couldn't load texture from " + path); return; } NativeGallery.SaveImageToGallery(tex, "GalleryTest", "My img {0}.png"); Sprite mySprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 100.0f); image.sprite = mySprite; } }, maxSize); Debug.Log("Permission result: " + permission); text.text += "\n Permission result:" + permission; }
public void Share() { NativeGallery.SaveImageToGallery(PhotoFilePath, "TestAR", "Screenshot.png"); myNativeShare = new NativeShare(); myNativeShare.AddFile(PhotoFilePath); myNativeShare.Share(); }
IEnumerator CaptureIt() { btnShot.SetActive(false); btnCloseMenu.SetActive(false); Camera.main.cullingMask = -1; yield return(new WaitForSeconds(1f)); // prepare texture with Screen and save it Texture2D texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); texture.ReadPixels(new Rect(0f, 0f, Screen.width, Screen.height), 0, 0); texture.LoadRawTextureData(texture.GetRawTextureData()); texture.Apply(); // save to persistentDataPath File byte[] data = texture.EncodeToJPG(85); string destination = Path.Combine(Application.persistentDataPath, System.DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".jpg"); File.WriteAllBytes(destination, data); Sprite sp = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)); canvas.GetComponent <Image>().sprite = sp; canvas.SetActive(true); toSave = destination; NativeGallery.SaveImageToGallery(texture, "ARCoreList", "Screenshot ARCoreList {0}.jpg"); yield return(new WaitForSeconds(1f)); canvas.SetActive(false); btnShot.SetActive(true); btnCloseMenu.SetActive(true); }
public IEnumerator Shot2() { isProcessing = true; yield return(new WaitForEndOfFrame()); string myFileName = "Screenshot" + System.DateTime.Now.Hour + System.DateTime.Now.Minute + System.DateTime.Now.Second + ".png"; string myDefaultLocation = Application.persistentDataPath + "/" + myFileName; string myFolderLocation = "/storage/emulated/0/DCIM/ARCamera/"; string myScreenshotLocation = myFolderLocation + myFileName; imageCurrentPath = myScreenshotLocation; if (!System.IO.Directory.Exists(myFolderLocation)) { System.IO.Directory.CreateDirectory(myFolderLocation); } canvas2.SetActive(false); canvas1.transform.localScale = new Vector3(0, 0, 0);; yield return(new WaitForEndOfFrame()); Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); ss.Apply(); // Save the screenshot to Gallery Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(ss, "ARCamera", myFileName)); // To avoid memory leaks Destroy(ss); canvas1.transform.localScale = new Vector3(1f, 1f, 1f); isProcessing = false; AndroidContentOpenerWrapper.OpenContent(myScreenshotLocation); }
// 스크린샷 찍고 갤러리에 갱신 void ScreenshotAndGallery() { // 스크린샷 // 2d 텍스쳐객체 > 넓이, 높이, 포멧 RGB24 설정, true?false? Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); Debug.Log("ss 설정"); // 현재 화면을 픽셀단위로 읽음 ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); Debug.Log("ss.ReadPixels"); // 적용 ss.Apply(); Debug.Log("ss.Apply()"); // 갤러리갱신 Debug.Log("" + NativeGallery.SaveImageToGallery(ss, albumName, "Screenshot_" + System.DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss") + ".png")); // To avoid memory leaks. // 복사 완료됐기 때문에 원본 메모리 삭제 Destroy(ss); Debug.Log("ScreenshotAndGallery() 완료"); }
private IEnumerator TakeScreenshotAndSave() { NativeGallery.Permission permission = NativeGallery.CheckPermission(); if (permission == NativeGallery.Permission.ShouldAsk) { permission = NativeGallery.RequestPermission(); } else { } takingScreenshot = true; yield return(new WaitForEndOfFrame()); Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); ss.Apply(); fotos = Random.Range(10000, 99999); // Save the screenshot to Gallery/Photos string name = string.Format("foto_" + fotos + ".png", Application.productName, "{0}", System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); //Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(ss, Application.productName + " Captures", name)); takingScreenshot = false; string stringX = "Permission result: " + NativeGallery.SaveImageToGallery(ss, Application.productName + " Captures", name); //textorefleja.text+=stringX; todo.SetActive(true); camaraimage.sprite = camarasprite; }
/// <summary> /// Savings the capture image. /// </summary> /// <returns>The capture image.</returns> IEnumerator SavingCaptureImage() { yield return(new WaitForEndOfFrame()); string path = Application.persistentDataPath + "/"; string saveFileName = m_FileName + GetDateString() + m_FileType; byte[] jpgData = m_TempScreenShot.EncodeToJPG(); #if UNITY_EDITOR File.WriteAllBytes(saveFileName, jpgData); yield return(new WaitForEndOfFrame()); OnCompleteCapture(); #elif UNITY_ANDROID if (UniAndroidPermission.IsPermitted(AndroidPermission.WRITE_EXTERNAL_STORAGE)) { NativeGallery.SaveImageToGallery(jpgData, "ARCoreList", "Screenshot ARCoreList {0}.jpg"); } else { OnCaptureFailed(); } #endif }
private IEnumerator TakeSnapShot() { yield return(new WaitForEndOfFrame()); Texture2D snapShot = new Texture2D(resWidth, resHeight, TextureFormat.RGB24, false); snapCam.Render(); RenderTexture.active = snapCam.targetTexture; snapShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0); byte[] bytes = snapShot.EncodeToPNG(); string fileName = string.Format("{0}_{1}.png", Application.dataPath, Application.productName, System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); NativeGallery.SaveImageToGallery(bytes, Application.dataPath, fileName); snapCam.targetTexture = null; fleshImage.SetActive(true); GetComponent <AudioSource>().Play(); yield return(new WaitForSeconds(.5f)); fleshImage.SetActive(false); }
IEnumerator CaptureIt() { yield return(new WaitForSeconds(0.5f)); // prepare texture with Screen and save it Texture2D texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); texture.ReadPixels(new Rect(0f, 0f, Screen.width, Screen.height), 0, 0); texture.LoadRawTextureData(texture.GetRawTextureData()); texture.Apply(); // save to persistentDataPath File byte[] data = texture.EncodeToPNG(); string destination = Path.Combine(Application.persistentDataPath, System.DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".png"); File.WriteAllBytes(destination, data); Sprite sp = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)); canvas.GetComponent <Image>().sprite = sp; toSave = destination; NativeGallery.SaveImageToGallery(texture, "testAR_Trofymchuk", "Screenshot testAR_Trofymchuk {0}.png"); Instantiate(blink, new Vector2(0f, 0f), Quaternion.identity); shotMenu.SetActive(true); }
private IEnumerator TakeScreenshotAndSave() { GameObject.Find("CaptureCanvas").GetComponent <Canvas>().enabled = false; TakeShotWithKids(Kids, true); yield return(new WaitForEndOfFrame()); Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); ss.Apply(); GameObject bl = Instantiate(blink) as GameObject; bl.transform.SetParent(blParent.transform, false); GameObject.Find("CaptureCanvas").GetComponent <Canvas>().enabled = true; TakeShotWithKids(Kids, true); string className = "EduApp_Social"; string name = string.Format("{0}_Capture{1}_{2}.png", className, "{0}", System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(ss, className + " Captures", name)); //Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(ss, "GalleryTest", "My img{0}.png")); Destroy(ss); }
public static IEnumerator CaptureAndShowPreviewImage(Texture2D imageTexture = null) { yield return(new WaitForEndOfFrame()); // Wait for rendering. byte[] bytes = imageTexture == null?GetBytesOfScreenshot() : imageTexture.EncodeToPNG(); string path; string imageName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".png"; // Set image name. #if UNITY_ANDROID path = androidGalleryPath; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } SaveImageToAndroidGallery(path + imageName, bytes); // Write bytes and refresh android gallery. previewGameObject.SetActive(true); ShowPreview(path + imageName); #elif UNITY_IOS path = Application.persistentDataPath + "/"; NativeGallery.SaveImageToGallery(bytes, galleryFolderName, imageName); // User plugin. previewGameObject.SetActive(true); ShowPreview(path + imageName); #elif UNITY_EDITOR path = windowsImageSavePath; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } SaveImageToWindow(path + imageName, bytes); #endif }
IEnumerator CallSocialShareRoutine() { isProcessing = true; Camera mainCam; RenderTexture renderTex; mainCam = Camera.main.GetComponent <Camera> (); renderTex = new RenderTexture(Screen.width, Screen.height, 24); mainCam.targetTexture = renderTex; RenderTexture.active = renderTex; mainCam.Render(); Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); ss.Apply(); RenderTexture.active = null; mainCam.targetTexture = null; // Save the screenshot to Gallery/Photos Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(ss, "Exxars", ScreenshotName)); // Save Photo Path + Share it string screenShotPath = Application.persistentDataPath + "/" + ScreenshotName; yield return(new WaitForSeconds(1f)); CallSocialShareAdvanced(ShareMessage, subject, url, screenShotPath); isProcessing = false; }
public void SaveCapturePhoto() { if (m_PhotoCaptureTexture != null) { NativeGallery.SaveImageToGallery(m_PhotoCaptureTexture, "Goorin Bros", FILE_SCREENSHOT_NAME); DeactivePhotoPanel(); } }
private IEnumerator TakeScreenshotAndSave() { UI = GameObject.FindGameObjectWithTag("UICanvas").GetComponent <UIManager>(); GM = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); COGM = CameraObjectManager.MyCamReceiver; PC = PlayerController.MyPlayerControl; if (PC.Hidup && !GM.IsPaused) { AudioController.Playsound("Jepret"); Animator isShowing = GameObject.FindGameObjectWithTag("ShowImage").GetComponent <Animator>(); isShowing.SetBool("ShowImage", false); Animator Jepret = GameObject.FindGameObjectWithTag("Shutter").GetComponent <Animator>(); Jepret.SetBool("Shutter", true); yield return(new WaitForSeconds(0.3f)); Time.timeScale = 1f; GameObject.Find("Canvas").GetComponent <Canvas>().enabled = false; // Wait till the last possible moment before screen rendering to hide the UI yield return(new WaitForEndOfFrame()); Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); ss.Apply(); COGM = CameraObjectManager.MyCamReceiver; // Save the screenshot to Gallery/Photos string name = string.Format("{0}_Capture_{1}.png", Application.productName, System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(ss, Application.productName + " Captures", name)); // To avoid memory leaks Destroy(ss); yield return(null); GameObject.Find("Canvas").GetComponent <Canvas>().enabled = true; //kalau pause animasi ga jalan //Time.timeScale = 0f; //ToastMessageShower.MyToast.showToastOnUiThread("Photo Saved in" + Application.productName + " Captures"); } else if (PC.myEnergy.MyCurrentValue <= (PC.myEnergy.MyMaxValue * 0.1)) { GameObject.Find("Canvas").GetComponent <Canvas>().enabled = true; UI.HPTOLOW(); print("GAGAL"); PC.IsAnimator.SetBool("IsCapture", false); GM.isCapturing = false; UI.LoadUI(true, false, false, false, false, false, false, false, false, false); Time.timeScale = 1f; } else if (!PC.Hidup) { StartCoroutine(PC.Lose()); } else { UI.HPTOLOW(); print("GAGAL"); } PC.jepretYes = true; }
public void SaveOnDeviceBtn() { string name = string.Format("{0}_Capture{1}_{2}.png", Application.productName, "{0}", System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); string pathToFile = files[whichScreenShotIsShown]; Texture2D texture = GetScreenshotImage(pathToFile); Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(texture.GetRawTextureData(), Application.productName + " Captures", name)); canvAnim.Play("TickAnimation"); }
//saves an image to be used in a flashcard private string saveImage() { string newPath = ""; NativeGallery.Permission permission = NativeGallery.SaveImageToGallery(imageToSave, "GalleryTest", "Image.png", (success, path) => newPath = path ); return(newPath); }
// public void OnClickSavePhoto() { previewPanel.SetActive(false); var time = DateTime.Now; string fileName = time.ToString("AR dd-MM-yy hhmmss") + ".png"; // Save the screenshot to Gallery/Photos NativeGallery.SaveImageToGallery(ss, "AlphabetInter", fileName); }