using UnityEngine; using AibisDream.FixSystem; using Cinemachine; using AibisDream.Framework; using AibisDream.MiniGame.Language.MemoryDecryptor; namespace AibisDream.MiniGame.Language { /// /// 语言分析系统管理器 /// 独立的语言分析系统,包含记忆解密器等分析模式 /// 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(true); } // 注册相机 var virtualCam = transform.Find("Language Analysis Camera")?.GetComponent(); if (virtualCam != null) { CameraKit.Instance.RegisterCamera(CameraEnum.LanguageAnalysis, virtualCam); } var virtualCamDeep = transform.Find("Language Analysis Deep Camera")?.GetComponent(); if (virtualCamDeep != null) { CameraKit.Instance.RegisterCamera(CameraEnum.LanguageAnalysisDeep, virtualCamDeep); } } /// /// 打开语言分析视图 /// public void OpenView() { if (analysisView != null) { analysisView.SetActive(true); } } /// /// 关闭语言分析视图 /// public void CloseView() { if (analysisView != null) { analysisView.SetActive(false); } StopAllSystems(); } /// /// 停止所有分析系统 /// public void StopAllSystems() { if (memoryDecryptorMode != null) { memoryDecryptorMode.StopSystem(); } } #region 记忆解密器接口 /// /// 启动记忆解密器 /// public void StartMemoryDecryptor(string completionNodeName = null) { if (memoryDecryptorMode != null) { memoryDecryptorMode.StartSystem(completionNodeName); } else { Debug.LogWarning("[LanguageAnalysisManager] 记忆解密器未设置!"); } } /// /// 开始过滤 /// public void StartMemoryDecryptorFiltering() { if (memoryDecryptorMode != null) { memoryDecryptorMode.StartFiltering(); } } /// /// 设置频率 /// public void SetMemoryDecryptorFrequency(float frequency) { if (memoryDecryptorMode != null) { memoryDecryptorMode.SetFrequency(frequency); } } /// /// 检查匹配 /// public void CheckMemoryDecryptorMatch() { if (memoryDecryptorMode != null) { memoryDecryptorMode.CheckMatch(); } } #endregion private void OnDestroy() { CameraKit.Instance?.UnRegisterCamera(CameraEnum.LanguageAnalysis); CameraKit.Instance?.UnRegisterCamera(CameraEnum.LanguageAnalysisDeep); } } }