152 lines
4.1 KiB
C#
152 lines
4.1 KiB
C#
using UnityEngine;
|
|
using AibisDream.FixSystem;
|
|
using Cinemachine;
|
|
using AibisDream.Framework;
|
|
using AibisDream.MiniGame.Language.MemoryDecryptor;
|
|
|
|
namespace AibisDream.MiniGame.Language
|
|
{
|
|
/// <summary>
|
|
/// 语言分析系统管理器
|
|
/// 独立的语言分析系统,包含记忆解密器等分析模式
|
|
/// </summary>
|
|
public class LanguageAnalysisManager : MonoBehaviour
|
|
{
|
|
[Header("系统视图")]
|
|
[SerializeField] private GameObject analysisView;
|
|
|
|
[Header("记忆解密器组件")]
|
|
private MemoryDecryptorMode memoryDecryptorMode;
|
|
|
|
void Start()
|
|
{
|
|
// 注册到系统字典
|
|
FixSystemCenter.SystemDic.Register(this);
|
|
|
|
// 查找视图
|
|
if (analysisView == null)
|
|
{
|
|
analysisView = transform.Find("Language Analysis View")?.gameObject;
|
|
}
|
|
|
|
if (analysisView != null)
|
|
{
|
|
analysisView.SetActive(false);
|
|
}
|
|
|
|
// 查找记忆解密器
|
|
if (memoryDecryptorMode == null)
|
|
{
|
|
memoryDecryptorMode = GetComponentInChildren<MemoryDecryptorMode>(true);
|
|
}
|
|
|
|
// 注册相机
|
|
var virtualCam = transform.Find("Language Analysis Camera")?.GetComponent<ICinemachineCamera>();
|
|
if (virtualCam != null)
|
|
{
|
|
CameraKit.Instance.RegisterCamera(CameraEnum.LanguageAnalysis, virtualCam);
|
|
}
|
|
|
|
var virtualCamDeep = transform.Find("Language Analysis Deep Camera")?.GetComponent<ICinemachineCamera>();
|
|
if (virtualCamDeep != null)
|
|
{
|
|
CameraKit.Instance.RegisterCamera(CameraEnum.LanguageAnalysisDeep, virtualCamDeep);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开语言分析视图
|
|
/// </summary>
|
|
public void OpenView()
|
|
{
|
|
if (analysisView != null)
|
|
{
|
|
analysisView.SetActive(true);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭语言分析视图
|
|
/// </summary>
|
|
public void CloseView()
|
|
{
|
|
if (analysisView != null)
|
|
{
|
|
analysisView.SetActive(false);
|
|
}
|
|
|
|
StopAllSystems();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 停止所有分析系统
|
|
/// </summary>
|
|
public void StopAllSystems()
|
|
{
|
|
if (memoryDecryptorMode != null)
|
|
{
|
|
memoryDecryptorMode.StopSystem();
|
|
}
|
|
}
|
|
|
|
#region 记忆解密器接口
|
|
|
|
/// <summary>
|
|
/// 启动记忆解密器
|
|
/// </summary>
|
|
public void StartMemoryDecryptor(string completionNodeName = null)
|
|
{
|
|
if (memoryDecryptorMode != null)
|
|
{
|
|
memoryDecryptorMode.StartSystem(completionNodeName);
|
|
}
|
|
else
|
|
{
|
|
Debug.LogWarning("[LanguageAnalysisManager] 记忆解密器未设置!");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 开始过滤
|
|
/// </summary>
|
|
public void StartMemoryDecryptorFiltering()
|
|
{
|
|
if (memoryDecryptorMode != null)
|
|
{
|
|
memoryDecryptorMode.StartFiltering();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置频率
|
|
/// </summary>
|
|
public void SetMemoryDecryptorFrequency(float frequency)
|
|
{
|
|
if (memoryDecryptorMode != null)
|
|
{
|
|
memoryDecryptorMode.SetFrequency(frequency);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检查匹配
|
|
/// </summary>
|
|
public void CheckMemoryDecryptorMatch()
|
|
{
|
|
if (memoryDecryptorMode != null)
|
|
{
|
|
memoryDecryptorMode.CheckMatch();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
private void OnDestroy()
|
|
{
|
|
CameraKit.Instance?.UnRegisterCamera(CameraEnum.LanguageAnalysis);
|
|
CameraKit.Instance?.UnRegisterCamera(CameraEnum.LanguageAnalysisDeep);
|
|
}
|
|
}
|
|
}
|
|
|