using UnityEngine; using UnityEngine.UI; using Utils; namespace Minigames.StatueDressup.Test { /// /// Minimal test for photo capture - just capture and save to disk /// public class PhotoCaptureTestController : MonoBehaviour { [Header("Required")] [SerializeField] private RectTransform captureArea; [SerializeField] private Button captureButton; [Header("Optional - UI to hide during capture")] [SerializeField] private GameObject[] hideTheseObjects; private void Start() { if (captureButton != null) { captureButton.onClick.AddListener(OnCaptureClicked); } Debug.Log($"[PhotoCaptureTest] Ready. Photo save path: {PhotoManager.GetCaptureDirectory(CaptureType.StatueMinigame)}"); } private void OnCaptureClicked() { if (captureArea == null) { Debug.LogError("[PhotoCaptureTest] Capture Area not assigned!"); return; } Debug.Log("[PhotoCaptureTest] Starting capture..."); StartCoroutine(CaptureCoroutine()); } private System.Collections.IEnumerator CaptureCoroutine() { // Use new PhotoManager plug-and-play coroutine yield return PhotoManager.CaptureAndSaveCoroutine( CaptureType.StatueMinigame, captureArea, hideTheseObjects, onSuccess: (photoId) => { string path = $"{PhotoManager.GetCaptureDirectory(CaptureType.StatueMinigame)}/{photoId}.png"; Debug.Log($"[PhotoCaptureTest] ✅ SUCCESS! Photo saved: {path}"); // Load back to verify Texture2D loadedPhoto = PhotoManager.LoadPhoto(CaptureType.StatueMinigame, photoId); if (loadedPhoto != null) { Debug.Log($"[PhotoCaptureTest] Photo size: {loadedPhoto.width}x{loadedPhoto.height}"); } }, onFailure: (error) => { Debug.LogError($"[PhotoCaptureTest] ❌ Failed: {error}"); }, metadata: 0 ); } private void OnDestroy() { if (captureButton != null) captureButton.onClick.RemoveListener(OnCaptureClicked); } } }