using System.Collections; using System.Collections.Generic; using UnityEngine; using AibisDream; public class DialogueManager : MonoBehaviour { public static DialogueManager Instance { get; private set; } private bool isDragging = false; // 用于跟踪是否正在拖拽 private void Awake() { // 检查是否已有实例 if (Instance != null && Instance != this) { Destroy(gameObject); // 确保只有一个实例存在 return; } Instance = this; DontDestroyOnLoad(gameObject); // 防止在场景切换时销毁该对象 } public void OnInteractableHover(DialogueInteractable interactable, bool isHovering) { if (isDragging) return; // 如果正在拖拽,不进行光标更改 if (isHovering) { // 设置悬停光标 //MouseCursorManager.Instance.SetCursor(MouseCursorManager.Instance.dialogueCursor); } else { // 重置光标 //MouseCursorManager.Instance.ResetCursor(); } } public void TryTriggerDialogue(DialogueInteractable interactable) { if (isDragging) return; // 如果正在拖拽,不触发对话 // 构建对话节点名称:游戏对象名称 + "dialogue" string dialogueNode = interactable.gameObject.name + "Dialogue"; // 检查节点是否存在并触发对话 // if(DialogController.Instance.CheckIfNodeExistInCurrentYarnProject(dialogueNode)) // { // DialogController.Instance.StartDialogNode(dialogueNode); // } } public void SetDragging(bool dragging) { isDragging = dragging; // 设置拖拽状态 } }