public void LoadPreviousShots(string _productName) { if (File.Exists(GetFileNames.Instance.ProductJsonFileName(_productName))) { string loadJson = File.ReadAllText(GetFileNames.Instance.ProductJsonFileName(_productName)); loadListOfShotDetails = JsonUtility.FromJson <ListOfShotDetails>(loadJson); foreach (ShotDetails shots in loadListOfShotDetails.Items) { if (shots.productName == ProductHandlerManager.Instance.product.name) { GameObject newShotButton = GameObject.Instantiate(CaptureTemplateUI.Instance.ShotButtonPrefab); newShotButton.GetComponent <RefrenceShotDetails>().shotDetails = shots; newShotButton.transform.SetParent(CaptureTemplateUI.Instance.shotsContainer.transform); if (shots.shotType == ShotType.Animation) { newShotButton.GetComponent <RefrenceShotDetails>().frameCount.text = "# of shots : " + shots.frameCount; } if (shots.isCaptured) { string fileNameOfScreenShot = GetFileNames.Instance.ProductFolderName(ProductHandlerManager.Instance.product.name) + "/screenshots"; fileNameOfScreenShot += "/" + shots.shotName + ".png"; UpdateScreenShotDetails.Instance.UpdateThumbNail(fileNameOfScreenShot, newShotButton.GetComponent <RefrenceShotDetails>().thumbNail); } } } } }
//Check shotname is there are not bool IsNameOfShot(ListOfShotDetails _listOfShots, string _newName) { if (_listOfShots.Items.Count == 0) { return(true); } foreach (ShotDetails shot in _listOfShots.Items) { if (shot.shotName == _newName) { return(false); } } return(true); }