296 lines
8.5 KiB
C#
296 lines
8.5 KiB
C#
using System.Collections;
|
|
using AibisDream.Framework;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
|
|
namespace AibisDream.FixSystem
|
|
{
|
|
public enum FixState
|
|
{
|
|
Clinic,
|
|
CoolingMachine,
|
|
BodyModule,
|
|
Memory,
|
|
Eye,
|
|
UF,
|
|
VisualSense,
|
|
Engine,
|
|
Gear
|
|
}
|
|
|
|
public interface ITransitionCommand
|
|
{
|
|
IEnumerator Execute();
|
|
void SetArgs(string arg);
|
|
}
|
|
|
|
public struct BodyModuleToClinicCommand : ITransitionCommand
|
|
{
|
|
private const float FadeDuration = 0.5f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var clinicSystem = FixSystemCenter.SystemDic.Get<ClinicSystem>();
|
|
|
|
// 黑屏
|
|
yield return MainUIController.Instance.FadeInSync(FadeDuration);
|
|
// 把线插回去
|
|
bodyModuleSystem.ResetPlug();
|
|
// 诊所显示
|
|
clinicSystem.gameObject.SetActive(true);
|
|
// 黑屏淡出
|
|
yield return MainUIController.Instance.FadeOutSync(FadeDuration);
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 暂无参数
|
|
}
|
|
}
|
|
|
|
public struct BodyModuleToEngineCommand : ITransitionCommand
|
|
{
|
|
// 引擎相机设置
|
|
private static readonly Vector3 CameraPos = new(-2.5f, 2.13f, -10);
|
|
private const float OrthographicSize = 2.5f;
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var engineSystem = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
|
|
|
// 插头回到初始插孔
|
|
bodyModuleSystem.ResetPlug();
|
|
// 相机聚焦到目标位
|
|
var cameraSq = CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
// 打开引擎盖子
|
|
var coverSq = engineSystem.OpenCover();
|
|
while (coverSq.active && !coverSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct EngineToBodyModuleCommand : ITransitionCommand
|
|
{
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var engineSystem = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
|
|
|
// 关闭引擎盖
|
|
var coverSq = engineSystem.CloseCover();
|
|
while (coverSq.active && !coverSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
// 相机还原
|
|
var cameraSq = CameraKit.Instance.ReturnInitCamera(Duration);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct EngineToClinicCommand : ITransitionCommand
|
|
{
|
|
private const float FadeDuration = 0.5f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var clinicSystem = FixSystemCenter.SystemDic.Get<ClinicSystem>();
|
|
var engineSystem = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
|
|
|
// 盖上盖子
|
|
yield return engineSystem.CloseCoverAsync();
|
|
// 黑屏
|
|
yield return MainUIController.Instance.FadeInSync(FadeDuration);
|
|
// 相机归位
|
|
CameraKit.Instance.ResetCamara();
|
|
// 打开诊所
|
|
clinicSystem.gameObject.SetActive(true);
|
|
// 黑屏淡出
|
|
yield return MainUIController.Instance.FadeOutSync(FadeDuration);
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 无需参数
|
|
}
|
|
}
|
|
|
|
public struct BodyModuleToEyeCommand : ITransitionCommand
|
|
{
|
|
// 引擎相机设置
|
|
private static readonly Vector3 CameraPos = new(0f, 0.5f, -10);
|
|
private const float OrthographicSize = 2.5f;
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var eyeSystem = FixSystemCenter.SystemDic.Get<EyeSystem>();
|
|
|
|
// 插头回到初始插孔
|
|
bodyModuleSystem.ResetPlug();
|
|
// 相机聚焦到目标位
|
|
var cameraSq = CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
eyeSystem.OpenEyeView();
|
|
eyeSystem.OnEnter();
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct EyeToBodyModuleCommand : ITransitionCommand
|
|
{
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var eyeSystem = FixSystemCenter.SystemDic.Get<EyeSystem>();
|
|
eyeSystem.CloseEyeView();
|
|
|
|
// 相机还原
|
|
var cameraSq = CameraKit.Instance.ReturnInitCamera(Duration);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
eyeSystem.OnExit();
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct BodyModuleToMemoryCommand : ITransitionCommand
|
|
{
|
|
// 引擎相机设置
|
|
private static readonly Vector3 CameraPos = new(0f, 0.5f, -10);
|
|
private const float OrthographicSize = 2.5f;
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var memorySystem = FixSystemCenter.SystemDic.Get<MemoryProcess>();
|
|
|
|
// 插头回到初始插孔
|
|
bodyModuleSystem.ResetPlug();
|
|
// 相机聚焦到目标位
|
|
var cameraSq = CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
memorySystem.OpenMemoryView();
|
|
memorySystem.OnShow();
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct MemoryToBodyModuleCommand : ITransitionCommand
|
|
{
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var memorySystem = FixSystemCenter.SystemDic.Get<MemoryProcess>();
|
|
memorySystem.CloseMemoryView();
|
|
|
|
// 相机还原
|
|
yield return CameraKit.Instance.ReturnInitCamera(Duration).WaitForCompletion();
|
|
memorySystem.OnExit();
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct BodyModuleToUFCommand : ITransitionCommand
|
|
{
|
|
// 引擎相机设置
|
|
private static readonly Vector3 CameraPos = new(0f, 0.5f, -10);
|
|
private const float OrthographicSize = 2.5f;
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var UFSystem = FixSystemCenter.SystemDic.Get<UFSystem>();
|
|
// 插头回到初始插孔
|
|
bodyModuleSystem.ResetPlug();
|
|
// 相机聚焦到目标位
|
|
yield return CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration).WaitForCompletion();
|
|
UFSystem.OpenUFView();
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct UFToBodyModuleCommand : ITransitionCommand
|
|
{
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var UFSystem = FixSystemCenter.SystemDic.Get<UFSystem>();
|
|
UFSystem.CloseUFView();
|
|
|
|
// 相机还原
|
|
var cameraSq = CameraKit.Instance.ReturnInitCamera(Duration);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
} |