地铁功能新增

This commit is contained in:
2025-06-12 22:40:40 +08:00
parent 29b5a5779e
commit 10d964d3b0
47 changed files with 7790 additions and 3432 deletions
+28 -52
View File
@@ -10,50 +10,35 @@ namespace AibisDream.FixSystem
{
public FixState CurState => _curState.GetState;
private IState _curState;
private IState<FixState> _curState;
private string _curArgs;
private StateMachine<FixState> _stateMachine;
public FixStateMachine()
{
// 初始化为一个默认状态
_curState = CreateState(FixState.Default, "");
_stateMachine = new StateMachine<FixState>(CreateState);
_stateMachine.OnStateSwitch += state => EnumEventSystem.Global.Send(EventEnum.FixStateSwitch, state);
}
/// <summary>
/// 播放诊所到场景的timeline
/// </summary>
/// <returns></returns>
public IEnumerator PlayClinicCut()
public IEnumerator Init(FixState initState)
{
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CoolingMachine);
yield return TimelineManager.Instance.PlayTimeline("ToBodyModule");
yield return _stateMachine.Init(initState);
}
public IEnumerator SwitchState(FixState nextState, string args = "")
{
Debug.Log($"SwitchState: {CurState}");
if (CurState == nextState) yield break;
_curArgs = args;
yield return _curState?.Exit();
_curState = CreateState(nextState, _curArgs);
EnumEventSystem.Global.Send(EventEnum.FixStateSwitch, nextState);
yield return _curState.Enter();
yield return _stateMachine.SwitchState(nextState, args);
}
public IEnumerator QuitState()
{
_curArgs = null;
yield return _curState?.Exit();
_curState = null;
yield return _stateMachine.QuitState();
}
private static IState CreateState(FixState nextState, string args)
private static IState<FixState> CreateState(FixState nextState, string args)
{
IState res = nextState switch
IState<FixState> res = nextState switch
{
FixState.Clinic => new ClinicState(),
FixState.Engine => new EngineState(),
@@ -96,15 +81,7 @@ namespace AibisDream.FixSystem
Dream,
}
public interface IState
{
public FixState GetState { get; }
public void SetArgs(string args) {}
public IEnumerator Enter();
public IEnumerator Exit();
}
public struct DefaultState : IState
public struct DefaultState : IState<FixState>
{
public FixState GetState => FixState.Default;
@@ -119,7 +96,7 @@ namespace AibisDream.FixSystem
}
}
public struct ClinicState : IState
public struct ClinicState : IState<FixState>
{
public FixState GetState => FixState.Clinic;
@@ -147,7 +124,7 @@ namespace AibisDream.FixSystem
}
}
public struct BodyModuleState : IState
public struct BodyModuleState : IState<FixState>
{
private string _args;
@@ -206,7 +183,7 @@ namespace AibisDream.FixSystem
}
public struct GearState : IState
public struct GearState : IState<FixState>
{
public FixState GetState => FixState.Gear;
@@ -248,7 +225,7 @@ namespace AibisDream.FixSystem
}
}
public struct EngineState : IState
public struct EngineState : IState<FixState>
{
public FixState GetState => FixState.Engine;
@@ -280,7 +257,7 @@ namespace AibisDream.FixSystem
}
}
public struct UfState : IState
public struct UfState : IState<FixState>
{
public FixState GetState => FixState.UF;
@@ -326,7 +303,7 @@ namespace AibisDream.FixSystem
}
}
public struct EyeState : IState
public struct EyeState : IState<FixState>
{
public FixState GetState => FixState.Eye;
@@ -385,7 +362,7 @@ namespace AibisDream.FixSystem
}
}
public struct MemoryState : IState
public struct MemoryState : IState<FixState>
{
public FixState GetState => FixState.Memory;
@@ -428,7 +405,7 @@ namespace AibisDream.FixSystem
memorySystem.PullMemoryProjector();
}
}
public struct ExpressionState : IState
public struct ExpressionState : IState<FixState>
{
public FixState GetState => FixState.Expression;
@@ -466,7 +443,7 @@ namespace AibisDream.FixSystem
yield break;
}
}
public struct EmoState : IState
public struct EmoState : IState<FixState>
{
public FixState GetState => FixState.Emo;
@@ -500,7 +477,7 @@ namespace AibisDream.FixSystem
yield break;
}
}
public struct OpState : IState
public struct OpState : IState<FixState>
{
public FixState GetState => FixState.Op;
@@ -523,7 +500,7 @@ namespace AibisDream.FixSystem
yield break;
}
}
public struct DreamState : IState
public struct DreamState : IState<FixState>
{
public FixState GetState => FixState.Dream;
@@ -549,7 +526,7 @@ namespace AibisDream.FixSystem
yield break;
}
}
public struct EmoCutState : IState
public struct EmoCutState : IState<FixState>
{
public FixState GetState => FixState.EmoCut;
@@ -590,7 +567,7 @@ namespace AibisDream.FixSystem
yield return UIManager.Instance.GetPanel<PlayToolPanel>().FadeOutAsync(0.1f);
}
}
public struct MemoryCutState : IState
public struct MemoryCutState : IState<FixState>
{
public FixState GetState => FixState.MemoryCut;
@@ -633,7 +610,7 @@ namespace AibisDream.FixSystem
yield return UIManager.Instance.GetPanel<PlayToolPanel>().FadeOutAsync(0.1f);
}
}
public struct LogicCutState : IState
public struct LogicCutState : IState<FixState>
{
public FixState GetState => FixState.LogicCut;
@@ -650,8 +627,7 @@ namespace AibisDream.FixSystem
{
bodyModuleSystem.SwitchModuleGroup(ModuleState.Head);
yield return CameraKit.Instance.SwitchCamera(CameraEnum.BodyModule);
}
//bodyModuleSystem.CableSystem.ResetPlug();
} ;
var bodyModule=bodyModuleSystem.FindBodyModuleByName("Logic");
if(bodyModule!=null)
{