feat: 입고 PDA UI (UI Toolkit) — 보류 작업물 정리
캐릭터-first 전환 전에 만든 PDA/창고 UI 작업물을 히스토리에 보존. - InboundPda.uxml/.uss/.tss + InboundPanelSettings - InboundUIController: 단계별 렌더링 + 입력 위임 - InboundSceneSetup: UIDocument/PanelSettings 자동 와이어링 씬에는 비활성 상태로 존재. 추후 입고 로직 재연결 시 재사용 가능. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using SinoWms.Inbound;
|
||||
using SinoWms.UI;
|
||||
|
||||
namespace SinoWms.EditorTools
|
||||
{
|
||||
/// <summary>
|
||||
/// 입고 UI 씬을 한 번에 구성한다(런타임 UI Toolkit 와이어링 자동화).
|
||||
/// 메뉴 <b>SinoWMS/Setup Inbound Scene</b> 실행 후 Play 하면 PDA 미션이 뜬다.
|
||||
/// </summary>
|
||||
public static class InboundSceneSetup
|
||||
{
|
||||
private const string UiDir = "Assets/UI";
|
||||
private const string ThemePath = UiDir + "/InboundRuntimeTheme.tss";
|
||||
private const string UxmlPath = UiDir + "/InboundPda.uxml";
|
||||
private const string UssPath = UiDir + "/InboundPda.uss";
|
||||
private const string PanelSettingsPath = UiDir + "/InboundPanelSettings.asset";
|
||||
|
||||
[MenuItem("SinoWMS/Setup Inbound Scene")]
|
||||
public static void Setup()
|
||||
{
|
||||
var panelSettings = EnsurePanelSettings();
|
||||
if (panelSettings == null) return;
|
||||
|
||||
var uxml = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(UxmlPath);
|
||||
if (uxml == null)
|
||||
{
|
||||
Debug.LogError($"[InboundSceneSetup] UXML을 찾을 수 없습니다: {UxmlPath}");
|
||||
return;
|
||||
}
|
||||
|
||||
var go = GameObject.Find("InboundUI") ?? new GameObject("InboundUI");
|
||||
|
||||
var manager = go.GetComponent<InboundManager>() ?? go.AddComponent<InboundManager>();
|
||||
|
||||
var doc = go.GetComponent<UIDocument>() ?? go.AddComponent<UIDocument>();
|
||||
doc.panelSettings = panelSettings;
|
||||
doc.visualTreeAsset = uxml;
|
||||
|
||||
// 컨트롤러는 UIDocument 이후에 추가(RequireComponent 충족) + manager 연결
|
||||
var controller = go.GetComponent<InboundUIController>() ?? go.AddComponent<InboundUIController>();
|
||||
var styleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>(UssPath);
|
||||
if (styleSheet == null)
|
||||
Debug.LogWarning($"[InboundSceneSetup] USS를 찾을 수 없습니다: {UssPath}");
|
||||
var so = new SerializedObject(controller);
|
||||
so.FindProperty("manager").objectReferenceValue = manager;
|
||||
so.FindProperty("styleSheet").objectReferenceValue = styleSheet;
|
||||
so.ApplyModifiedProperties();
|
||||
|
||||
Selection.activeGameObject = go;
|
||||
EditorSceneManager.MarkSceneDirty(go.scene);
|
||||
Debug.Log("[InboundSceneSetup] 완료. 'InboundUI' 오브젝트 생성 → Play 하면 미션이 시작됩니다.");
|
||||
}
|
||||
|
||||
private static PanelSettings EnsurePanelSettings()
|
||||
{
|
||||
var existing = AssetDatabase.LoadAssetAtPath<PanelSettings>(PanelSettingsPath);
|
||||
if (existing != null) return existing;
|
||||
|
||||
var theme = AssetDatabase.LoadAssetAtPath<ThemeStyleSheet>(ThemePath);
|
||||
if (theme == null)
|
||||
{
|
||||
Debug.LogError($"[InboundSceneSetup] 런타임 테마를 찾을 수 없습니다: {ThemePath}");
|
||||
return null;
|
||||
}
|
||||
|
||||
var ps = ScriptableObject.CreateInstance<PanelSettings>();
|
||||
ps.themeStyleSheet = theme;
|
||||
AssetDatabase.CreateAsset(ps, PanelSettingsPath);
|
||||
AssetDatabase.SaveAssets();
|
||||
Debug.Log($"[InboundSceneSetup] PanelSettings 생성: {PanelSettingsPath}");
|
||||
return ps;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a169582dd1dc4035b39ac7c0635fadb
|
||||
Reference in New Issue
Block a user