using System; using System.IO; using System.Linq; using Newtonsoft.Json; using UnityEditor; using UnityEngine; /// Read-only inspection for reproducible audio review; never edits production assets. public static class ReviewAudioMix { public static string Recovery() { var scenes=Enumerable.Range(0,UnityEngine.SceneManagement.SceneManager.sceneCount).Select(i=>UnityEngine.SceneManagement.SceneManager.GetSceneAt(i)).ToArray(); if(EditorApplication.isPlaying||scenes.Length!=1||scenes[0].path!="Assets/Scenes/Boot.unity"||scenes[0].isDirty)throw new Exception("Original clean Boot edit state not restored"); var result=new{status="pass",utc=DateTime.UtcNow.ToString("o"),playing=EditorApplication.isPlaying,scenes=scenes.Select(s=>new{s.path,s.isDirty}), sfx=HotUpdate.Gameplay.PrototypeClientPrefs.Sfx,music=HotUpdate.Gameplay.PrototypeClientPrefs.Music, preferenceBaseline="Original SFX value was held in the interrupted task; exact pre-capture preference could not be reverified after restart", audio=AudioSettings.GetConfiguration(),temporaryReviewObjects=UnityEngine.Object.FindObjectsOfType().Count(g=>g.name.Contains("MixReview"))}; string folder=Path.GetFullPath(Path.Combine(Application.dataPath,"../../Doc/Design/Sound/MixReview"));Directory.CreateDirectory(folder); string json=JsonConvert.SerializeObject(result,Formatting.Indented);File.WriteAllText(Path.Combine(folder,"unity_recovery.json"),json);return json; } public static string Snapshot() { var skill=AssetDatabase.LoadAssetAtPath("Assets/Bundles/Combat/BattleSkillPresentation.prefab"); var enemy=AssetDatabase.LoadAssetAtPath("Assets/Bundles/Effects/EnemyCombat/EnemyCombatPresentation.prefab"); var ui=AssetDatabase.LoadAssetAtPath("Assets/Bundles/Sound/Prefab/UiSfx.prefab"); var music=AssetDatabase.LoadAssetAtPath("Assets/Bundles/Sound/Prefab/MainMenuMusic.prefab"); Func sources=g=>g.GetComponentsInChildren(true).Select(s=>(object)new {s.name,s.volume,s.pitch,s.spatialBlend,s.loop,clip=AssetDatabase.GetAssetPath(s.clip)}).ToArray(); var so=new SerializedObject(enemy.GetComponent()); var result=new{status="pass",utc=DateTime.UtcNow.ToString("o"),skill=sources(skill),enemy=sources(enemy),ui=sources(ui),music=sources(music), enemyMixBudget=so.FindProperty("_mixBudget").floatValue,enemyVoiceVolume=so.FindProperty("_voiceVolume").floatValue, audio=AudioSettings.GetConfiguration(),listenerVolume=AudioListener.volume, subjectivelyApproved=false,accountWrites=false}; string folder=Path.GetFullPath(Path.Combine(Application.dataPath,"../../Doc/Design/Sound/MixReview"));Directory.CreateDirectory(folder); string json=JsonConvert.SerializeObject(result,Formatting.Indented);File.WriteAllText(Path.Combine(folder,"unity_snapshot.json"),json);return json; } }