112 lines
3.8 KiB
C#
112 lines
3.8 KiB
C#
using System.Collections.Generic;
|
|
using AibisDream;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using Yarn.Unity;
|
|
|
|
public class ClueManager : MonoBehaviour
|
|
{
|
|
public GameObject punchTapecluePrefab; // 通用线索预制件
|
|
|
|
public GameObject imageCluePrefab;
|
|
public Canvas canvas; // UI画布
|
|
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
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>();
|
|
clueItem.Setup(punchTape);
|
|
}
|
|
//用于生成打孔带的函数
|
|
[YarnCommand("generate_PunchTape")]
|
|
public void GeneratePunchTape(string clueName, string category, string memoryIndex,string mathCode=null,bool directlyAddToFavorites=false)
|
|
{
|
|
PunchTape punchTape = new PunchTape(category, clueName, memoryIndex,mathCode);
|
|
|
|
if(directlyAddToFavorites)
|
|
{
|
|
FavoritesManager.Instance.AddClue(punchTape);
|
|
return;
|
|
}
|
|
GameObject clueGO = Instantiate(punchTapecluePrefab, canvas.transform);
|
|
|
|
ClueItem clueItem = clueGO.GetComponent<ClueItem>();
|
|
clueItem.Setup(punchTape);
|
|
}
|
|
[YarnCommand("generate_UFClue")]
|
|
public void GenerateUFClue(string clueName, string imageName,string mathCode,bool directlyAddToFavorites=false)
|
|
{
|
|
Sprite UFSprite = Resources.Load<Sprite>("Art/Photos/" + imageName);
|
|
ImageClue imageClue=new ImageClue("UFView", clueName, UFSprite,mathCode);
|
|
if(directlyAddToFavorites)
|
|
{
|
|
FavoritesManager.Instance.AddClue(imageClue);
|
|
return;
|
|
}
|
|
GameObject clueGO = Instantiate(imageCluePrefab, canvas.transform);
|
|
ClueItem clueItem = clueGO.GetComponent<ClueItem>();
|
|
clueItem.Setup(imageClue);
|
|
}
|
|
[YarnCommand("generate_MemoryClue")]
|
|
public void GenerateMemoryClue(string clueName, string imageName,string mathCode,bool directlyAddToFavorites=false)
|
|
{
|
|
Sprite UFSprite = Resources.Load<Sprite>("Art/Memory/" + imageName);
|
|
ImageClue imageClue=new ImageClue("MemoryView", clueName, UFSprite,mathCode);
|
|
if(directlyAddToFavorites)
|
|
{
|
|
FavoritesManager.Instance.AddClue(imageClue);
|
|
return;
|
|
}
|
|
GameObject clueGO = Instantiate(imageCluePrefab, canvas.transform);
|
|
ClueItem clueItem = clueGO.GetComponent<ClueItem>();
|
|
clueItem.Setup(imageClue);
|
|
}
|
|
|
|
|
|
}
|