Project_WL/AgentScripts/WL816j_Title.cs

76 lines
3.8 KiB
C#

// WL-816j — ⑧ 🔴 PD 실행 경로(타이틀 → 로그인 → 섬)를 실제로 타 본다.
// §9: 워커 세션은 Play 로그인 금지(PlayFab 중복 로그인) → 로그인 버튼을 누르지 않는다.
// 어디까지 갔는지만 정확히 기록한다.
using System.Collections;
using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;
public static class WL816j_Title
{
public static void Open()
{
UnityEditor.SceneManagement.EditorSceneManager.OpenScene(
"Assets/Scenes/Title.unity", UnityEditor.SceneManagement.OpenSceneMode.Single);
Debug.Log("[816j] Title 열림");
}
public static void Start()
{
var go = GameObject.Find("~WL816jTitle");
if (go != null) Object.DestroyImmediate(go);
go = new GameObject("~WL816jTitle");
go.AddComponent<WL816j_TitleRunner>();
}
}
public class WL816j_TitleRunner : MonoBehaviour
{
void Start() { StartCoroutine(Co()); }
IEnumerator Co()
{
var sb = new StringBuilder();
sb.AppendLine("=== WL-816j ⑧ PD 실행 경로(타이틀 → 로그인 → 섬) 시도 ===");
for (int t = 0; t < 4; t++)
{
yield return new WaitForSeconds(5f);
var names = "";
for (int i = 0; i < SceneManager.sceneCount; i++) names += SceneManager.GetSceneAt(i).name + " ";
sb.AppendLine((t * 5 + 5) + "초 : 활성씬=" + SceneManager.GetActiveScene().name + " · 로드된 씬 = " + names);
}
// 화면에 무엇이 떠 있나 (버튼 이름 전수 — 로그인 버튼은 누르지 않는다)
var btns = Object.FindObjectsByType<UnityEngine.UI.Button>(FindObjectsInactive.Exclude, FindObjectsSortMode.None);
var s = "";
foreach (var b in btns) if (b.gameObject.activeInHierarchy) s += b.name + "(" + (b.interactable ? "누를수있음" : "잠김") + ") ";
sb.AppendLine("보이는 버튼 = " + (s == "" ? "없음" : s));
var texts = Object.FindObjectsByType<TMPro.TMP_Text>(FindObjectsInactive.Exclude, FindObjectsSortMode.None);
var ts = "";
int n = 0;
foreach (var t2 in texts) if (t2.gameObject.activeInHierarchy && !string.IsNullOrWhiteSpace(t2.text) && n++ < 14) ts += "[" + t2.text.Replace("\n", " ") + "] ";
sb.AppendLine("보이는 글자 = " + ts);
Camera live = null;
foreach (var c in Object.FindObjectsByType<Camera>(FindObjectsInactive.Exclude, FindObjectsSortMode.None))
{
if (!c.gameObject.activeInHierarchy || !c.enabled || c.targetTexture != null) continue;
if (live == null || c.depth > live.depth) live = c;
}
if (live != null)
{
var rt = new RenderTexture(1080, 1920, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);
rt.Create(); var pA = RenderTexture.active;
live.targetTexture = rt; live.Render(); RenderTexture.active = rt;
var tex = new Texture2D(1080, 1920, TextureFormat.RGB24, false);
tex.ReadPixels(new Rect(0, 0, 1080, 1920), 0, 0); tex.Apply();
RenderTexture.active = pA; live.targetTexture = null; rt.Release(); Object.DestroyImmediate(rt);
System.IO.Directory.CreateDirectory("Screenshots_WL/WL816j");
System.IO.File.WriteAllBytes("Screenshots_WL/WL816j/p_title_attempt.png", tex.EncodeToPNG());
Object.DestroyImmediate(tex);
sb.AppendLine("캡처 = Screenshots_WL/WL816j/p_title_attempt.png (카메라 " + live.name + ")");
}
sb.AppendLine("🔴 여기서 멈춘다 — 로그인은 §9 로 금지(PlayFab 중복 로그인). 섬까지는 타지 못했다.");
System.IO.File.WriteAllText("AgentScripts/WL816j_TITLE.txt", sb.ToString());
Debug.Log("[816j title]\n" + sb);
}
}