IEnumerator E_TakeScreenshot() { yield return(new WaitForEndOfFrame()); Texture2D tex2d_screenshot = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); tex2d_screenshot.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); tex2d_screenshot.Apply(); Debug.Log("Photo taken!"); FileIOUtility.SaveImage(tex2d_screenshot, imageSavingPath, FileIOUtility.GenerateFileName("MyScreenshot", 12, FileIOUtility.FileExtension.PNG), FileIOUtility.FileExtension.PNG); }
void HandlePhotoTaken(Texture2D _takenPhoto) { photoAnimController.PlayShotAnim(); photoCount += 1; // Show rImg_takenPhoto rImg_takenPhoto.texture = _takenPhoto; rImg_takenPhoto.gameObject.SetActive(true); // Save taken photo as a png file string fullName = FileIOUtility.GenerateFileName(fileName, photoCount, FileIOUtility.FileExtension.PNG); FileIOUtility.SaveImage(_takenPhoto, savePath, fullName, FileIOUtility.FileExtension.PNG); // Wait for some time and go back to a playable status StartCoroutine(E_WaitAndReset()); }
void HandleQRCodeGenerated(Texture2D _generatedQRCode) { tex_qrCode = _generatedQRCode; uiController.SetQRCode(tex_qrCode); playerCount++; Debug.Log("PlayerCount: " + playerCount); /* * gameData.playerCount = playerCount; * bool saveGameDataSuccess = false; * dataManager.SaveGameData(gameData, ref saveGameDataSuccess); * if (saveGameDataSuccess == false) * { * isGameReady = false; * uiController.ActivateErrorCanvas(true, Extension.ErrorType.Save); * //uiController.ActivateErrorCanvas(true, * //"Something's wrong \n when saving GameData."); * }*/ // Save taken photo as a png file photoFileName = FileIOUtility.GenerateFileName(photoFileNamePrefix, playerCount, FileIOUtility.FileExtension.PNG); FileIOUtility.SaveImage(tex_takenPhoto, photoSavePath, photoFileName, FileIOUtility.FileExtension.PNG); // Save QRCode string qrFileName = FileIOUtility.GenerateFileName(qrFileNamePrefix, playerCount, FileIOUtility.FileExtension.PNG); FileIOUtility.SaveImage(tex_qrCode, qrSavePath, qrFileName, FileIOUtility.FileExtension.PNG); // Disable the loading icon uiController.ActivateUploadingProcess(false); // Go to the Result state GoToState(Extension.GameState.ResultState); }