using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading.Tasks; using HotUpdate.UI; using TMPro; using UnityEditor; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; /// Confirms the camp painting has a walking placeholder and speech only after a tap. public static class VerifyHomeExplorer { static async Task Until(Func condition, int seconds = 20) { var end = DateTime.UtcNow.AddSeconds(seconds); while (!condition()) { if (DateTime.UtcNow >= end) throw new Exception("Home explorer timed out"); await Task.Delay(100); } } public static async Task Play() { if (!EditorApplication.isPlaying) throw new Exception("Enter Play Mode first"); HomeExplorerPresenter presenter = null; await Until(() => (presenter = UnityEngine.Object.FindObjectOfType()) != null && presenter.Ready); if (presenter.Talking) throw new Exception("Speech was visible before a tap: " + presenter.Line); var greeting = presenter.transform.parent.Find("Layout_Sides/Panel_Greeting"); if (greeting != null && greeting.gameObject.activeSelf) throw new Exception("Static greeting is still visible"); float x = presenter.transform.parent.Find("Btn_Explorer").position.x; await Task.Delay(900); float moved = presenter.transform.parent.Find("Btn_Explorer").position.x; if (Mathf.Abs(moved - x) < 1f) throw new Exception("Explorer did not move: " + x + " -> " + moved); await Capture("walk"); var button = GameObject.Find("Btn_Explorer").GetComponent