109 lines
3.3 KiB
C#
109 lines
3.3 KiB
C#
using UnityEngine;
|
|
using Yarn.Unity;
|
|
using RainbowArt.CleanFlatUI;
|
|
using AibisDream.Framework;
|
|
|
|
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<ClueBaordNew>();
|
|
}
|
|
|
|
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>();
|
|
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<ClueItem>();
|
|
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<ClueItem>();
|
|
Clue clue = clueItem.GetClueData();
|
|
ClueInteraction clueInteraction = currentClue.GetComponent<ClueInteraction>();
|
|
|
|
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;
|
|
}
|
|
} |