using UnityEngine; using UnityEngine.UIElements; /// /// Simple UI controller for settlement interaction prompts /// Displays when near a settlement and shows interaction instructions /// public class SettlementInteractionUI : MonoBehaviour { [Header("UI References")] [Tooltip("UI Document for settlement interaction prompt")] public UIDocument uiDocument; [Header("UI Element Names")] [Tooltip("Name of the interaction prompt container in UXML")] public string promptContainerName = "SettlementPrompt"; [Tooltip("Name of the settlement name label in UXML")] public string settlementNameLabelName = "SettlementName"; [Tooltip("Name of the interaction instruction label in UXML")] public string instructionLabelName = "InteractionInstruction"; // UI Elements private VisualElement promptContainer; private Label settlementNameLabel; private Label instructionLabel; // References private SettlementInteractionManager interactionManager; void Start() { InitializeUI(); SetupEventListeners(); } /// /// Initialize UI elements /// private void InitializeUI() { if (uiDocument == null) { uiDocument = GetComponent(); } if (uiDocument == null) { Debug.LogError("SettlementInteractionUI: No UIDocument found!"); return; } var root = uiDocument.rootVisualElement; // Find UI elements promptContainer = root.Q(promptContainerName); settlementNameLabel = root.Q