using System.Collections; using System.Collections.Generic; using System.Globalization; using System.IO; using UnityEditor; using UnityEngine; namespace HexaCrazy.Editor { public static class HexUIRevisionCapture { static string Folder=>Path.GetFullPath("output/qa/ui-v2"); [MenuItem("Hexa Crazy/Capture UI Revision (Play Mode)")] public static void Capture() { if(!EditorApplication.isPlaying)throw new System.InvalidOperationException("Enter Play Mode first."); var app=Object.FindAnyObjectByType();app.StartCoroutine(Run(app)); } static IEnumerator Shot(string name) { yield return new WaitForSecondsRealtime(.5f);yield return new WaitForEndOfFrame(); ScreenCapture.CaptureScreenshot(Path.Combine(Folder,name+".png"));yield return new WaitForSecondsRealtime(.2f); } static IEnumerator Run(HexGameApp app) { Directory.CreateDirectory(Folder);Directory.CreateDirectory(Path.Combine(Folder,"frames")); HexProjectBuilder.SetGameView(750,1334);app.UseReviewProfile(Path.Combine(Folder,"review-profile.json"));app.Profile.Reset(); app.Profile.Data.reduceMotion=true;app.Profile.Data.music=false;app.Profile.Data.sound=false; app.GetComponent().Music=false;app.GetComponent().Sound=false; app.SetMode(2);yield return Shot("lobby");app.PreviewApprovedGameplay();yield return Shot("game"); app.OpenPanel("shop");yield return Shot("shop");app.ClosePanel(); app.OpenPanel("draw");yield return Shot("draw");app.ClosePanel(); app.StartLevel(2,20,true);yield return Shot("max-board"); HexProjectBuilder.SetGameView(1125,2436);app.SetMode(2);yield return Shot("long-lobby");app.PreviewApprovedGameplay();yield return Shot("long-game"); HexProjectBuilder.SetGameView(750,1334);app.SetMode(0);yield return new WaitForSecondsRealtime(.4f);app.Profile.Data.reduceMotion=false; var times=new List();int frame=0; for(int step=0;step<3;step++) { app.SetMode((step+1)%3);float until=Time.realtimeSinceStartup+1; while(Time.realtimeSinceStartup