石头串联
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
using System.Collections;
|
||||
using AibisDream.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public struct ClinicToBodyModuleCommand : ITransitionCommand
|
||||
{
|
||||
private const float FadeDuration = 1f;
|
||||
|
||||
private string _configName;
|
||||
|
||||
public IEnumerator Execute()
|
||||
{
|
||||
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
||||
var clinicSystem = FixSystemCenter.SystemDic.Get<ClinicSystem>();
|
||||
|
||||
// 黑屏
|
||||
yield return MainUIController.Instance.FadeInSync(FadeDuration);
|
||||
// 加载BodyModuleSystem
|
||||
bodyModuleSystem.CurDataKey = _configName;
|
||||
bodyModuleSystem.Load();
|
||||
// 隐藏诊所
|
||||
clinicSystem.gameObject.SetActive(false);
|
||||
// 黑屏淡出
|
||||
yield return MainUIController.Instance.FadeOutSync(FadeDuration);
|
||||
}
|
||||
|
||||
public void SetArgs(string arg)
|
||||
{
|
||||
// 添加参数
|
||||
_configName = arg;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ClinicToEngineCommand : ITransitionCommand
|
||||
{
|
||||
private const float FadeDuration = 0.5f;
|
||||
|
||||
// 引擎相机设置
|
||||
private static readonly Vector3 CameraPos = new(-2.5f, 2.13f, -10);
|
||||
private const float OrthographicSize = 2.5f;
|
||||
private const float Duration = 2f;
|
||||
|
||||
private string _configName;
|
||||
|
||||
public IEnumerator Execute()
|
||||
{
|
||||
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
||||
var clinicSystem = FixSystemCenter.SystemDic.Get<ClinicSystem>();
|
||||
var engineSystem = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
||||
|
||||
// // 黑屏
|
||||
yield return MainUIController.Instance.FadeInSync(FadeDuration);
|
||||
// 隐藏诊所
|
||||
clinicSystem.gameObject.SetActive(false);
|
||||
// 激活插线系统
|
||||
bodyModuleSystem.gameObject.SetActive(true);
|
||||
// // 黑屏淡出
|
||||
yield return MainUIController.Instance.FadeOutSync(FadeDuration);
|
||||
// 移动相机
|
||||
yield return CameraKit.Instance.TransCameraAsync(CameraPos, OrthographicSize, Duration);
|
||||
// 开启引擎玩法
|
||||
engineSystem.CurDataKey = _configName;
|
||||
engineSystem.Load();
|
||||
yield return engineSystem.OpenCoverAsync();
|
||||
}
|
||||
|
||||
public void SetArgs(string arg)
|
||||
{
|
||||
_configName = arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df122109d96340d2a8525483632bf55d
|
||||
timeCreated: 1734248940
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using AibisDream.Framework;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
@@ -21,6 +19,32 @@ namespace AibisDream.FixSystem
|
||||
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
|
||||
@@ -51,9 +75,14 @@ namespace AibisDream.FixSystem
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetArgs(string arg)
|
||||
{
|
||||
// 添加参数
|
||||
}
|
||||
}
|
||||
|
||||
public struct EngineToBodyModuleCommand : ITransitionCommand
|
||||
public partial struct EngineToBodyModuleCommand : ITransitionCommand
|
||||
{
|
||||
private const float Duration = 2f;
|
||||
|
||||
@@ -75,99 +104,37 @@ namespace AibisDream.FixSystem
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct EngineToGearCommand : ITransitionCommand
|
||||
{
|
||||
private const float Duration = 2f;
|
||||
private static readonly Vector3 CameraPos = new(-2.5f, 2.13f, -10);
|
||||
|
||||
public IEnumerator Execute()
|
||||
public void SetArgs(string arg)
|
||||
{
|
||||
var engineSystem = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
||||
var gearSystem = FixSystemCenter.SystemDic.Get<GearSystem>();
|
||||
// 关闭一下引擎盖
|
||||
var coverSq = engineSystem.CloseCover();
|
||||
while (coverSq.active && !coverSq.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 只需要移动一下相机就好了
|
||||
var tween = CameraKit.Instance.TransCamera(CameraPos, Duration);
|
||||
while (tween.active && !tween.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 然后可以开启引擎盖
|
||||
|
||||
// 添加参数
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 以两个Key为索引的Dic
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Value类型</typeparam>
|
||||
public class StateDictionary<T>
|
||||
public struct EngineToClinicCommand : ITransitionCommand
|
||||
{
|
||||
private readonly Dictionary<StateTransKey, T> _stateDic = new();
|
||||
|
||||
public T Get(FixState source, FixState target)
|
||||
private const float FadeDuration = 0.5f;
|
||||
|
||||
public IEnumerator Execute()
|
||||
{
|
||||
var key = new StateTransKey(source, target);
|
||||
return _stateDic[key];
|
||||
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 Add(FixState source, FixState target, T value)
|
||||
public void SetArgs(string arg)
|
||||
{
|
||||
var key = new StateTransKey(source, target);
|
||||
_stateDic[key] = value;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_stateDic.Clear();
|
||||
}
|
||||
|
||||
public bool ContainsKey(FixState source, FixState target)
|
||||
{
|
||||
var key = new StateTransKey(source, target);
|
||||
return _stateDic.ContainsKey(key);
|
||||
}
|
||||
|
||||
public bool TryGetValue(FixState source, FixState target, out T value)
|
||||
{
|
||||
var key = new StateTransKey(source, target);
|
||||
return _stateDic.TryGetValue(key, out value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用于实现两个Key的Dictionary
|
||||
/// </summary>
|
||||
private class StateTransKey
|
||||
{
|
||||
private readonly FixState _sourceState;
|
||||
private readonly FixState _targetState;
|
||||
|
||||
public StateTransKey(FixState sourceState, FixState targetState)
|
||||
{
|
||||
_sourceState = sourceState;
|
||||
_targetState = targetState;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
// 类型不同肯定不相等
|
||||
if (obj is not StateTransKey other) return false;
|
||||
// 判断两个key相等
|
||||
return _sourceState == other._sourceState && _targetState == other._targetState;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(_sourceState, _targetState);
|
||||
}
|
||||
// 无需参数
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// 以两个Key为索引的Dic
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Value类型</typeparam>
|
||||
public class StateDictionary<T>
|
||||
{
|
||||
private readonly Dictionary<StateTransKey, T> _stateDic = new();
|
||||
|
||||
public T Get(FixState source, FixState target)
|
||||
{
|
||||
var key = new StateTransKey(source, target);
|
||||
return _stateDic[key];
|
||||
}
|
||||
|
||||
public void Add(FixState source, FixState target, T value)
|
||||
{
|
||||
var key = new StateTransKey(source, target);
|
||||
_stateDic[key] = value;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_stateDic.Clear();
|
||||
}
|
||||
|
||||
public bool ContainsKey(FixState source, FixState target)
|
||||
{
|
||||
var key = new StateTransKey(source, target);
|
||||
return _stateDic.ContainsKey(key);
|
||||
}
|
||||
|
||||
public bool TryGetValue(FixState source, FixState target, out T value)
|
||||
{
|
||||
var key = new StateTransKey(source, target);
|
||||
return _stateDic.TryGetValue(key, out value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用于实现两个Key的Dictionary
|
||||
/// </summary>
|
||||
private class StateTransKey
|
||||
{
|
||||
private readonly FixState _sourceState;
|
||||
private readonly FixState _targetState;
|
||||
|
||||
public StateTransKey(FixState sourceState, FixState targetState)
|
||||
{
|
||||
_sourceState = sourceState;
|
||||
_targetState = targetState;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
// 类型不同肯定不相等
|
||||
if (obj is not StateTransKey other) return false;
|
||||
// 判断两个key相等
|
||||
return _sourceState == other._sourceState && _targetState == other._targetState;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(_sourceState, _targetState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ccd2ec5e9984317a57e8d005b0dc61a
|
||||
timeCreated: 1734236591
|
||||
Reference in New Issue
Block a user