using System.Collections.Generic; using AibisDream; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; using Yarn.Unity; using RainbowArt.CleanFlatUI; using System; public class ClueManager : MonoBehaviour { public GameObject punchTapecluePrefab; // 通用线索预制件 public GameObject imageCluePrefab; public Canvas canvas; // UI画布 private ClueInteraction currentClueInteraction; private GameObject currentClue; //public Notification FavouriteNotification; public Notification TopNotification; //public Notification ClueBoardNotification; ClueBaordNew clueBaord; // MouseCursorManager mouseManager; void Start() { clueBaord = FindObjectOfType(); } void Update() { if (Input.GetKeyDown(KeyCode.U)) { DialogController.Instance.StartDialogNode("AddAllClueToFavorites"); //GenerateUFClue("错误绘制","UFView","can_grass_error","绿色"); } // if(Input.GetKeyDown(KeyCode.M)) // { // GenerateMemoryClue("草地","MemoryView","liuying1-2","绿色"); // } // if(Input.GetKeyDown(KeyCode.V)) // { // GeneratePunchTape("植物","EyeView","天空","绿色"); // } // if(Input.GetKeyDown(KeyCode.E)) // { // GenerateImageClue("错误绘制","UFView","can_grass_error"); // } // if(Input.GetKeyDown(KeyCode.Keypad5)) // { // GeneratePunchTape("海报","EyeView","天空"); // } // if(Input.GetKeyDown(KeyCode.Keypad6)) // { // GeneratePunchTape("植物","EyeView","天空"); // } } public void GetPunchTape() { // 动态生成打孔带的数据 string category = "视觉"; string name = "sky"; //Sprite image = GetRandomPunchTapeSprite(); string memoryIndex = "blue"; // 实例化打孔带线索 PunchTape punchTape = new PunchTape(category, name, memoryIndex); GameObject clueGO = Instantiate(punchTapecluePrefab, canvas.transform); ClueItem clueItem = clueGO.GetComponent(); clueItem.Setup(punchTape); } //用于生成打孔带的函数 [YarnCommand("generate_PunchTape")] public void GeneratePunchTapeWindow(string clueName, string category, string memoryIndex, bool directlyAddToFavorites = false) { PunchTape punchTape = new PunchTape(category, clueName, memoryIndex); if (directlyAddToFavorites) { FavoritesManager.Instance.AddClue(punchTape); return; } GameObject clueGO = Instantiate(punchTapecluePrefab, canvas.transform); ClueItem clueItem = clueGO.GetComponent(); ClueInteraction clueInteraction = clueGO.GetComponent(); currentClue = clueGO; clueItem.Setup(punchTape); } [YarnCommand("CollectionClue")] public void EnabeClueInteraction(string nodeID = null) { if (nodeID != null) { //Debug.Log("收藏线索版成功!"); //clueBaord.CreateNode(nodeID); return; } // if(currentClue==null) // { // Debug.Log("收藏线索版成功!"); // clueBaord.CreateNode(nodeID); // return; // } ClueItem clueItem = currentClue.GetComponent(); Clue clue = clueItem.GetClueData(); ClueInteraction clueInteraction = currentClue.GetComponent(); if (clue.ClueType == ClueType.PunchTape) { FavoritesManager.Instance.AddClue(clueItem.GetClueData()); Destroy(currentClue.gameObject); Debug.Log("收藏文件夹成功!"); clueInteraction.isFavorited = true; currentClue = null; } else { Debug.Log("收藏线索版成功!"); //clueBaord.CreateNode(clue.ClueName); Destroy(currentClue.gameObject); currentClue = null; } } [YarnCommand("ShowNotification")] public void ShowNotification(string Title, string message) { TopNotification.TitleValue = Title; TopNotification.DescriptionValue = message; TopNotification.ShowNotification(); //currentClueInteraction.OnInteraction-=ShowFavouriteNotification; } }