// WL813c_Probe.cs — #813 전투 패드 · 보스 HP 바 실측 덤프 (에디트 모드 · Play 불필요 · 저장하지 않는다)
// unity command run_script --file AgentScripts/WL813c_Probe.cs --entry WL813c_Probe.DumpPad (발주서 ⓑ · 부채꼴 좌표 + 미러 2회)
// unity command run_script --file AgentScripts/WL813c_Probe.cs --entry WL813c_Probe.DumpBossEvents (발주서 ⓒ · 가짜 이벤트 → 바 갱신)
// unity command run_script --file AgentScripts/WL813c_Probe.cs --entry WL813c_Probe.DumpPrefab (발주서 ⓓ · 저장된 프리팹 노드 상태)
// unity command run_script --file AgentScripts/WL813c_Probe.cs --entry WL813c_Probe.DumpOverride (발주서 ⓓ · WLIngameUiOverride 대상 경로 회귀)
// 덤프는 Logs/WL813c_probe_*.txt 에도 남긴다(콘솔 잘림 대비).
using System.IO;
using System.Text;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.UI;
public static class WL813c_Probe
{
// run_script 는 파일마다 독립 어셈블리로 컴파일된다 — WL813c_Apply 의 상수를 참조할 수 없어 여기 다시 둔다(값 동일).
public const string NewGameUIPath = "Assets/Res_Addr/MainUI/NewGameUI.prefab";
public const string PadPath = "IngameUIs/BattleUI";
public const string HudPath = "IngameUIs/WL_HUD";
public const string BossBarName = "WL_BossHpBar";
const string LogDir = "Logs";
static string Save(string name, string body)
{
Directory.CreateDirectory(LogDir);
var path = Path.Combine(LogDir, "WL813c_probe_" + name + ".txt");
File.WriteAllText(path, body, new System.Text.UTF8Encoding(false));
return body + "\n(저장: " + path + ")";
}
static Transform FindByPath(Transform root, string path)
{
var cur = root;
foreach (var part in path.Split('/'))
{
Transform next = null;
for (int i = 0; i < cur.childCount; i++)
if (cur.GetChild(i).name == part) { next = cur.GetChild(i); break; }
if (next == null) return null;
cur = next;
}
return cur;
}
/// 발주서 ⓑ — 실제 NewGameUI 프리팹 계층에서 배치를 적용하고 좌표를 덤프한다(저장 안 함 · 미러 2회).
public static object DumpPad()
{
var sb = new StringBuilder();
var s = WL.UI.WLHudLayoutSettings.Instance;
if (s == null) return "🔴 WLHudLayoutSettings 없음";
bool origMirror = s.mirrorLeftHanded;
var root = PrefabUtility.LoadPrefabContents(NewGameUIPath);
try
{
var pad = FindByPath(root.transform, PadPath);
if (pad == null) return "🔴 " + PadPath + " 없음";
var layout = pad.GetComponent();
if (layout == null) return "🔴 WLBattlePadLayout 없음 — Apply 먼저";
var canvas = pad.GetComponentInParent