IEnumerator CaptureIt() { // Wait till the last possible moment before screen rendering to hide the UI yield return(null); GameObject.Find("MyCanvas").GetComponent <Canvas>().enabled = false; //input field token UserID_Token username = new UserID_Token(); string uid = username.GetuserName(); string timeStamp = System.DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss"); //string fileName = uid + timeStamp + ".png"; string fileName = "Default.png"; string Name = fileName; yield return(new WaitForEndOfFrame()); ScreenCapture.CaptureScreenshot("Initial/" + Name); GameObject.Find("MyCanvas").GetComponent <Canvas>().enabled = true; Shot_taken = true; if (Shot_taken == true) { SceneLevel ScNo = new SceneLevel(); int SceneNo = ScNo.GetSceneNumber(); SceneManager.LoadScene(5); SceneNo = 5; } }
public void Move() { //timestamp and user id token call by get method string timeStamp = System.DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss"); UserID_Token username = new UserID_Token(); string uid = username.GetuserName(); //Toggle value listner Debug.Log(EM); Debug.Log(FB); DirectoryInfo sourceInfo = new DirectoryInfo(Application.persistentDataPath + "/Initial"); DirectoryInfo destInfo = new DirectoryInfo(Application.persistentDataPath + "/Success"); if (!Directory.Exists(destInfo.FullName)) { Directory.CreateDirectory(destInfo.FullName); } foreach (FileInfo fi in sourceInfo.GetFiles()) { if (fi.Length != 0 && FB == true && EM == true) { fi.CopyTo(Path.Combine(destInfo.ToString(), uid + "___1___1___" + timeStamp + ".png"), true); } Succeed = true; if (fi.Length != 0 && FB == true && EM == false) { fi.CopyTo(Path.Combine(destInfo.ToString(), uid + "___1___0___" + timeStamp + ".png"), true); Succeed = true; } if (fi.Length != 0 && FB == false && EM == true) { fi.CopyTo(Path.Combine(destInfo.ToString(), uid + "___0___1___" + timeStamp + ".png"), true); Succeed = true; } if (fi.Length != 0 && FB == false && EM == false) { fi.CopyTo(Path.Combine(destInfo.ToString(), uid + "___0___0___" + timeStamp + ".png"), true); Succeed = true; } } if (Succeed == true) { FB = false; EM = false; DirectoryInfo directoryInfo = new DirectoryInfo(Application.persistentDataPath + "/Initial"); foreach (FileInfo file in directoryInfo.GetFiles()) { file.Delete(); Debug.Log("Files deleted"); } SceneLevel ScNo = new SceneLevel(); int SceneNo = ScNo.GetSceneNumber(); SceneManager.LoadScene(7); ScNo.SetSceneIndex(7); } }
public void retakePhoto() { DirectoryInfo directoryInfo = new DirectoryInfo(Application.persistentDataPath + "/Initial"); foreach (FileInfo file in directoryInfo.GetFiles()) { file.Delete(); Debug.Log("Files deleted"); deleteflag = true; if (deleteflag == true) { SceneLevel ScNo = new SceneLevel(); int SceneNo = ScNo.GetSceneNumber(); SceneManager.LoadScene(3); SceneNo = 3; } } //foreach(DirectoryInfo dir in directoryInfo.GetDirectories()){ // directoryInfo.Delete(); //} }