147 lines
4.8 KiB
C#
147 lines
4.8 KiB
C#
using System.Collections;
|
|
using AibisDream.Framework;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
|
|
namespace AibisDream.FixSystem
|
|
{
|
|
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);
|
|
// 关闭其他
|
|
ITransitionCommand.SetBodyModuleSystemActive(false);
|
|
AudioManager.PlayAmb1Audio("amb_room");
|
|
// 黑屏淡出
|
|
yield return MainUIController.Instance.FadeOutSync(FadeDuration);
|
|
}
|
|
|
|
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.CloseCover().WaitForCompletion();
|
|
// 黑屏
|
|
yield return MainUIController.Instance?.FadeInSync(FadeDuration);
|
|
// 相机归位
|
|
yield return CameraKit.Instance.ReturnInitCameraAsync(FadeDuration);
|
|
// 打开诊所
|
|
clinicSystem.gameObject.SetActive(true);
|
|
AudioManager.PlayAmb1Audio("amb_room");
|
|
// 关闭其他
|
|
ITransitionCommand.SetBodyModuleSystemActive(false);
|
|
// 黑屏淡出
|
|
yield return MainUIController.Instance?.FadeOutSync(FadeDuration);
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 无需参数
|
|
}
|
|
}
|
|
|
|
public struct GearToBodyModuleCommand : ITransitionCommand
|
|
{
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var gearSystem = FixSystemCenter.SystemDic.Get<GearSystem>();
|
|
|
|
// 关盖子
|
|
yield return gearSystem.CloseGearPanel();
|
|
yield return gearSystem.CloseCover();
|
|
// 相机返回
|
|
yield return CameraKit.Instance.ReturnInitCamera(Duration).WaitForCompletion();
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 没有参数
|
|
}
|
|
}
|
|
|
|
public struct BodyModuleToGearCommand : ITransitionCommand
|
|
{
|
|
private static readonly Vector3 CameraPos = new(-1.09f, -0.07f, -10);
|
|
private const float OrthographicSize = 1.6f;
|
|
private const float Duration = 2f;
|
|
|
|
private string _configKey;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var gearSystem = FixSystemCenter.SystemDic.Get<GearSystem>();
|
|
|
|
// 插头回到初始插孔
|
|
bodyModuleSystem.ResetPlug();
|
|
// 相机聚焦到目标位
|
|
yield return CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration).WaitForCompletion();
|
|
if (!string.IsNullOrEmpty(_configKey))
|
|
{
|
|
gearSystem.CurDataKey = _configKey;
|
|
gearSystem.LoadLevel();
|
|
}
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
_configKey = arg.Trim();
|
|
}
|
|
}
|
|
|
|
public struct GearToClinicCommand : ITransitionCommand
|
|
{
|
|
private const float FadeDuration = 0.5f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var clinicSystem = FixSystemCenter.SystemDic.Get<ClinicSystem>();
|
|
var gearSystem = FixSystemCenter.SystemDic.Get<GearSystem>();
|
|
|
|
// 盖上盖子
|
|
yield return gearSystem.CloseGearPanel();
|
|
yield return gearSystem.CloseCover();
|
|
// 黑屏
|
|
yield return MainUIController.Instance.FadeInSync(FadeDuration);
|
|
// 相机归位
|
|
yield return CameraKit.Instance.ReturnInitCameraAsync(FadeDuration);
|
|
// 打开诊所
|
|
clinicSystem.gameObject.SetActive(true);
|
|
// 关闭其他
|
|
ITransitionCommand.SetBodyModuleSystemActive(false);
|
|
AudioManager.PlayAmb1Audio("amb_room");
|
|
// 黑屏淡出
|
|
yield return MainUIController.Instance.FadeOutSync(FadeDuration);
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 没有参数
|
|
}
|
|
}
|
|
} |