using System.Collections; using System.Collections.Generic; using System.IO; using System; using UnityEngine; using UnityEngine.UI; public class ScreenCap2 : MonoBehaviour { public Text savName; public Text inputName; public Image panelDisp; private String localSavName; String useIn; private Sprite img1; private Sprite img2; private Sprite temp; private bool newTrue; private bool picOnly; private bool annot; private string preFx; // Start is called before the first frame update public void start() { setNewTrue(); inputName.text = "Caine"; } public void setNewTrue() { newTrue = true; } public void setPicOnly() { picOnly = true; } public void setPicAnnot() { picOnly = false; } public void setPicDet() { Debug.Log("sPD Stage 1"); if (newTrue == true) { if(picOnly == true) { Debug.Log("sPD Stage 2"); useIn = "Screenshot" + savName.text + DateTime.Now.ToString("yyyyMMddTHHmmss"); preFx = Path.Combine(Application.dataPath, "Resources", "TemporaryPic.png"); } else { Debug.Log("sPD Stage 2"); useIn = "Annotation" + savName.text + DateTime.Now.ToString("yyyyMMddTHHmmss"); preFx = Path.Combine(Application.dataPath, "Resources", "TemporaryAnnot.png"); } takePic(preFx); //dispPic(); }else if(preFx != null) { takePic(preFx); // dispPic(); } } public void dispPic() { // Debug.Log("display Stage 1"); //panelDisp.AddComponent(typeof(Image)); //img1 = Resources.Load("TemporaryPic"); // Debug.Log("display Stage 2"); // panelDisp.sprite = img1; //Debug.Log("display Stage 3"); } public void takePic(string pathanName) { ScreenCapture.CaptureScreenshot(pathanName, 1); Debug.Log("Save Path will be : " + pathanName); } public void setName() { localSavName = (inputName.GetComponent().text); savName.text = localSavName; Debug.Log("chosen name is : " + savName.text); } }