feat: 添加 BubbleSlotKit 与 VirtualCamRegistry 集中管理气泡槽位和虚拟相机
This commit is contained in:
@@ -3,9 +3,8 @@ using UnityEngine;
|
||||
using DG.Tweening;
|
||||
using Yarn.Unity;
|
||||
using AibisDream.Framework;
|
||||
using Cinemachine;
|
||||
using UnityEngine.Rendering;
|
||||
using AibisDream.Kit;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
@@ -18,8 +17,6 @@ namespace AibisDream.FixSystem
|
||||
private const float SearchStartDelay = 1f;
|
||||
private const float ProjectorMoveDuration = 2f;
|
||||
|
||||
[SerializeField] private BubbleSlotGroup bubbleSlotGroup;
|
||||
public BubbleSlotGroup BubbleSlotGroup => bubbleSlotGroup;
|
||||
[SerializeField] private GameObject memoryView;
|
||||
[SerializeField] private GameObject projector;
|
||||
[SerializeField] private SpriteRenderer memoryFinishedSpriteRenderer; // 用于显示记忆处理结束的表现
|
||||
@@ -35,7 +32,6 @@ namespace AibisDream.FixSystem
|
||||
[SerializeField] private CanvasGroup playBackground;
|
||||
|
||||
[SerializeField] private GameObject memoryGroup;
|
||||
[SerializeField] private CinemachineVirtualCamera memoryCamera;
|
||||
|
||||
private bool isProcessing = false; // 新增变量来追踪是否正在处理记忆
|
||||
private bool isPlayingFaderSound = false; // 追踪音效是否正在播放
|
||||
@@ -140,8 +136,6 @@ namespace AibisDream.FixSystem
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
if (memoryGroup != null)
|
||||
memoryGroup.SetActive(false);
|
||||
if (memoryCamera != null)
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.Memory, memoryCamera);
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +209,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
/// <summary>
|
||||
/// 单条记忆播放结束后的复位:不调用 <see cref="MemorySlider.Init"/>(避免再次锁条并触发打开 Timeline),
|
||||
/// 仅禁用拖动;完整 <see cref="MemorySlider.LockSlider"/> 仅在退出 <see cref="MemoryState"/> 时 <see cref="OnExit"/> 执行。
|
||||
/// 仅禁用拖动;完整 <see cref="MemorySlider.LockSlider"/> 仅在退出 <see cref="MemoryCue"/> 时 <see cref="OnExit"/> 执行。
|
||||
/// </summary>
|
||||
private void ResetAfterMemoryFinished()
|
||||
{
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AibisDream.Framework;
|
||||
using Cinemachine;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEngine;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.SaveSystem;
|
||||
|
||||
@@ -74,16 +73,11 @@ namespace AibisDream.FixSystem
|
||||
|
||||
// 注册到维修系统管理器
|
||||
RepairSystemManager.Register(this);
|
||||
|
||||
// 注册Camera
|
||||
var virtualCam2 = transform.Find("Body Module Camera Center").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.BodyModuleCenter, virtualCam2);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
DeepRepairDataRegistry.UnregisterData<ModuleSystemData>();
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.BodyModuleCenter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using UnityEngine;
|
||||
using AibisDream.FixSystem;
|
||||
using Cinemachine;
|
||||
using AibisDream.Framework;
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using AibisDream.Kit;
|
||||
@@ -10,7 +9,6 @@ namespace AibisDream
|
||||
{
|
||||
public class CuttingManager : MonoBehaviour
|
||||
{
|
||||
public BubbleSlotGroup bubbleSlotGroup;
|
||||
[Header("切割组件")]
|
||||
public GameObject gearFollowerPrefab;
|
||||
public GameObject entrancePanelPrefab; // 入场面板预制体
|
||||
@@ -30,21 +28,7 @@ namespace AibisDream
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// 注册
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
var virtualCam1 = transform.Find("Cut Emo Camera").GetComponent<ICinemachineCamera>();
|
||||
var virtualCam2 = transform.Find("Cut Memory Camera").GetComponent<ICinemachineCamera>();
|
||||
var virtualCam3 = transform.Find("Cut Logic Camera").GetComponent<ICinemachineCamera>();
|
||||
var virtualCam4 = transform.Find("Cut Emo Deep Camera").GetComponent<ICinemachineCamera>();
|
||||
var virtualCam5 = transform.Find("Cut Memory Deep Camera").GetComponent<ICinemachineCamera>();
|
||||
var virtualCam6 = transform.Find("Cut Logic Deep Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.CutEmo, virtualCam1);
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.CutMemory, virtualCam2);
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.CutLogic, virtualCam3);
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.CutEmoDeep, virtualCam4);
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.CutMemoryDeep, virtualCam5);
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.CutLogicDeep, virtualCam6);
|
||||
|
||||
_mainCamera = Camera.main;
|
||||
}
|
||||
|
||||
@@ -311,17 +295,8 @@ namespace AibisDream
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
// 从系统字典中注销
|
||||
FixSystemCenter.SystemDic.Unregister<CuttingManager>();
|
||||
|
||||
// 清理相机注册
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.CutEmo);
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.CutMemory);
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.CutLogic);
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.CutEmoDeep);
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.CutMemoryDeep);
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.CutLogicDeep);
|
||||
|
||||
// 强制清理所有相关对象
|
||||
if (gearFollower != null)
|
||||
{
|
||||
|
||||
@@ -1,28 +1,18 @@
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using Cinemachine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class ClinicSystem : MonoBehaviour
|
||||
{
|
||||
[HideInInspector] public BubbleSlotGroup bubbleSlotGroup;
|
||||
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
bubbleSlotGroup = transform.Find("Bubble Slot Group").GetComponent<BubbleSlotGroup>();
|
||||
|
||||
// 注册Camera
|
||||
var clinicCam = transform.Find("Clinic Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.Clinic, clinicCam);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Unregister<ClinicSystem>();
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.Clinic);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using Yarn.Unity;
|
||||
@@ -18,18 +16,9 @@ namespace AibisDream
|
||||
|
||||
public SpriteRenderer dreamSprite;
|
||||
|
||||
public BubbleSlotGroup bubbleSlotGroup;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// 注册
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
var virtualCam = transform.Find("Op Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.Op, virtualCam);
|
||||
var breakCam = transform.Find("Break Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.BreakCamera, breakCam);
|
||||
var dreamCam = transform.Find("Dream Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.DreamCamera, dreamCam);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using UnityEngine;
|
||||
using Cinemachine;
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
|
||||
@@ -127,13 +126,6 @@ namespace AibisDream.FixSystem
|
||||
#endregion
|
||||
|
||||
#region 屏幕相关操作
|
||||
[Header("默认相机")]
|
||||
[SerializeField] private CinemachineVirtualCamera fixPanelCamera;
|
||||
|
||||
[Header("默认气泡")]
|
||||
[SerializeField] private BubbleSlotGroup bubbleSlotGroup;
|
||||
public BubbleSlotGroup BubbleSlotGroup => bubbleSlotGroup;
|
||||
|
||||
[Header("默认画布")]
|
||||
[SerializeField] private Canvas canvas;
|
||||
|
||||
@@ -150,17 +142,12 @@ namespace AibisDream.FixSystem
|
||||
|
||||
private void RegisterScreenView()
|
||||
{
|
||||
// 注册相机
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.BodyModule, fixPanelCamera);
|
||||
|
||||
DialogUIManager.Instance.RegisterScreenView(DialogViewType.Screen, screenPanel);
|
||||
DialogUIManager.Instance.RegisterScreenView(DialogViewType.Task, taskPanel);
|
||||
}
|
||||
|
||||
private void UnRegisterScreenView()
|
||||
{
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.BodyModule);
|
||||
|
||||
DialogUIManager.Instance.UnRegisterScreenView(DialogViewType.Screen);
|
||||
DialogUIManager.Instance.UnRegisterScreenView(DialogViewType.Task);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
using System.Collections.Generic;
|
||||
using AibisDream.Kit;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.Framework
|
||||
{
|
||||
public class BubbleSlotKit : Singleton<BubbleSlotKit>
|
||||
{
|
||||
private readonly Dictionary<BubbleSlotEnum, BubbleSlotGroup> _slotDict = new();
|
||||
|
||||
private BubbleSlotKit()
|
||||
{
|
||||
}
|
||||
|
||||
public void Register(BubbleSlotEnum slotType, BubbleSlotGroup group)
|
||||
{
|
||||
if (slotType == BubbleSlotEnum.Default)
|
||||
{
|
||||
Debug.LogWarning("[BubbleSlotKit] 不能注册 Default 类型的气泡槽组。");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_slotDict.TryGetValue(slotType, out var existing) && existing != null && existing != group)
|
||||
{
|
||||
Debug.LogWarning(
|
||||
$"[BubbleSlotKit] {slotType} 已被 \"{existing.name}\" 注册,将被 \"{group.name}\" 覆盖");
|
||||
}
|
||||
|
||||
_slotDict[slotType] = group;
|
||||
}
|
||||
|
||||
public void Unregister(BubbleSlotEnum slotType)
|
||||
{
|
||||
_slotDict.Remove(slotType);
|
||||
}
|
||||
|
||||
public void RemoveAll()
|
||||
{
|
||||
_slotDict.Clear();
|
||||
}
|
||||
|
||||
public bool TryGet(BubbleSlotEnum slotType, out BubbleSlotGroup group)
|
||||
{
|
||||
if (_slotDict.TryGetValue(slotType, out group) && group != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
group = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public BubbleSlotGroupData CollectData(BubbleSlotEnum slotType)
|
||||
{
|
||||
if (!TryGet(slotType, out var group))
|
||||
{
|
||||
Debug.LogWarning($"[BubbleSlotKit] CollectData: {slotType} 气泡槽组未注册");
|
||||
return default;
|
||||
}
|
||||
|
||||
return group.CollectData();
|
||||
}
|
||||
|
||||
public void LoadBubbles(BubbleSlotEnum slotType)
|
||||
{
|
||||
if (!TryGet(slotType, out var group))
|
||||
{
|
||||
Debug.LogWarning($"[BubbleSlotKit] LoadBubbles: {slotType} 气泡槽组未注册");
|
||||
return;
|
||||
}
|
||||
|
||||
DialogUIManager.Instance.LoadBubbles(group.CollectData());
|
||||
}
|
||||
}
|
||||
|
||||
public enum BubbleSlotEnum
|
||||
{
|
||||
Default,
|
||||
Clinic,
|
||||
BodyModule,
|
||||
Memory,
|
||||
Eye,
|
||||
Cut,
|
||||
Open,
|
||||
Sales,
|
||||
Subway,
|
||||
SubwayTV,
|
||||
Outside,
|
||||
Tarot,
|
||||
Emo,
|
||||
Expression,
|
||||
Analysis
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8f3c2e1b94d4f6a9e7d5c3b2a10876f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -93,6 +93,18 @@ namespace AibisDream.Framework
|
||||
|
||||
public void RegisterCamera(CameraEnum camType, ICinemachineCamera virtualCamera)
|
||||
{
|
||||
if (_virtualCameraDict.TryGetValue(camType, out var existing) && existing != virtualCamera)
|
||||
{
|
||||
var existingName = existing?.VirtualCameraGameObject != null
|
||||
? existing.VirtualCameraGameObject.name
|
||||
: "unknown";
|
||||
var newName = virtualCamera?.VirtualCameraGameObject != null
|
||||
? virtualCamera.VirtualCameraGameObject.name
|
||||
: "unknown";
|
||||
Debug.LogWarning(
|
||||
$"RegisterCamera: {camType} 已被 \"{existingName}\" 注册,将被 \"{newName}\" 覆盖");
|
||||
}
|
||||
|
||||
_virtualCameraDict[camType] = virtualCamera;
|
||||
|
||||
var vcam = virtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVirtualCamera>();
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using Cinemachine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.Framework
|
||||
{
|
||||
[RequireComponent(typeof(CinemachineVirtualCamera))]
|
||||
public class VirtualCamRegistry : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private CameraEnum cameraType;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (cameraType == CameraEnum.Default)
|
||||
{
|
||||
Debug.LogWarning($"[{nameof(VirtualCamRegistry)}] cameraType 不能为 Default,请在 Inspector 配置。", this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryGetComponent<ICinemachineCamera>(out var virtualCam))
|
||||
{
|
||||
Debug.LogWarning($"[{nameof(VirtualCamRegistry)}] 未找到 ICinemachineCamera 组件。", this);
|
||||
return;
|
||||
}
|
||||
|
||||
CameraKit.Instance.RegisterCamera(cameraType, virtualCam);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (cameraType == CameraEnum.Default)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CameraKit.Instance?.UnRegisterCamera(cameraType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7432789ba6bd1a340b824676e1e56184
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -6,8 +6,6 @@ using System.Linq;
|
||||
using DG.Tweening;
|
||||
using Shapes;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using Cinemachine;
|
||||
|
||||
namespace AibisDream.MiniGame.Language
|
||||
{
|
||||
@@ -137,7 +135,6 @@ namespace AibisDream.MiniGame.Language
|
||||
/// </summary>
|
||||
public class AnalysisModeManager : MonoBehaviour
|
||||
{
|
||||
public BubbleSlotGroup bubbleSlotGroup;
|
||||
[Header("Canvas 引用(共享)")]
|
||||
[SerializeField] private Canvas sharedCanvas; // 共享 LanguageParticleManager 的 canvas
|
||||
|
||||
@@ -225,25 +222,10 @@ namespace AibisDream.MiniGame.Language
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// 注册到系统字典
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
|
||||
// 注册相机
|
||||
var virtualCam = transform.Find("Analysis Camera")?.GetComponent<ICinemachineCamera>();
|
||||
if (virtualCam != null)
|
||||
{
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.AnalysisMode, virtualCam);
|
||||
}
|
||||
|
||||
SetupUI();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
CameraKit.Instance?.UnRegisterCamera(CameraEnum.AnalysisMode);
|
||||
CameraKit.Instance?.UnRegisterCamera(CameraEnum.AnalysisModeDeep);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进入分析模式(由状态机调用)
|
||||
/// </summary>
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
using UnityEngine;
|
||||
using AibisDream.FixSystem;
|
||||
using Cinemachine;
|
||||
using AibisDream.Framework;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class EmoManager : MonoBehaviour
|
||||
{
|
||||
public BubbleSlotGroup bubbleSlotGroup;
|
||||
private GameObject emoView;
|
||||
|
||||
void Start()
|
||||
@@ -15,10 +12,6 @@ namespace AibisDream
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
emoView = transform.Find("Emo View").gameObject;
|
||||
emoView.SetActive(false);
|
||||
var virtualCam = transform.Find("Emo Camera").GetComponent<ICinemachineCamera>();
|
||||
var virtualCam2 = transform.Find("Emo Deep Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.Emo, virtualCam);
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.EmoDeep, virtualCam2);
|
||||
}
|
||||
|
||||
public void OpenView()
|
||||
|
||||
@@ -2,8 +2,6 @@ using System.Collections;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using AibisDream.FixSystem;
|
||||
using Cinemachine;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.MiniGame.Language;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -14,7 +12,6 @@ namespace AibisDream
|
||||
/// </summary>
|
||||
public class ExpressionManager : MonoBehaviour
|
||||
{
|
||||
public BubbleSlotGroup bubbleSlotGroup;
|
||||
[Header("系统组件")]
|
||||
[SerializeField] private LanguageParticleManager particleManager;
|
||||
[SerializeField] private GameObject expressionView;
|
||||
@@ -61,19 +58,6 @@ namespace AibisDream
|
||||
{
|
||||
glitchController = GetComponentInChildren<SpriteNoiseGlitchController>(true);
|
||||
}
|
||||
|
||||
// 注册相机
|
||||
var virtualCam = transform.Find("Expression Camera")?.GetComponent<ICinemachineCamera>();
|
||||
if (virtualCam != null)
|
||||
{
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.Expression, virtualCam);
|
||||
}
|
||||
|
||||
var virtualCam2 = transform.Find("Expression Deep Camera")?.GetComponent<ICinemachineCamera>();
|
||||
if (virtualCam2 != null)
|
||||
{
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.ExpressionDeep, virtualCam2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -251,10 +235,5 @@ namespace AibisDream
|
||||
yield return glitchController.StartCoroutine(glitchController.TransitionToAndWait(to, duration));
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
CameraKit.Instance?.UnRegisterCamera(CameraEnum.Expression);
|
||||
CameraKit.Instance?.UnRegisterCamera(CameraEnum.ExpressionDeep);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using Cinemachine;
|
||||
using AibisDream;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
@@ -26,15 +24,6 @@ namespace AibisDream.MiniGame.Language
|
||||
[Tooltip("销售系统主视图对象(会自动查找名为'SaleView'或'SellView'的子对象)")]
|
||||
[SerializeField] private GameObject saleView;
|
||||
|
||||
[HideInInspector] public BubbleSlotGroup bubbleSlotGroup;
|
||||
|
||||
[Header("相机配置")]
|
||||
[Tooltip("主销售相机")]
|
||||
[SerializeField] private CameraEnum mainCamera = CameraEnum.SaleCamera;
|
||||
|
||||
[Tooltip("深度销售相机(可选)")]
|
||||
[SerializeField] private CameraEnum deepCamera = CameraEnum.SaleDeepCamera;
|
||||
|
||||
[Header("销售模块深入 - Crank 与 Slider 协调")]
|
||||
[Tooltip("发条控制器(不填则从 saleView 下查找)")]
|
||||
[SerializeField] private CrankController crankController;
|
||||
@@ -90,7 +79,6 @@ namespace AibisDream.MiniGame.Language
|
||||
[Tooltip("盖子淡出时长")]
|
||||
[SerializeField] private float coverFadeDuration = 0.5f;
|
||||
|
||||
private readonly List<CameraEnum> registeredCameras = new();
|
||||
private bool _isProcessorDeepMode;
|
||||
private Vector3 _saleViewOriginalPos;
|
||||
private Vector3 _saleViewOriginalScale;
|
||||
@@ -139,26 +127,9 @@ namespace AibisDream.MiniGame.Language
|
||||
sliderController?.SetControlActive(true);
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// 对话气泡槽组(SaleSystem 下名为 "Bubble Slots" 的 GameObject)
|
||||
var bubbleSlots = transform.Find("Bubble Slots");
|
||||
if (bubbleSlots != null)
|
||||
{
|
||||
bubbleSlotGroup = bubbleSlots.GetComponent<BubbleSlotGroup>();
|
||||
if (bubbleSlotGroup == null)
|
||||
Debug.LogWarning("[SalesManager] 找到 'Bubble Slots' 但无 BubbleSlotGroup 组件", this);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[SalesManager] 未找到名为 'Bubble Slots' 的子对象,对话气泡将无法显示", this);
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
RegisterToSystem();
|
||||
RegisterCameras();
|
||||
FindSaleView();
|
||||
FindSaleViewEnterAnimation();
|
||||
FindCrankController();
|
||||
@@ -171,7 +142,6 @@ namespace AibisDream.MiniGame.Language
|
||||
private void OnDestroy()
|
||||
{
|
||||
_deepModeSequence?.Kill();
|
||||
UnregisterCameras();
|
||||
UnsubscribeFromCrankSlider();
|
||||
}
|
||||
|
||||
@@ -347,59 +317,6 @@ namespace AibisDream.MiniGame.Language
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册所有相机到CameraKit
|
||||
/// </summary>
|
||||
private void RegisterCameras()
|
||||
{
|
||||
if (CameraKit.Instance == null)
|
||||
{
|
||||
Debug.LogError("[SalesManager] CameraKit.Instance 为 null,无法注册相机!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取所有相机
|
||||
var virtualCams = GetComponentsInChildren<ICinemachineCamera>();
|
||||
|
||||
if (virtualCams.Length == 0)
|
||||
{
|
||||
Debug.LogWarning("[SalesManager] 未找到任何 ICinemachineCamera 组件!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 注册主相机
|
||||
if (virtualCams.Length > 0)
|
||||
{
|
||||
CameraKit.Instance.RegisterCamera(mainCamera, virtualCams[0]);
|
||||
registeredCameras.Add(mainCamera);
|
||||
Debug.Log($"[SalesManager] 成功注册主相机: {mainCamera}");
|
||||
}
|
||||
|
||||
// 注册深度相机(如果有)
|
||||
if (virtualCams.Length > 1)
|
||||
{
|
||||
CameraKit.Instance.RegisterCamera(deepCamera, virtualCams[1]);
|
||||
registeredCameras.Add(deepCamera);
|
||||
Debug.Log($"[SalesManager] 成功注册深度相机: {deepCamera}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从CameraKit注销所有相机
|
||||
/// </summary>
|
||||
private void UnregisterCameras()
|
||||
{
|
||||
if (CameraKit.Instance == null) return;
|
||||
|
||||
foreach (var cameraType in registeredCameras)
|
||||
{
|
||||
CameraKit.Instance.UnRegisterCamera(cameraType);
|
||||
Debug.Log($"[SalesManager] 已注销相机: {cameraType}");
|
||||
}
|
||||
|
||||
registeredCameras.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开销售系统界面
|
||||
/// </summary>
|
||||
|
||||
@@ -7,9 +7,8 @@ using Yarn.Unity;
|
||||
using System.Linq;
|
||||
using UnityEngine.UI;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.SaveSystem;
|
||||
using Cinemachine;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.SaveSystem;
|
||||
using AibisDream.Kit;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
using Sequence = DG.Tweening.Sequence;
|
||||
@@ -20,7 +19,6 @@ namespace AibisDream
|
||||
{
|
||||
private const string MemorySpritePath = "Sprite/Memory/{0}.png";
|
||||
|
||||
public BubbleSlotGroup bubbleSlotGroup;
|
||||
[SerializeField] private List<EyeTarget> targets = new(); // 保存目标列表
|
||||
public List<EyeTarget> Targets => targets; // 提供目标列表的公共访问
|
||||
private EyeTarget currentTarget; // 当前选中的目标
|
||||
@@ -73,10 +71,6 @@ namespace AibisDream
|
||||
public void Init()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
var virtualCam = transform.Find("Eye Camera").GetComponent<ICinemachineCamera>();
|
||||
var virtualCamDeep = transform.Find("Eye DeepCamera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.Eye, virtualCam);
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.EyeDeep, virtualCamDeep);
|
||||
DeepRepairDataRegistry.RegisterData(_eyeData);
|
||||
// 添加加载逻辑
|
||||
_eyeData.LoadEvent += LoadData;
|
||||
|
||||
@@ -3,8 +3,6 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using AibisDream;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using Cinemachine;
|
||||
using UnityEngine.Rendering;
|
||||
using Yarn.Unity;
|
||||
using DG.Tweening;
|
||||
@@ -46,8 +44,6 @@ public class UFSystem : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
var virtualCam = transform.Find("UF Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.UF, virtualCam);
|
||||
eyeSystem = FindObjectOfType<EyeSystem>();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using AibisDream;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.MiniGame.Tarot
|
||||
@@ -16,9 +17,7 @@ namespace AibisDream.MiniGame.Tarot
|
||||
[SerializeField] private Sprite backSprite;
|
||||
|
||||
[Header("Dialogue Bubbles")]
|
||||
[Tooltip("塔罗流程中使用的气泡槽位;不指定则进入塔罗时不切换气泡。")]
|
||||
[SerializeField] private BubbleSlotGroup tarotBubbleSlotGroup;
|
||||
[Tooltip("本场景普通对话的气泡槽位,用于退出塔罗时恢复;不填则尝试 OutsideCenter / FixPanelSystem。")]
|
||||
[Tooltip("退出塔罗时恢复的气泡槽位;不填则尝试 Outside / BodyModule。")]
|
||||
[SerializeField] private BubbleSlotGroup restoreBubbleSlotGroup;
|
||||
|
||||
private TarotDeck _deck;
|
||||
@@ -176,21 +175,21 @@ namespace AibisDream.MiniGame.Tarot
|
||||
|
||||
private void TryEnterTarotBubbleMode()
|
||||
{
|
||||
if (tarotBubbleSlotGroup == null)
|
||||
if (!BubbleSlotKit.Instance.TryGet(BubbleSlotEnum.Tarot, out _))
|
||||
return;
|
||||
|
||||
var snapshot = CollectRestoreSnapshot();
|
||||
if (snapshot.bubbleSlots == null || snapshot.bubbleSlots.Length == 0)
|
||||
{
|
||||
Debug.LogWarning(
|
||||
"[TarotManager] 已配置塔罗气泡但无法取得有效的恢复快照(请指定 restoreBubbleSlotGroup 或保证 OutsideCenter/FixPanelSystem 气泡可用),跳过气泡切换。",
|
||||
"[TarotManager] 已配置 Tarot 气泡但无法取得有效的恢复快照(请指定 restoreBubbleSlotGroup 或保证 Outside/BodyModule 气泡已注册),跳过气泡切换。",
|
||||
this);
|
||||
return;
|
||||
}
|
||||
|
||||
_savedBubbleData = snapshot;
|
||||
_bubbleSwapActive = true;
|
||||
DialogUIManager.Instance.LoadBubbles(tarotBubbleSlotGroup.CollectData());
|
||||
BubbleSlotKit.Instance.LoadBubbles(BubbleSlotEnum.Tarot);
|
||||
}
|
||||
|
||||
private void RestoreTarotBubbleMode()
|
||||
@@ -206,11 +205,11 @@ namespace AibisDream.MiniGame.Tarot
|
||||
if (restoreBubbleSlotGroup != null)
|
||||
return restoreBubbleSlotGroup.CollectData();
|
||||
|
||||
if (OutsideCenter.Instance != null && OutsideCenter.Instance.bubbleSlotGroup != null)
|
||||
return OutsideCenter.Instance.bubbleSlotGroup.CollectData();
|
||||
if (BubbleSlotKit.Instance.TryGet(BubbleSlotEnum.Outside, out _))
|
||||
return BubbleSlotKit.Instance.CollectData(BubbleSlotEnum.Outside);
|
||||
|
||||
if (FixPanelSystem.Instance != null && FixPanelSystem.Instance.BubbleSlotGroup != null)
|
||||
return FixPanelSystem.Instance.BubbleSlotGroup.CollectData();
|
||||
if (BubbleSlotKit.Instance.TryGet(BubbleSlotEnum.BodyModule, out _))
|
||||
return BubbleSlotKit.Instance.CollectData(BubbleSlotEnum.BodyModule);
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class OutsideCenter : Singleton<OutsideCenter>
|
||||
{
|
||||
public BubbleSlotGroup bubbleSlotGroup;
|
||||
|
||||
public override void OnSingletonInit()
|
||||
{
|
||||
// 加载气泡
|
||||
DialogUIManager.Instance.LoadBubbles(bubbleSlotGroup.CollectData());
|
||||
BubbleSlotKit.Instance.LoadBubbles(BubbleSlotEnum.Outside);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
@@ -14,11 +13,6 @@ namespace AibisDream
|
||||
{
|
||||
#region 部分索引
|
||||
|
||||
public BubbleSlotGroup subwaySlots;
|
||||
public BubbleSlotGroup tvSlots;
|
||||
|
||||
public CinemachineVirtualCamera subwayCam;
|
||||
public CinemachineVirtualCamera tvCam;
|
||||
public SpriteRenderer newsSpriteRenderer;
|
||||
|
||||
public PlayableDirector arriveStation;
|
||||
@@ -29,19 +23,10 @@ namespace AibisDream
|
||||
|
||||
public override void OnSingletonInit()
|
||||
{
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.Subway, subwayCam);
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.SubwayTV, tvCam);
|
||||
|
||||
StateMachine = new StateMachine<OutSideState>(CreateState);
|
||||
StartCoroutine(StateMachine.Init(OutSideState.Subway));
|
||||
}
|
||||
|
||||
public override void OnSingletonDestroy()
|
||||
{
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.SubwayTV);
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.Subway);
|
||||
}
|
||||
|
||||
private static IState<OutSideState> CreateState(OutSideState nextState, string arg = "")
|
||||
{
|
||||
IState<OutSideState> res = nextState switch
|
||||
@@ -96,7 +81,7 @@ namespace AibisDream
|
||||
public IEnumerator Enter()
|
||||
{
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.Subway);
|
||||
DialogUIManager.Instance.LoadBubbles(SubwayCenter.Instance.subwaySlots.CollectData());
|
||||
DialogUIManager.Instance.LoadBubbles(BubbleSlotKit.Instance.CollectData(BubbleSlotEnum.Subway));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +93,7 @@ namespace AibisDream
|
||||
{
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.SubwayTV);
|
||||
// 要加载气泡吗?
|
||||
DialogUIManager.Instance.LoadBubbles(SubwayCenter.Instance.tvSlots.CollectData());
|
||||
DialogUIManager.Instance.LoadBubbles(BubbleSlotKit.Instance.CollectData(BubbleSlotEnum.SubwayTV));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,35 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using AibisDream.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class BubbleSlotGroup : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private BubbleSlotEnum slotKey;
|
||||
[SerializeField] private BubbleSlotGroupData data;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (slotKey == BubbleSlotEnum.Default)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BubbleSlotKit.Instance.Register(slotKey, this);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (slotKey == BubbleSlotEnum.Default)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BubbleSlotKit.Instance?.Unregister(slotKey);
|
||||
}
|
||||
|
||||
public BubbleSlotGroupData CollectData()
|
||||
{
|
||||
// 获取子类
|
||||
|
||||
Reference in New Issue
Block a user