Fix method signatures for apple machines
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
using Core;
|
||||
using Minigames.StatueDressup.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Minigames.StatueDressup.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Minimal test for photo capture - just capture and save to disk
|
||||
/// </summary>
|
||||
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: {StatuePhotoManager.GetPhotoDirectory()}");
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
// Hide UI
|
||||
foreach (var obj in hideTheseObjects)
|
||||
if (obj != null) obj.SetActive(false);
|
||||
|
||||
yield return new WaitForEndOfFrame();
|
||||
|
||||
// Capture
|
||||
bool done = false;
|
||||
Texture2D photo = null;
|
||||
|
||||
StatuePhotoManager.CaptureAreaPhoto(captureArea, (texture) => {
|
||||
photo = texture;
|
||||
done = true;
|
||||
});
|
||||
|
||||
yield return new WaitUntil(() => done);
|
||||
|
||||
// Restore UI
|
||||
foreach (var obj in hideTheseObjects)
|
||||
if (obj != null) obj.SetActive(true);
|
||||
|
||||
// Save
|
||||
if (photo != null)
|
||||
{
|
||||
string photoId = StatuePhotoManager.SavePhoto(photo, 0);
|
||||
|
||||
if (!string.IsNullOrEmpty(photoId))
|
||||
{
|
||||
string path = $"{StatuePhotoManager.GetPhotoDirectory()}/{photoId}.png";
|
||||
Debug.Log($"[PhotoCaptureTest] ✅ SUCCESS! Photo saved: {path}");
|
||||
Debug.Log($"[PhotoCaptureTest] Photo size: {photo.width}x{photo.height}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("[PhotoCaptureTest] ❌ Failed to save photo");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("[PhotoCaptureTest] ❌ Failed to capture photo");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (captureButton != null)
|
||||
captureButton.onClick.RemoveListener(OnCaptureClicked);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user