diff --git a/Assets/Scripts/Editor/InboundSceneSetup.cs b/Assets/Scripts/Editor/InboundSceneSetup.cs new file mode 100644 index 0000000..817a585 --- /dev/null +++ b/Assets/Scripts/Editor/InboundSceneSetup.cs @@ -0,0 +1,78 @@ +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.UIElements; +using SinoWms.Inbound; +using SinoWms.UI; + +namespace SinoWms.EditorTools +{ + /// + /// 입고 UI 씬을 한 번에 구성한다(런타임 UI Toolkit 와이어링 자동화). + /// 메뉴 SinoWMS/Setup Inbound Scene 실행 후 Play 하면 PDA 미션이 뜬다. + /// + 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(UxmlPath); + if (uxml == null) + { + Debug.LogError($"[InboundSceneSetup] UXML을 찾을 수 없습니다: {UxmlPath}"); + return; + } + + var go = GameObject.Find("InboundUI") ?? new GameObject("InboundUI"); + + var manager = go.GetComponent() ?? go.AddComponent(); + + var doc = go.GetComponent() ?? go.AddComponent(); + doc.panelSettings = panelSettings; + doc.visualTreeAsset = uxml; + + // 컨트롤러는 UIDocument 이후에 추가(RequireComponent 충족) + manager 연결 + var controller = go.GetComponent() ?? go.AddComponent(); + var styleSheet = AssetDatabase.LoadAssetAtPath(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(PanelSettingsPath); + if (existing != null) return existing; + + var theme = AssetDatabase.LoadAssetAtPath(ThemePath); + if (theme == null) + { + Debug.LogError($"[InboundSceneSetup] 런타임 테마를 찾을 수 없습니다: {ThemePath}"); + return null; + } + + var ps = ScriptableObject.CreateInstance(); + ps.themeStyleSheet = theme; + AssetDatabase.CreateAsset(ps, PanelSettingsPath); + AssetDatabase.SaveAssets(); + Debug.Log($"[InboundSceneSetup] PanelSettings 생성: {PanelSettingsPath}"); + return ps; + } + } +} diff --git a/Assets/Scripts/Editor/InboundSceneSetup.cs.meta b/Assets/Scripts/Editor/InboundSceneSetup.cs.meta new file mode 100644 index 0000000..65fd382 --- /dev/null +++ b/Assets/Scripts/Editor/InboundSceneSetup.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4a169582dd1dc4035b39ac7c0635fadb \ No newline at end of file diff --git a/Assets/Scripts/UI.meta b/Assets/Scripts/UI.meta new file mode 100644 index 0000000..3b7301c --- /dev/null +++ b/Assets/Scripts/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 09512757295aa4e849a36067192a5348 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/InboundUIController.cs b/Assets/Scripts/UI/InboundUIController.cs new file mode 100644 index 0000000..30ccaa6 --- /dev/null +++ b/Assets/Scripts/UI/InboundUIController.cs @@ -0,0 +1,419 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UIElements; +using SinoWms.Core; +using SinoWms.Data; +using SinoWms.Inbound; + +namespace SinoWms.UI +{ + /// + /// 입고 미션 PDA + 탑다운 창고 UI (UI Toolkit). + /// InboundManager의 이벤트를 구독해 단계별 화면을 다시 그리고, 입력을 매니저로 위임한다. + /// mockup/inbound_pda.html 의 화면 흐름을 그대로 옮긴 구현. + /// + [RequireComponent(typeof(UIDocument))] + public class InboundUIController : MonoBehaviour + { + [SerializeField] private InboundManager manager; + [SerializeField] private StyleSheet styleSheet; // UXML