using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using UnityEngine; namespace Auralis { public sealed partial class PrototypeQA { const string RemainingRoomArtScope="Native room-art fixtures only: 15 locations use original room pixels; seven additional locations explicitly use the existing dedicated Night/River family kits; Evening is the eighth dedicated location and retains its own comparison rules. Each room is independently constructed from explicitly declared CrownHeartPrerequisite access/equipment history, with target local progress reset. Each pictured named support is a separate declared visual placement; earlier routes/fights/ride/rewards are not earned by these placements. Enemy controllers are held for the visual fixture, without changing actor health or campaign gameplay flags. Actual physics Grounded contact on the named layer-6 solid is required before pausing the native camera for capture; UI canvases are temporarily hidden. Lower/upper newly dressed fixed banks, each moving bank, the crossing rear cornice and Evening flank/upper comparison are captured where present. Every active matching art component and every front is inventoried, including off-camera fronts. Actual front textures must match the declared SourceArt. Original-room front X/Y world-units per source pixel must match SourceDensity; all seven additional dedicated locations must use .0065 world-units per source pixel on both axes. Evening art follows its own rules. Native PNGs need separate visual review. This does not demonstrate travel, fights, ride timing, whole-room completion, damage-free play or human style acceptance. No manipulated screenshots, product geometry changes, runtime health gifts, force kills or reward injection."; sealed class RemainingArtFixture { public string key,resource,level,room,source,dungeon; public bool original=true; public Action enter; public Func dungeonArrival; } [Serializable] sealed class RemainingArtEvidence { public string scope=RemainingRoomArtScope,utc,applicationVersion; public List rooms=new(); public List views=new(); } [Serializable] sealed class RemainingArtRoom { public string key,resource,level,room,source,dungeon,fixtureSave; public int actualArtComponents,newBankComponents,movingBankComponents,rearComponents; public bool originalExpected,sourceMatches,originalMatches,densityMatches; public List components=new(); } [Serializable] sealed class RemainingArtComponent { public string path,sourceArt,supportPath; public float sourceDensity,checkedDensity; public bool original,moving,rear; public Bounds supportBounds; public List fronts=new(); } [Serializable] sealed class RemainingArtFront { public string path,sourceFrontPath,texture,sprite,material,shader; public bool enabled,active,densityMatches,sourceMatches,inCamera,runtimeWarningCopy; public float pixelsPerUnit,worldUnitsPerPixelX,worldUnitsPerPixelY; public Vector3 scale; public Rect sourceRect; public Bounds bounds; } [Serializable] sealed class RemainingArtView { public string key,label,picture,expectedSupport,actualSupport,fixtureSave; public bool grounded,supported,densityMatches,sourceMatches,fileWritten; public Vector2 declaredFeet,feet,velocity; public int serialAtPlacement,serialAtCapture,deathsAtPlacement,deathsAtCapture,healthHalfUnits,width,height; public Bounds supportBounds; public Vector3 camera; public float cameraSize; public List currentRoomFronts=new(); } static RemainingArtFixture RemainingRoom(string key,string resource,string level,string room,string source,Action enter,bool original=true) =>new(){key=key,resource=resource,level=level,room=room,source=source,enter=enter,original=original}; RemainingArtFixture[] RemainingArtFixtures()=>new[]{ RemainingRoom("archive-morning","ArchiveMemoryMorning",LevelCatalog.ArchiveMemory,"2","Assets/Scripts/World/ArchiveMorningPlatformPassage.cs",()=>ArchiveMemoryWorld.I.Enter(2,220,632)), RemainingRoom("archive-crossing","ArchiveMemoryCrossing",LevelCatalog.ArchiveMemory,"4","Assets/Scripts/World/ArchiveGalleryPlatformPassage.cs",()=>ArchiveMemoryWorld.I.Enter(4,220,710)), RemainingRoom("observatory-west","ObservatoryWest",LevelCatalog.Observatory,"1","Assets/Scripts/World/ObservatoryWestPlatformPassage.cs",()=>ObservatoryWorld.I.Enter(1,220,688)), RemainingRoom("observatory-north","ObservatoryNorth",LevelCatalog.Observatory,"3","Assets/Scripts/World/ObservatoryNorthPlatformPassage.cs",()=>ObservatoryWorld.I.Enter(3,220,395)), RemainingRoom("glass-terraces","GlassGardenTerraces",LevelCatalog.GlassGarden,"1","Assets/Scripts/World/GlassTerracePlatformPassage.cs",()=>GlassGardenWorld.I.Enter(1,220,703)), RemainingRoom("glass-fork","GlassGardenFork",LevelCatalog.GlassGarden,"2","Assets/Scripts/World/GlassForkPlatformPassage.cs",()=>GlassGardenWorld.I.Enter(2,220,719)), RemainingRoom("star-high-path","StarBrokenStair",LevelCatalog.StarArchive,"3","Assets/Scripts/World/StarArchiveAscent.cs",()=>StarArchiveWorld.I.Enter(3,220,930)), RemainingRoom("star-first-gallery","StarWindGallery",LevelCatalog.StarArchive,"1","Assets/Scripts/World/StarWindGalleryPassage.cs",()=>StarArchiveWorld.I.Enter(1,220,949)), RemainingRoom("mist-spool","RoomIntegratedRiverV1",LevelCatalog.MistWorkshop,"1","Assets/Scripts/World/MistSpoolPlatformPassage.cs",()=>MistWorkshopWorld.I.Enter(1,220,703),false), RemainingRoom("mist-tension","RoomIntegratedRiverV1",LevelCatalog.MistWorkshop,"3","Assets/Scripts/World/LateConnectedRoutes.cs",()=>MistWorkshopWorld.I.Enter(3,445,731),false), RemainingRoom("root-carry","RoomIntegratedNightV1",LevelCatalog.RootCathedral,"1","Assets/Scripts/World/LateConnectedRoutes.cs",()=>RootCathedralWorld.I.Enter(1,425,878),false), RemainingRoom("root-open","RoomIntegratedNightV1",LevelCatalog.RootCathedral,"3","Assets/Scripts/World/RootCathedralPlatformPassage.cs",()=>RootCathedralWorld.I.Enter(3,205,816),false), RemainingRoom("root-turn","RoomIntegratedNightV1",LevelCatalog.RootCathedral,"2","Assets/Scripts/World/RootCathedralTurnPassage.cs",()=>RootCathedralWorld.I.Enter(2,255,823),false), RemainingRoom("river-ray","RoomIntegratedRiverV1",LevelCatalog.RiverWithoutBanks,"1","Assets/Scripts/World/RiverPlatformPassage.cs",()=>RiverWithoutBanksWorld.I.Enter(1,350,418),false), RemainingRoom("seconds-clock","SecondsCityClockSquare",LevelCatalog.SecondsCity,"0","Assets/Scripts/World/LateConnectedRoutes.cs",()=>SecondsCityWorld.I.Enter(0,680,725)), RemainingRoom("seconds-weaver","SecondsCityWeaverSquare",LevelCatalog.SecondsCity,"1","Assets/Scripts/World/LateConnectedRoutes.cs",()=>SecondsCityWorld.I.Enter(1,350,749)), RemainingRoom("seconds-canal","SecondsCityCanalSquare",LevelCatalog.SecondsCity,"2","Assets/Scripts/World/SecondsCanalPlatformPassage.cs",()=>SecondsCityWorld.I.Enter(2,700,674)), RemainingRoom("open-sky-rim","OpenSkyCrownRim",LevelCatalog.OpenSky,"4","Assets/Scripts/World/CrownRimPlatformPassage.cs",()=>OpenSkyWorld.I.Enter(4,615,584)), RemainingRoom("last-connection-hub","LastConnectionHub",LevelCatalog.LastConnection,"0","Assets/Scripts/World/LastConnectionPlatformPassage.cs",()=>LastConnectionWorld.I.Enter(0,370,777)), RemainingRoom("crown-heart-court","CrownHeartCourt",LevelCatalog.CrownHeart,"1","Assets/Scripts/World/CrownHeartPlatformPassage.cs",()=>CrownHeartWorld.I.Enter(1,370,804)), new RemainingArtFixture{key="night-vein-hall",resource="RoomIntegratedNightV1",level=LevelCatalog.MistWorkshop,room="H",dungeon="night-vein-heart",original=false, source="Assets/Scripts/Gameplay/NightVeinEastGalleryPassage.cs",dungeonArrival=r=>DungeonDefinition.NightVeinLocal(r.Definition.Find("H"),600,332)}, new RemainingArtFixture{key="last-hearth-hall",resource="LastHearthHall",level=LevelCatalog.SecondsCity,room="I",dungeon="last-hearth", source="Assets/Scripts/Gameplay/DungeonRun.LastHearth.cs",dungeonArrival=r=>DungeonDefinition.HearthAt(r.Definition.Find("I"),300,729)}, new RemainingArtFixture{key="archive-evening-comparison",resource="RoomIntegratedEveningV1",level=LevelCatalog.ArchiveMemory,room="6", source="Assets/Scripts/World/ArchiveEveningPassage.cs;Assets/Scripts/Presentation/RoomArchitectureCutout.cs",original=false,enter=()=>ArchiveMemoryWorld.I.Enter(6,220,560)} }; static float RemainingCheckedDensity(RoomIntegratedPlatformArt art) =>art.UsesOriginalPixels ? art.SourceDensity : ((art.SourceArt=="RoomIntegratedNightV1"||art.SourceArt=="RoomIntegratedRiverV1") ? .0065f : 0); static bool RemainingSource(RoomIntegratedPlatformArt art,SpriteRenderer front) =>front&&front.sprite&&front.sprite.texture&&front.sprite.texture.name==art.SourceArt; static bool RemainingDensity(RoomIntegratedPlatformArt art,SpriteRenderer front) { float expected=RemainingCheckedDensity(art);if(expected==0&&!art.UsesOriginalPixels)return true; if(!front||!front.sprite||expected<=0||front.sprite.pixelsPerUnit<=0)return false; float ppu=front.sprite.pixelsPerUnit,tolerance=Mathf.Max(.000001f,expected*.002f); return Mathf.Abs(art.SourceDensity-expected)<=tolerance &&Mathf.Abs(Mathf.Abs(front.transform.lossyScale.x)/ppu-expected)<=tolerance &&Mathf.Abs(Mathf.Abs(front.transform.lossyScale.y)/ppu-expected)<=tolerance; } static BoxCollider2D RemainingSupport(RoomIntegratedPlatformArt art) { // DressSpan creates a presentation child under an existing bank. // Only that immediate parent is a support; a standalone cornice // must remain classified as scenery without a collider. var own=art.GetComponent();if(own)return own; return art.transform.parent?art.transform.parent.GetComponent():null; } static IEnumerable RemainingFronts(RoomIntegratedPlatformArt art) { foreach(var front in art.Fronts)if(front)yield return front; var bank=RemainingSupport(art);if(!bank||!bank.GetComponent())yield break; // A natural warning hides the source renderer and draws its own // same-sprite/material copy. Validate the actual copy as well; // never enable the hidden source merely to make the test pass. foreach(var copy in bank.GetComponentsInChildren(true)) if(copy&©.enabled&&!art.Fronts.Contains(copy)&&art.Fronts.Any(f=>f&&f.sprite==copy.sprite&&f.sharedMaterial==copy.sharedMaterial)) yield return copy; } RemainingArtFront RemainingFront(RoomIntegratedPlatformArt art,SpriteRenderer front) { var sprite=front.sprite;var material=front.sharedMaterial;var planes=GeometryUtility.CalculateFrustumPlanes(Camera.main); var source=art.Fronts.FirstOrDefault(f=>f&&f.sprite==sprite&&f.sharedMaterial==material); return new RemainingArtFront{path=GraphicsPath(front.transform),sourceFrontPath=source?GraphicsPath(source.transform):"missing", runtimeWarningCopy=!art.Fronts.Contains(front),texture=sprite&&sprite.texture?sprite.texture.name:"missing", sprite=sprite?sprite.name:"missing",material=material?material.name:"missing",shader=material&&material.shader?material.shader.name:"missing", enabled=front.enabled,active=front.gameObject.activeInHierarchy,densityMatches=RemainingDensity(art,front),sourceMatches=RemainingSource(art,front), inCamera=front.enabled&&front.gameObject.activeInHierarchy&&GeometryUtility.TestPlanesAABB(planes,front.bounds), pixelsPerUnit=sprite?sprite.pixelsPerUnit:0,worldUnitsPerPixelX=sprite?Mathf.Abs(front.transform.lossyScale.x)/sprite.pixelsPerUnit:0, worldUnitsPerPixelY=sprite?Mathf.Abs(front.transform.lossyScale.y)/sprite.pixelsPerUnit:0, scale=front.transform.lossyScale,sourceRect=sprite?sprite.rect:new Rect(),bounds=front.bounds}; } RemainingArtComponent RemainingComponent(RoomIntegratedPlatformArt art) { var bank=RemainingSupport(art); var row=new RemainingArtComponent{path=GraphicsPath(art.transform),sourceArt=art.SourceArt,sourceDensity=art.SourceDensity,checkedDensity=RemainingCheckedDensity(art), original=art.UsesOriginalPixels,moving=bank&&bank.GetComponent(),rear=!bank, supportPath=bank?GraphicsPath(bank.transform):"presentation span without collider",supportBounds=bank?bank.bounds:new Bounds()}; foreach(var front in RemainingFronts(art))row.fronts.Add(RemainingFront(art,front));return row; } IEnumerator RemainingCapture(RemainingArtEvidence evidence,GraphicsSurveyEvidence graphics,RemainingArtFixture fixture,RoomIntegratedPlatformArt[] arts,BoxCollider2D bank,string suffix) { string label=fixture.key+"-"+suffix;Clear();CampaignSurveyHoldActors(); Vector2 declared=new(bank.bounds.center.x,bank.bounds.max.y+.04f); g.Player.Teleport(declared);int serial=g.Player.TeleportSerial,deaths=g.Deaths;float limit=Time.realtimeSinceStartup+3; do{CampaignSurveyHoldActors();yield return null;}while((!g.Player.Grounded||CourierFootSupport()!=bank)&&Time.realtimeSinceStartup(); foreach(var canvas in FindObjectsByType(FindObjectsSortMode.None))if(canvas.enabled){canvases.Add(canvas);canvas.enabled=false;} try{yield return GraphicsFrame(graphics,fixture.dungeon,fixture.room,label);} finally{foreach(var canvas in canvases)if(canvas)canvas.enabled=true;} var frame=graphics.frames[graphics.frames.Count-1];limit=Time.realtimeSinceStartup+2; while(!File.Exists(Path.Combine(folder,frame.picture))&&Time.realtimeSinceStartupRemainingSupport(a)==bank).SelectMany(RemainingFronts) .Any(f=>f&&f.enabled&&f.gameObject.activeInHierarchy&&GeometryUtility.TestPlanesAABB(GeometryUtility.CalculateFrustumPlanes(Camera.main),f.bounds)); CheckResult("Native PNG includes the actual dressed support, source and declared pixel density / "+label,row.fileWritten&&row.width==1920&&row.height==1080&&visible&&row.sourceMatches&&row.densityMatches, "PNG="+row.fileWritten+", visibleActualSourceOrWarningCopy="+visible+", actualSource="+row.sourceMatches+", density="+row.densityMatches); File.WriteAllText(Path.Combine(folder,row.fixtureSave),JsonUtility.ToJson(g.Save.Data,true));evidence.views.Add(row); File.WriteAllText(Path.Combine(folder,"remaining-room-art.json"),JsonUtility.ToJson(evidence,true)); g.Pause(false);Clear(); } public IEnumerator RemainingRoomArtChecks() { File.WriteAllText(Path.Combine(folder,"scope.txt"),RemainingRoomArtScope); bool isolated=g.QA&&g.Profiles.DirectoryPath.Contains("AuralisProfileQA");CheckResult("Remaining-room native art fixtures use an isolated QA profile",isolated);if(!isolated)yield break; StoryTransition.EnableInQA=false;CrownHeartPrerequisite();g.Save.Data.textSize=1;g.Save.Write(); string basis=JsonUtility.ToJson(g.Save.Data);File.WriteAllText(Path.Combine(folder,"declared-history.json"),JsonUtility.ToJson(g.Save.Data,true)); var evidence=new RemainingArtEvidence{utc=DateTime.UtcNow.ToString("o"),applicationVersion=Application.version}; var graphics=new GraphicsSurveyEvidence{scope=RemainingRoomArtScope};var fixtures=RemainingArtFixtures(); Screen.SetResolution(1920,1080,FullScreenMode.Windowed);yield return new WaitForSecondsRealtime(.3f); foreach(var fixture in fixtures) { yield return MasterLoadWorld(JourneyMode.Adventure,fixture.level,basis,d=>{ d.levels.RemoveAll(p=>p.id==fixture.level);d.levels.Add(new LevelProgress{id=fixture.level}); }); CampaignSurveyHoldActors();if(!g.HasStarted)g.Begin();if(g.Paused)g.Pause(false);Clear(); if(fixture.enter!=null)fixture.enter(); if(fixture.dungeonArrival!=null) { var run=DungeonRun.I;bool available=run&&run.Definition.Id==fixture.dungeon&&run.Definition.Find(fixture.room)!=null; CheckResult("Dungeon art fixture resolves its actual room / "+fixture.key,available);if(!available)continue; typeof(DungeonRun).GetMethod("EnterRoom",BindingFlags.Instance|BindingFlags.NonPublic).Invoke(run,new object[]{fixture.room,fixture.dungeonArrival(run),false}); } CampaignSurveyHoldActors();yield return null;Clear(); var arts=FindObjectsByType(FindObjectsSortMode.None).Where(a=>a&&a.gameObject.activeInHierarchy&&a.SourceArt==fixture.resource).ToArray(); var room=new RemainingArtRoom{key=fixture.key,resource=fixture.resource,level=fixture.level,room=fixture.room,source=fixture.source,dungeon=fixture.dungeon, fixtureSave="room-fixture-"+fixture.key+".json",actualArtComponents=arts.Length,originalExpected=fixture.original, sourceMatches=arts.Length>0&&arts.All(a=>a.Fronts.Count>0&&RemainingFronts(a).All(f=>RemainingSource(a,f))),originalMatches=arts.Length>0&&arts.All(a=>a.UsesOriginalPixels==fixture.original), densityMatches=arts.Length>0&&arts.All(a=>a.Fronts.Count>0&&RemainingFronts(a).All(f=>f&&RemainingDensity(a,f)))}; foreach(var art in arts){var row=RemainingComponent(art);room.components.Add(row);if(row.rear)room.rearComponents++;else{room.newBankComponents++;if(row.moving)room.movingBankComponents++;}} evidence.rooms.Add(room);File.WriteAllText(Path.Combine(folder,room.fixtureSave),JsonUtility.ToJson(g.Save.Data,true)); CheckResult("Current room has its declared source, provenance and world-units per pixel / "+fixture.key, room.sourceMatches&&room.originalMatches&&room.densityMatches&&room.newBankComponents>0, "source="+fixture.resource+", usesOriginalPixels="+fixture.original+", banks="+room.newBankComponents+", moving="+room.movingBankComponents+", rear="+room.rearComponents); if(arts.Length==0)continue; var banks=arts.Select(RemainingSupport).Where(b=>b&&b.enabled&&!b.isTrigger&&b.gameObject.layer==6).Distinct().ToArray(); var fixedBanks=banks.Where(b=>!b.GetComponent()).OrderBy(b=>b.bounds.max.y).ThenBy(b=>b.bounds.center.x).ToArray(); var captures=new List<(BoxCollider2D bank,string suffix)>(); if(fixture.key=="archive-evening-comparison") { captures.Add((ArchiveMemoryWorld.I.EveningPassage.FlankBank,"flank-background-comparison")); captures.Add((ArchiveMemoryWorld.I.EveningPassage.FinishBank,"upper-background-comparison")); } else { if(fixedBanks.Length>0)captures.Add((fixedBanks[0],"lower-fixed")); if(fixedBanks.Length>1)captures.Add((fixedBanks[fixedBanks.Length-1],"upper-fixed")); int moving=0;foreach(var bank in banks.Where(b=>b.GetComponent()))captures.Add((bank,"moving-"+(++moving))); int rearIndex=0;foreach(var rear in arts.Where(a=>!RemainingSupport(a))) { if(banks.Length==0||rear.Fronts.Count==0)continue; Vector2 paintedCenter=rear.Fronts[0].bounds.center; var near=banks.OrderBy(b=>Vector2.Distance(b.bounds.center,paintedCenter)).First(); captures.Add((near,"rear-cornice-context-"+(++rearIndex))); } } CheckResult("Current room exposes at least one real picture fixture / "+fixture.key,captures.Count>0); foreach(var capture in captures)yield return RemainingCapture(evidence,graphics,fixture,arts,capture.bank,capture.suffix); } CheckResult("All 23 declared locations have 15 original and 8 dedicated provenance entries",evidence.rooms.Count==23&&evidence.rooms.Count(r=>r.originalExpected)==15&&evidence.rooms.Count(r=>!r.originalExpected)==8&&evidence.rooms.All(r=>r.sourceMatches&&r.originalMatches&&r.densityMatches)); CheckResult("Every native room-art PNG has actual support, source and declared-density evidence",evidence.views.Count>=23&&evidence.views.All(v=>v.supported&&v.grounded&&v.fileWritten&&v.sourceMatches&&v.densityMatches)); File.WriteAllText(Path.Combine(folder,"remaining-room-art.json"),JsonUtility.ToJson(evidence,true)); File.WriteAllText(Path.Combine(folder,"graphics-survey.json"),JsonUtility.ToJson(graphics,true)); } } }