using System; using BlockOutReplica.Domain; using BlockOutReplica.Gameplay; using BlockOutReplica.Infrastructure; using UnityEditor; using UnityEngine; namespace BlockOutReplica.Editor { public sealed class FirstTwentyPreviewWindow : EditorWindow { [MenuItem("Block Out/Play Original Levels 1-20")] public static void StartPreview() { var game=UnityEngine.Object.FindObjectOfType(); if(!Application.isPlaying||game==null) { Debug.LogWarning("Enter Play Mode in Prototype scene first."); return; } game.BeginFirstTwentyPreview(); ShowSelector(); } [MenuItem("Block Out/First 20 Level Selector")] public static void ShowSelector() => GetWindow("First 20 Levels"); private void OnGUI() { var game=UnityEngine.Object.FindObjectOfType(); EditorGUILayout.HelpBox("Original default LevelsConfig • 1–20\nSeparate temporary preview; formal progress/wallet unchanged.\nArrow keys also change levels. Stop Play Mode restores formal saves.",MessageType.Info); using(new EditorGUI.DisabledScope(!Application.isPlaying||game==null)) { for(int row=0;row<4;row++) { EditorGUILayout.BeginHorizontal(); for(int col=0;col<5;col++) { int n=row*5+col+1; var entry=OriginalLevelSettings.All[n-1]; string difficulty=entry.isSuperHard?" SH":entry.isHard?" H":""; if(GUILayout.Button($"{n}{difficulty}\n{entry.levelDuration}s",GUILayout.Height(44)))game.SelectFirstTwentyPreviewLevel(n); } EditorGUILayout.EndHorizontal(); } if(GUILayout.Button("Restart preview at Level 1"))game.BeginFirstTwentyPreview(); if(GUILayout.Button("Restore formal progress"))game.RestoreFullLoopSandbox(); } } [MenuItem("Block Out/Validate Original First 20 Configs")] public static void ValidateConfigs() { var flow=OriginalFlowRepository.Load();int checks=0; for(int i=0;i<20;i++) { var settings=OriginalLevelSettings.All[i]; if(settings.levelIndex!=i+1||settings.seedId!=$"t238-level-{i+1}"||flow.LevelIds[i]!=settings.seedId) throw new InvalidOperationException("Wrong sequence at "+(i+1)); var level=OriginalLevelRepository.Load(settings.seedId); if(level.Pieces.Count==0||level.Doors.Count==0||settings.levelDuration<=0) throw new InvalidOperationException("Incomplete level "+(i+1)); checks+=3; } var preview=new BlockOutProgress(new BlockOutFlowDefinition(new System.Collections.Generic.List(System.Linq.Enumerable.Take(flow.LevelIds,20)),4,10),false,1); for(int i=1;i<=20;i++) { if(preview.LevelNumber!=i)throw new InvalidOperationException("Progress mismatch "+i); preview.CompleteLevel();checks++; } if(!preview.CatalogCompleted||preview.LevelNumber!=20||preview.CompleteLevel())throw new InvalidOperationException("Preview terminal failed"); Debug.Log($"BLOCKOUT_FIRST20_CONFIGS: passed=True, checks={checks+1}, terminal=20, persistentSavesUntouched=True"); } } }