using System; using System.Collections; using System.IO; using System.Linq; using UnityEditor; using UnityEngine; using UnityEngine.UI; namespace HexaCrazy.Editor { // Editor-only, isolated save data. This never appears in a player build. public static class HexReviewCapture { static string Folder => Path.GetFullPath("output/qa"); [MenuItem("Hexa Crazy/Capture Review Screens (Play Mode)")] public static void Capture() { if(!EditorApplication.isPlaying)throw new InvalidOperationException("Enter Play Mode first."); var app=UnityEngine.Object.FindAnyObjectByType(); app.StartCoroutine(Run(app)); } static IEnumerator Shot(string name) { yield return new WaitForSecondsRealtime(.35f); Canvas.ForceUpdateCanvases(); yield return new WaitForEndOfFrame(); ScreenCapture.CaptureScreenshot(Path.Combine(Folder,name+".png")); yield return new WaitForSecondsRealtime(.25f); } static IEnumerator Run(HexGameApp app) { Directory.CreateDirectory(Folder);HexProjectBuilder.SetGameView(750,1334); app.UseReviewProfile(Path.Combine(Folder,"capture-profile.json"));app.Profile.Reset(); app.Profile.Data.music=false;app.Profile.Data.sound=false;app.Profile.Data.reduceMotion=true; app.GetComponent().Music=false;app.GetComponent().Sound=false; app.ShowStart();yield return Shot("final-start"); app.SetMode(2);yield return Shot("final-lobby"); app.PreviewApprovedGameplay();yield return Shot("final-game"); foreach(string panel in new[]{"shop","checkin","draw","settings","profile","help"}) {app.OpenPanel(panel);yield return Shot("final-"+panel);app.ClosePanel();} app.StartLevel(0,1);yield return Shot("final-tutorial"); app.Profile.Data.tutorial=1; app.StartLevel(2,20,true);yield return Shot("final-max-board"); foreach(var cell in app.Game.Cells){cell.need=0;cell.tiles.Clear();cell.tiles.AddRange(Enumerable.Range(0,24).Select(i=>(i/6)%4));} app.SelectHand(0);yield return Shot("final-high-stacks"); app.StartLevel(0,1,true);app.Game.Score=298;app.Game.Hand[0]=new HandGroup(0,1);app.PlaceAt(0,0); yield return Shot("final-win"); app.StartLevel(1,1,true);app.Game.Time=.01f;yield return Shot("final-time-up"); HexProjectBuilder.SetGameView(1125,2436);app.SetMode(2);yield return Shot("final-long-lobby"); app.PreviewApprovedGameplay();yield return Shot("final-long-game"); HexProjectBuilder.SetGameView(750,1334);app.SetMode(2); File.WriteAllText(Path.Combine(Folder,"capture-complete.txt"),DateTime.Now.ToString("s")+"\n750x1334 + 1125x2436; isolated capture-profile.json"); Debug.Log("HEXA_QA_CAPTURE_COMPLETE"); } } }