存储功能测试
This commit is contained in:
@@ -216,8 +216,8 @@ public void NodeInit(string nodeID,bool isactive)
|
||||
public void CheckConnection(Connection connection)
|
||||
{
|
||||
currentConnection=connection;
|
||||
DialogController.Instance.SetVariable("$StartNode",connection.port0.node.ID);
|
||||
DialogController.Instance.SetVariable("$EndNode",connection.port1.node.ID);
|
||||
StorageSystem.Instance?.SetValue("$StartNode",connection.port0.node.ID);
|
||||
StorageSystem.Instance?.SetValue("$EndNode",connection.port1.node.ID);
|
||||
if(isTriggerDialogue)
|
||||
{
|
||||
DialogController.Instance.StartDialogNode("检查ClueBoard");
|
||||
|
||||
@@ -14,14 +14,16 @@ namespace AibisDream
|
||||
public static void NextYarn()
|
||||
{
|
||||
EnumEventSystem.Global.Send(EventEnum.NextYarn);
|
||||
DialogController.Instance.ClearVariables();
|
||||
StorageSystem.Instance.ClearLocal();
|
||||
DialogController.Instance.StartCoroutine(GameLoopManager.Instance.NextSceneSo());
|
||||
}
|
||||
|
||||
[YarnCommand("BackToMenu")]
|
||||
public static void BackToMenu()
|
||||
{
|
||||
StartMenu.Instance.BackToMenu();
|
||||
}
|
||||
|
||||
[YarnCommand("OpenEndMenu")]
|
||||
public static void OpenEndMenu()
|
||||
{
|
||||
@@ -41,7 +43,7 @@ namespace AibisDream
|
||||
{
|
||||
Debug.Log("show_tv_scene 已废弃");
|
||||
}
|
||||
|
||||
|
||||
[YarnCommand("load_scene")]
|
||||
public static IEnumerator LoadScene(string sceneName, float duration = 1)
|
||||
{
|
||||
@@ -84,7 +86,7 @@ namespace AibisDream
|
||||
{
|
||||
return MainUIController.Instance.HideObj();
|
||||
}
|
||||
|
||||
|
||||
[YarnCommand("show_full_screen")]
|
||||
public static IEnumerator ShowFullScreen(string picName)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace AibisDream
|
||||
public class DialogController : Singleton<DialogController>
|
||||
{
|
||||
private DialogueRunner _dialogueRunner;
|
||||
private VariableStorageBehaviour _variableStorage;
|
||||
|
||||
# region controller状态标识
|
||||
|
||||
@@ -46,7 +45,6 @@ namespace AibisDream
|
||||
private void Start()
|
||||
{
|
||||
_dialogueRunner = GetComponentInChildren<DialogueRunner>();
|
||||
_variableStorage = GetComponentInChildren<InMemoryVariableStorage>();
|
||||
|
||||
_dialogueRunner.onDialogueStart.AddListener(() =>
|
||||
{
|
||||
@@ -72,45 +70,11 @@ namespace AibisDream
|
||||
private void ResetDialog()
|
||||
{
|
||||
_dialogueRunner.Stop();
|
||||
_variableStorage.Clear();
|
||||
StorageSystem.Instance.Clear();
|
||||
DialogCanvasManager.Instance.HideDialog();
|
||||
DialogCanvasManager.Instance.SwitchDialogView(DialogViewType.OldBox);
|
||||
}
|
||||
|
||||
#region 变量操作
|
||||
|
||||
public bool TryGetVariable<T>(string variableName, out T result)
|
||||
{
|
||||
return _variableStorage.TryGetValue(variableName, out result);
|
||||
}
|
||||
|
||||
public void SetVariable(string variableName, string value)
|
||||
{
|
||||
_variableStorage.SetValue(variableName, value);
|
||||
}
|
||||
|
||||
public void SetVariable(string variableName, bool value)
|
||||
{
|
||||
_variableStorage.SetValue(variableName, value);
|
||||
}
|
||||
|
||||
public void SetVariable(string variableName, float value)
|
||||
{
|
||||
_variableStorage.SetValue(variableName, value);
|
||||
}
|
||||
|
||||
public bool Contains(string variableName)
|
||||
{
|
||||
return _variableStorage.Contains(variableName);
|
||||
}
|
||||
|
||||
public void ClearVariables()
|
||||
{
|
||||
_variableStorage.Clear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 开启对话
|
||||
/// </summary>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38ae5aaccd67de644bfd206afaebabfb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,54 +0,0 @@
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public class BottleShelf : MonoBehaviour
|
||||
{
|
||||
[Header("整体位置")]
|
||||
public Vector3 showPos;
|
||||
public Vector3 hidePos;
|
||||
|
||||
[Header("动画时间")]
|
||||
public float showDuration;
|
||||
|
||||
#region 引用
|
||||
|
||||
private BottleSlot[] _bottleSlots;
|
||||
|
||||
#endregion
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
transform.localPosition = hidePos;
|
||||
|
||||
InitRefs();
|
||||
}
|
||||
|
||||
private void InitRefs()
|
||||
{
|
||||
_bottleSlots = GetComponentsInChildren<BottleSlot>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示泵机UI
|
||||
/// </summary>
|
||||
/// <returns>显示</returns>
|
||||
public IEnumerator Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
yield return transform.DOLocalMove(showPos, showDuration).WaitForCompletion();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏泵机UI
|
||||
/// </summary>
|
||||
/// <returns>隐藏</returns>
|
||||
public IEnumerator Hide()
|
||||
{
|
||||
yield return transform.DOLocalMove(hidePos, showDuration).WaitForCompletion();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6796b547c41a4f95b37dd869332fa06b
|
||||
timeCreated: 1734711369
|
||||
@@ -1,120 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
[RequireComponent(typeof(Collider2D))]
|
||||
public class BottleSlot : MonoBehaviour
|
||||
{
|
||||
public event Action<CoolingBottle> InsertSlotEvent;
|
||||
public event Action RemoveSlotEvent;
|
||||
public CoolingBottleData initBottleData;
|
||||
|
||||
private CoolingBottle _curBottle;
|
||||
private GameObject _bottlePrefab;
|
||||
private bool _inShelf;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
InitRefs();
|
||||
InitBottle();
|
||||
}
|
||||
|
||||
private void InitRefs()
|
||||
{
|
||||
var shelf = GetComponentInParent<BottleShelf>();
|
||||
// 根据在瓶架上还是机器中确定操作
|
||||
_inShelf = shelf != null;
|
||||
|
||||
_bottlePrefab = Resources.Load<GameObject>("Prefabs/Fix/Bottle");
|
||||
}
|
||||
|
||||
private void InitBottle()
|
||||
{
|
||||
if (string.IsNullOrEmpty(initBottleData.name)) return;
|
||||
|
||||
var newBottle = Instantiate(_bottlePrefab, transform).GetComponent<CoolingBottle>();
|
||||
_curBottle = newBottle;
|
||||
// 加载瓶子数据
|
||||
newBottle.Load(initBottleData);
|
||||
newBottle.curSnapSlot = this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 与瓶子发生碰撞时
|
||||
/// </summary>
|
||||
/// <param name="other"></param>
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
// 如果当前Slot里已经有瓶子了,就返回
|
||||
if (_curBottle != null) return;
|
||||
|
||||
// 尝试获取瓶子
|
||||
if (other.gameObject.TryGetComponent<CoolingBottle>(out var bottle))
|
||||
{
|
||||
bottle.targetSnapSlotSet.Add(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 瓶子离开时
|
||||
/// </summary>
|
||||
/// <param name="other"></param>
|
||||
private void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
// 尝试获取瓶子
|
||||
if (other.gameObject.TryGetComponent<CoolingBottle>(out var bottle))
|
||||
{
|
||||
bottle.targetSnapSlotSet.Remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除当前瓶子
|
||||
/// </summary>
|
||||
public void RemoveBottle()
|
||||
{
|
||||
_curBottle = null;
|
||||
RemoveSlotEvent?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 插入时触发
|
||||
/// </summary>
|
||||
/// <param name="coolingBottle"></param>
|
||||
public void InsertSlot(CoolingBottle coolingBottle)
|
||||
{
|
||||
_curBottle = coolingBottle;
|
||||
_curBottle.transform.parent = transform;
|
||||
// 在架子上才正过来
|
||||
if (_inShelf)
|
||||
{
|
||||
coolingBottle.Rotate(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeSlot(CoolingBottle coolingBottle)
|
||||
{
|
||||
InsertSlotEvent?.Invoke(coolingBottle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否有冷却液
|
||||
/// </summary>
|
||||
/// <returns>瓶子</returns>
|
||||
public CoolingBottle GetCurBottle()
|
||||
{
|
||||
return _curBottle;
|
||||
}
|
||||
|
||||
public void DestroyBottle()
|
||||
{
|
||||
if (_curBottle)
|
||||
{
|
||||
_curBottle.transform.parent = null;
|
||||
Destroy(_curBottle.gameObject);
|
||||
_curBottle = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67ce5499de014b3aae82bf1db274b14b
|
||||
timeCreated: 1734872735
|
||||
@@ -1,154 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AibisDream.Framework;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
[RequireComponent(typeof(Collider2D), typeof(Rigidbody2D))]
|
||||
public class CoolingBottle : MonoBehaviour, IMoveable
|
||||
{
|
||||
private const float RotateTime = 0.3f;
|
||||
private const float SnapMoveTime = 0.3f;
|
||||
private static readonly Vector3 ClockwiseAngle = new(0, 0, 0);
|
||||
private static readonly Vector3 ClockWiseScale = new(1, 1, 1);
|
||||
private static readonly Vector3 AnticlockwiseAngle = new(0, 0, 90);
|
||||
private static readonly Vector3 AnticlockwiseScale = new(1.45f, 1.45f, 1);
|
||||
|
||||
public CoolingBottleData data;
|
||||
|
||||
#region 引用
|
||||
|
||||
private Sprite _verticalSprite;
|
||||
private Sprite _horizontalSprite;
|
||||
|
||||
public BottleSlot curSnapSlot;
|
||||
public readonly HashSet<BottleSlot> targetSnapSlotSet = new();
|
||||
|
||||
private Rigidbody2D _rb;
|
||||
private SpriteRenderer _renderer;
|
||||
|
||||
#endregion
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitRefs();
|
||||
}
|
||||
|
||||
private void InitRefs()
|
||||
{
|
||||
_rb = GetComponent<Rigidbody2D>();
|
||||
_renderer = GetComponent<SpriteRenderer>();
|
||||
}
|
||||
|
||||
#region 移动逻辑
|
||||
|
||||
public bool IsBlock { get; set; }
|
||||
|
||||
public void StartMove()
|
||||
{
|
||||
_rb.isKinematic = false;
|
||||
gameObject.layer = LayerMask.NameToLayer("Clinic");
|
||||
// 开始移动时就切换成横版
|
||||
Rotate(false);
|
||||
}
|
||||
|
||||
public void Rotate(bool isVertical)
|
||||
{
|
||||
StartCoroutine(RotateAsync(isVertical));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 旋转瓶子
|
||||
/// </summary>
|
||||
/// <param name="isVertical">是否竖直</param>
|
||||
/// <returns></returns>
|
||||
private IEnumerator RotateAsync(bool isVertical)
|
||||
{
|
||||
var angle = isVertical ? ClockwiseAngle : AnticlockwiseAngle;
|
||||
var scale = isVertical ? ClockWiseScale : AnticlockwiseScale;
|
||||
// 动画序列
|
||||
var sq = DOTween.Sequence();
|
||||
Tween rotate = transform.DORotate(angle, RotateTime, RotateMode.FastBeyond360);
|
||||
sq.Join(rotate);
|
||||
Tween scaleTw = transform.DOScale(scale, RotateTime);
|
||||
sq.Join(scaleTw);
|
||||
|
||||
yield return sq.WaitForCompletion();
|
||||
}
|
||||
|
||||
public void Move(Vector2 mousePos)
|
||||
{
|
||||
_rb.MovePosition(mousePos);
|
||||
}
|
||||
|
||||
public void StopMove()
|
||||
{
|
||||
if (TryFindClosestSlot(out var targetSlot))
|
||||
{
|
||||
// 从原有Slot移出
|
||||
curSnapSlot.RemoveBottle();
|
||||
// 更新到新的Slot
|
||||
curSnapSlot = targetSlot;
|
||||
|
||||
curSnapSlot.ChangeSlot(this);
|
||||
}
|
||||
|
||||
targetSnapSlotSet.Clear();
|
||||
|
||||
// 吸附到目标位置
|
||||
_rb.isKinematic = true;
|
||||
gameObject.layer = LayerMask.NameToLayer("Default");
|
||||
curSnapSlot.InsertSlot(this);
|
||||
transform.DOMove(curSnapSlot.transform.position, SnapMoveTime);
|
||||
|
||||
// TODO 停止描边
|
||||
}
|
||||
|
||||
public bool TryFindClosestSlot(out BottleSlot targetSlot)
|
||||
{
|
||||
// 没有目标Slot,返回
|
||||
if (targetSnapSlotSet.Count == 0)
|
||||
{
|
||||
targetSlot = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 寻找最近的Slot
|
||||
var shortestDistance = float.MaxValue;
|
||||
BottleSlot closestSlot = null;
|
||||
foreach (var slot in targetSnapSlotSet)
|
||||
{
|
||||
var distance = Vector3.Distance(slot.transform.position, transform.position);
|
||||
if (distance < shortestDistance)
|
||||
{
|
||||
shortestDistance = distance;
|
||||
closestSlot = slot;
|
||||
}
|
||||
}
|
||||
|
||||
targetSlot = closestSlot;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Load(CoolingBottleData targetData)
|
||||
{
|
||||
data = targetData;
|
||||
_verticalSprite = ResourceKit.LoadSpriteFromPsd($"Art/Fix/Cooling/冷却系统/{data.verticalSprite}");
|
||||
_renderer.sprite = _verticalSprite;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct CoolingBottleData
|
||||
{
|
||||
public string name;
|
||||
public string description;
|
||||
public string verticalSprite;
|
||||
public string horizontalSprite;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6474997a226747428064c19bfb501a0f
|
||||
timeCreated: 1734870985
|
||||
@@ -1,166 +0,0 @@
|
||||
using System.Collections;
|
||||
using AibisDream.FixSystem;
|
||||
using Cinemachine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.Framework
|
||||
{
|
||||
public class CoolingSystem : MonoBehaviour, ICoolingSystem
|
||||
{
|
||||
#region 引用
|
||||
|
||||
private PumpController _pumpUI;
|
||||
private BottleShelf _bottomUI;
|
||||
private TubeController _tubeUI;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 状态
|
||||
|
||||
public bool isLocked;
|
||||
|
||||
private CoolingBottle CurBottle => _pumpUI.bottleSlot.GetCurBottle();
|
||||
|
||||
#endregion
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
InitRefs();
|
||||
|
||||
// 注册相机
|
||||
var virtualCam = transform.Find("Cooling Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.CoolingMachine, virtualCam);
|
||||
}
|
||||
|
||||
private void InitRefs()
|
||||
{
|
||||
_pumpUI = transform.Find("Pump Part").GetComponent<PumpController>();
|
||||
_bottomUI = transform.Find("Bottom Part").GetComponent<BottleShelf>();
|
||||
_tubeUI = transform.Find("Tube Part").GetComponent<TubeController>();
|
||||
|
||||
isLocked = true;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.CoolingMachine);
|
||||
}
|
||||
|
||||
#region 对外开放
|
||||
|
||||
public IEnumerator OpenCoolingSystem()
|
||||
{
|
||||
yield return _pumpUI.Show();
|
||||
}
|
||||
|
||||
public IEnumerator LinkTube()
|
||||
{
|
||||
// 播放插线动画,完成后自动关闭
|
||||
yield return _tubeUI.PlayLinkAnime();
|
||||
}
|
||||
|
||||
public IEnumerator OpenBottleUI()
|
||||
{
|
||||
yield return _bottomUI.Show();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
isLocked = false;
|
||||
if (CurBottle)
|
||||
{
|
||||
CurBottle.IsBlock = false;
|
||||
}
|
||||
_pumpUI.OpenBuckle();
|
||||
}
|
||||
|
||||
public void InsertBottle(CoolingBottle bottle)
|
||||
{
|
||||
// 设置当前瓶子名称
|
||||
DialogController.Instance.SetVariable("$curBottleName", bottle.data.name);
|
||||
// 触发插入对话
|
||||
DialogController.Instance.StartDialogNode("插入冷却液");
|
||||
}
|
||||
|
||||
public void RemoveBottle()
|
||||
{
|
||||
DialogController.Instance.SetVariable("$curBottleName", "");
|
||||
}
|
||||
|
||||
public void Lock()
|
||||
{
|
||||
isLocked = true;
|
||||
// 已锁定的瓶子禁止使用
|
||||
if (CurBottle)
|
||||
{
|
||||
CurBottle.IsBlock = true;
|
||||
}
|
||||
_pumpUI.CloseBuckle();
|
||||
}
|
||||
|
||||
public void StartPump()
|
||||
{
|
||||
// 进行泵机操作
|
||||
if (isLocked && CurBottle)
|
||||
{
|
||||
// 播放pump动画
|
||||
_pumpUI.PlayPumpAnime();
|
||||
// 播放泵机运行对话
|
||||
DialogController.Instance.StartDialogNode("泵机运行");
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator CloseBottleUI()
|
||||
{
|
||||
yield return _bottomUI.Hide();
|
||||
}
|
||||
|
||||
public IEnumerator CloseCoolingSystem()
|
||||
{
|
||||
yield return _pumpUI.Hide();
|
||||
}
|
||||
|
||||
public void StopPump()
|
||||
{
|
||||
// 冷却液界面
|
||||
_pumpUI.StopPumpAnime();
|
||||
_pumpUI.DestroyBottle();
|
||||
}
|
||||
|
||||
public IEnumerator PullOutTube()
|
||||
{
|
||||
yield return _tubeUI.PlayPullOutAnime();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public interface ICoolingSystem
|
||||
{
|
||||
// 打开冷却系统UI
|
||||
public IEnumerator OpenCoolingSystem();
|
||||
// 插管
|
||||
public IEnumerator LinkTube();
|
||||
// 打开左侧冷却液界面
|
||||
public IEnumerator OpenBottleUI();
|
||||
// 打开卡扣
|
||||
public void Unlock();
|
||||
// 插入冷却液瓶子
|
||||
public void InsertBottle(CoolingBottle bottle);
|
||||
// 移出冷却液瓶子
|
||||
public void RemoveBottle();
|
||||
// 关闭卡扣
|
||||
public void Lock();
|
||||
// 点击泵机开关
|
||||
public void StartPump();
|
||||
// 冷却液架收回
|
||||
public IEnumerator CloseBottleUI();
|
||||
// 冷却系统UI收回
|
||||
public IEnumerator CloseCoolingSystem();
|
||||
// 拔管
|
||||
public IEnumerator PullOutTube();
|
||||
// 停止泵机
|
||||
public void StopPump();
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5eec820fd32945b3bfa49381d6e90890
|
||||
timeCreated: 1734682124
|
||||
@@ -1,106 +0,0 @@
|
||||
using System.Collections;
|
||||
using AibisDream.Framework;
|
||||
using UnityEngine;
|
||||
using Yarn.Unity;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public static class CoolingSystemCommand
|
||||
{
|
||||
// 打开冷却系统UI
|
||||
[YarnCommand("open_cooling_system")]
|
||||
public static IEnumerator OpenCoolingSystem()
|
||||
{
|
||||
// var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// return cooling.OpenCoolingSystem();
|
||||
Debug.Log("冷却系统停用");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// 插管
|
||||
[YarnCommand("link_tube")]
|
||||
public static IEnumerator LinkTube()
|
||||
{
|
||||
// var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// return cooling.LinkTube();
|
||||
Debug.Log("冷却系统停用");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// 打开左侧冷却液界面
|
||||
[YarnCommand("open_bottle_ui")]
|
||||
public static IEnumerator OpenBottleUI()
|
||||
{
|
||||
// var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// return cooling.OpenBottleUI();
|
||||
Debug.Log("冷却系统停用");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// 打开卡扣
|
||||
[YarnCommand("unlock")]
|
||||
public static void Unlock()
|
||||
{
|
||||
// var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// cooling.Unlock();
|
||||
Debug.Log("冷却系统停用");
|
||||
}
|
||||
|
||||
// 关闭卡扣
|
||||
[YarnCommand("lock")]
|
||||
public static void Lock()
|
||||
{
|
||||
// var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// cooling.Lock();
|
||||
Debug.Log("冷却系统停用");
|
||||
}
|
||||
|
||||
// 点击泵机开关
|
||||
[YarnCommand("start_pump")]
|
||||
public static void StartPump()
|
||||
{
|
||||
// var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// cooling.StartPump();
|
||||
Debug.Log("冷却系统停用");
|
||||
}
|
||||
|
||||
// 冷却液架收回
|
||||
[YarnCommand("close_bottle_ui")]
|
||||
public static IEnumerator CloseBottleUI()
|
||||
{
|
||||
// var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// return cooling.CloseBottleUI();
|
||||
Debug.Log("冷却系统停用");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// 冷却系统UI收回
|
||||
[YarnCommand("close_cooling_system")]
|
||||
public static IEnumerator CloseCoolingSystem()
|
||||
{
|
||||
// var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// return cooling.CloseCoolingSystem();
|
||||
Debug.Log("冷却系统停用");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// 拔管
|
||||
[YarnCommand("pull_out_tube")]
|
||||
public static IEnumerator PullOutTube()
|
||||
{
|
||||
// var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// return cooling.PullOutTube();
|
||||
Debug.Log("冷却系统停用");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// 运行结束
|
||||
[YarnCommand("stop_pump")]
|
||||
public static void StopPump()
|
||||
{
|
||||
// var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// cooling.StopPump();
|
||||
Debug.Log("冷却系统停用");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b0dd86fff64466d893bbba5891722c4
|
||||
timeCreated: 1735114274
|
||||
@@ -1,168 +0,0 @@
|
||||
using System.Collections;
|
||||
using AibisDream.Framework;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public class PumpController : MonoBehaviour
|
||||
{
|
||||
[Header("整体位置")] public Vector3 hidePos;
|
||||
public Vector3 showPos;
|
||||
|
||||
public Vector3 topBuckleUnlockPos;
|
||||
public Vector3 leftBuckleUnlockPos;
|
||||
public Vector3 rightBuckleUnlockPos;
|
||||
public Vector3 topBuckleLockPos;
|
||||
public Vector3 leftBuckleLockPos;
|
||||
public Vector3 rightBuckleLockPos;
|
||||
|
||||
public Vector3 pumpUpPos;
|
||||
public Vector3 pumpDownPos;
|
||||
|
||||
[Header("移动用时")] public float showDuration;
|
||||
public float buckleDuration;
|
||||
public float pumpDuration;
|
||||
|
||||
#region 组件索引
|
||||
|
||||
private CoolingSystem _coolingSystem;
|
||||
|
||||
private SpriteButton _lockButton;
|
||||
private SpriteButton _pumpButton;
|
||||
private Transform _topBuckle;
|
||||
private Transform _leftBuckle;
|
||||
private Transform _rightBuckle;
|
||||
|
||||
[HideInInspector] public BottleSlot bottleSlot;
|
||||
private GameObject _lockBox;
|
||||
|
||||
private Transform _pumpHead;
|
||||
private GameObject _coolingScreen;
|
||||
|
||||
#endregion
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitRefs();
|
||||
transform.localPosition = hidePos;
|
||||
}
|
||||
|
||||
private void InitRefs()
|
||||
{
|
||||
// 初始化引用
|
||||
_coolingSystem = GetComponentInParent<CoolingSystem>();
|
||||
|
||||
var buckleGroup = transform.Find("按键卡扣组");
|
||||
|
||||
_lockButton = new SpriteButton(buckleGroup.Find("Lock Button").gameObject);
|
||||
_pumpButton = new SpriteButton(buckleGroup.Find("Pump Button").gameObject);
|
||||
_lockButton.OnButtonDown += LockButtonDown;
|
||||
_pumpButton.OnButtonDown += PumpButtonDown;
|
||||
|
||||
_topBuckle = buckleGroup.Find("上下卡扣");
|
||||
_leftBuckle = buckleGroup.Find("左卡扣");
|
||||
_rightBuckle = buckleGroup.Find("右卡扣");
|
||||
|
||||
_lockBox = buckleGroup.Find("锁定占位").gameObject;
|
||||
_lockBox.SetActive(true);
|
||||
|
||||
var pumpGroup = transform.Find("泵机组");
|
||||
_pumpHead = pumpGroup.Find("泵头");
|
||||
_coolingScreen = pumpGroup.Find("泵机运作时亮灯").gameObject;
|
||||
|
||||
bottleSlot = GetComponentInChildren<BottleSlot>();
|
||||
bottleSlot.InsertSlotEvent += _coolingSystem.InsertBottle;
|
||||
bottleSlot.RemoveSlotEvent += _coolingSystem.RemoveBottle;
|
||||
}
|
||||
|
||||
#region 按钮
|
||||
|
||||
private void LockButtonDown()
|
||||
{
|
||||
if (_coolingSystem.isLocked)
|
||||
{
|
||||
_coolingSystem.Unlock();
|
||||
}
|
||||
else
|
||||
{
|
||||
_coolingSystem.Lock();
|
||||
}
|
||||
}
|
||||
|
||||
private void PumpButtonDown()
|
||||
{
|
||||
_coolingSystem.StartPump();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_lockButton.CheckButtonClick();
|
||||
_pumpButton.CheckButtonClick();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 对外暴露
|
||||
|
||||
/// <summary>
|
||||
/// 显示泵机UI
|
||||
/// </summary>
|
||||
/// <returns>显示</returns>
|
||||
public IEnumerator Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
yield return transform.DOLocalMove(showPos, showDuration).WaitForCompletion();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏泵机UI
|
||||
/// </summary>
|
||||
/// <returns>隐藏</returns>
|
||||
public IEnumerator Hide()
|
||||
{
|
||||
yield return transform.DOLocalMove(hidePos, showDuration).WaitForCompletion();
|
||||
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OpenBuckle()
|
||||
{
|
||||
_lockBox.SetActive(false);
|
||||
|
||||
_topBuckle.DOLocalMove(topBuckleUnlockPos, buckleDuration);
|
||||
_leftBuckle.DOLocalMove(leftBuckleUnlockPos, buckleDuration);
|
||||
_rightBuckle.DOLocalMove(rightBuckleUnlockPos, buckleDuration);
|
||||
}
|
||||
|
||||
public void CloseBuckle()
|
||||
{
|
||||
_lockBox.SetActive(true);
|
||||
|
||||
_topBuckle.DOLocalMove(topBuckleLockPos, buckleDuration);
|
||||
_leftBuckle.DOLocalMove(leftBuckleLockPos, buckleDuration);
|
||||
_rightBuckle.DOLocalMove(rightBuckleLockPos, buckleDuration);
|
||||
}
|
||||
|
||||
public void PlayPumpAnime()
|
||||
{
|
||||
_pumpHead.DOLocalMove(pumpDownPos, pumpDuration).SetLoops(-1, LoopType.Yoyo)
|
||||
.SetEase(Ease.Linear);
|
||||
_coolingScreen.SetActive(true);
|
||||
}
|
||||
|
||||
public void StopPumpAnime()
|
||||
{
|
||||
_pumpHead.DOKill();
|
||||
_pumpHead.localPosition = pumpUpPos;
|
||||
_coolingScreen.SetActive(false);
|
||||
}
|
||||
|
||||
public void DestroyBottle()
|
||||
{
|
||||
bottleSlot.DestroyBottle();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c0964c55b8c49458ad7740405fde98a
|
||||
timeCreated: 1734708209
|
||||
@@ -1,103 +0,0 @@
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public class TubeController : MonoBehaviour
|
||||
{
|
||||
[Header("插管蒙太奇整体位置")]
|
||||
public Vector3 showPos;
|
||||
public Vector3 hidePos;
|
||||
|
||||
[Header("管子位置")]
|
||||
public Vector3 pullOutPos;
|
||||
public Vector3 linkPos;
|
||||
|
||||
[Header("动画时间")]
|
||||
public float showDuration;
|
||||
public float plugDuration;
|
||||
|
||||
private Transform _tube;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitRefs();
|
||||
}
|
||||
|
||||
private void InitRefs()
|
||||
{
|
||||
_tube = transform.Find("插线");
|
||||
|
||||
_tube.localPosition = pullOutPos;
|
||||
transform.localPosition = hidePos;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 播放连接动画
|
||||
/// </summary>
|
||||
/// <returns>协程</returns>
|
||||
public IEnumerator PlayLinkAnime()
|
||||
{
|
||||
yield return ShowAndHide(LinkAction());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 播放拔出动画
|
||||
/// </summary>
|
||||
/// <returns>协程</returns>
|
||||
public IEnumerator PlayPullOutAnime()
|
||||
{
|
||||
yield return ShowAndHide(PullOutAction());
|
||||
}
|
||||
|
||||
private IEnumerator LinkAction()
|
||||
{
|
||||
// 插线
|
||||
Tween link = _tube.DOLocalMove(linkPos, plugDuration);
|
||||
while (link.active && !link.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
// 插完线后更新人物图片
|
||||
ClinicYarnCommand.AddLinkDevice();
|
||||
}
|
||||
|
||||
private IEnumerator PullOutAction()
|
||||
{
|
||||
// 拔线
|
||||
Tween pullOut = _tube.DOLocalMove(pullOutPos, plugDuration);
|
||||
while (pullOut.active && !pullOut.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
// 插完线后更新人物图片
|
||||
ClinicYarnCommand.RemoveLinkDevice();
|
||||
}
|
||||
|
||||
private IEnumerator ShowAndHide(IEnumerator middleAction)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
// 打开插管部分
|
||||
Tween showTween = transform.DOLocalMove(showPos, showDuration);
|
||||
while (showTween.active && !showTween.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
// 暂停一下
|
||||
yield return new WaitForSeconds(2f);
|
||||
// 中间动作
|
||||
yield return middleAction;
|
||||
// 暂停一下
|
||||
yield return new WaitForSeconds(2f);
|
||||
// 关闭插管部分
|
||||
Tween hideTween = transform.DOLocalMove(hidePos, showDuration);
|
||||
while (hideTween.active && !hideTween.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c57722dc077140e9b09a39b870ef4d8c
|
||||
timeCreated: 1734685901
|
||||
@@ -30,11 +30,11 @@ namespace AibisDream.FixSystem
|
||||
public IEnumerator SwitchState(FixState nextState, string args = "")
|
||||
{
|
||||
if (CurState == nextState) yield break;
|
||||
|
||||
|
||||
_curArgs = args;
|
||||
|
||||
yield return _curState?.Exit();
|
||||
|
||||
|
||||
_curState = CreateState(nextState, _curArgs);
|
||||
|
||||
EnumEventSystem.Global.Send(EventEnum.FixStateSwitch, nextState);
|
||||
@@ -54,7 +54,6 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
FixState.Clinic => new ClinicState(),
|
||||
FixState.Engine => new EngineState(),
|
||||
FixState.CoolingMachine => new CoolingMachineState(),
|
||||
FixState.BodyModule => new BodyModuleState(),
|
||||
FixState.Memory => new MemoryState(),
|
||||
FixState.Eye => new EyeState(),
|
||||
@@ -72,7 +71,6 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
Default,
|
||||
Clinic,
|
||||
CoolingMachine,
|
||||
BodyModule,
|
||||
Memory,
|
||||
Eye,
|
||||
@@ -212,43 +210,6 @@ namespace AibisDream.FixSystem
|
||||
}
|
||||
}
|
||||
|
||||
public struct CoolingMachineState : IState
|
||||
{
|
||||
private bool _playLink;
|
||||
|
||||
public FixState GetState => FixState.CoolingMachine;
|
||||
|
||||
public void SetArgs(string args)
|
||||
{
|
||||
_playLink = !string.IsNullOrEmpty(args);
|
||||
}
|
||||
|
||||
public IEnumerator Enter()
|
||||
{
|
||||
var coolingSystem = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
// 切相机
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CoolingMachine);
|
||||
|
||||
// 打开泵机
|
||||
coolingSystem.gameObject.SetActive(true);
|
||||
yield return coolingSystem.OpenCoolingSystem();
|
||||
// 播放插线动画
|
||||
if (_playLink)
|
||||
{
|
||||
yield return coolingSystem.LinkTube();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator Exit()
|
||||
{
|
||||
var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
|
||||
yield return cooling.CloseBottleUI();
|
||||
yield return cooling.CloseCoolingSystem();
|
||||
yield return new WaitForSeconds(1f);
|
||||
}
|
||||
}
|
||||
|
||||
public struct UfState : IState
|
||||
{
|
||||
public FixState GetState => FixState.UF;
|
||||
@@ -260,8 +221,8 @@ namespace AibisDream.FixSystem
|
||||
public IEnumerator Enter()
|
||||
{
|
||||
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
||||
var UFSystem = FixSystemCenter.SystemDic.Get<UFSystem>();
|
||||
var EyeSystem = FixSystemCenter.SystemDic.Get<EyeSystem>();
|
||||
var ufSystem = FixSystemCenter.SystemDic.Get<UFSystem>();
|
||||
var eyeSystem = FixSystemCenter.SystemDic.Get<EyeSystem>();
|
||||
// 先切BodyModule
|
||||
if (!CameraKit.Instance.EqualToCameraState(CameraEnum.BodyModule))
|
||||
{
|
||||
@@ -273,20 +234,20 @@ namespace AibisDream.FixSystem
|
||||
// 切换相机
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.UF);
|
||||
yield return MainUIController.Instance?.FadeInSync(0.5f);
|
||||
UFSystem.OpenUFView();
|
||||
ufSystem.OpenUFView();
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.EyeDeep);
|
||||
EyeSystem.OnEnter();
|
||||
eyeSystem.OnEnter();
|
||||
yield return MainUIController.Instance?.FadeOutSync(0.5f);
|
||||
}
|
||||
|
||||
public IEnumerator Exit()
|
||||
{
|
||||
float duration = 0.5f;
|
||||
var UFSystem = FixSystemCenter.SystemDic.Get<UFSystem>();
|
||||
var ufSystem = FixSystemCenter.SystemDic.Get<UFSystem>();
|
||||
var eyeSystem = FixSystemCenter.SystemDic.Get<EyeSystem>();
|
||||
yield return MainUIController.Instance?.FadeInSync(duration);
|
||||
eyeSystem.OnExit();
|
||||
UFSystem.CloseUFView();
|
||||
ufSystem.CloseUFView();
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.UF);
|
||||
yield return MainUIController.Instance?.FadeOutSync(duration);
|
||||
yield return null;
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Utility;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using UnityEngine;
|
||||
using Yarn.Unity;
|
||||
|
||||
@@ -16,8 +9,6 @@ namespace AibisDream
|
||||
{
|
||||
public class GameLoopManager : Singleton<GameLoopManager>
|
||||
{
|
||||
private const int MaxSaveNum = 200;
|
||||
private static readonly string SaveFilePath = Application.streamingAssetsPath + "/SaveFiles";
|
||||
private static readonly string TestSaveFilePath = Application.streamingAssetsPath + "/TestSaveFiles";
|
||||
|
||||
#region 运行模式相关
|
||||
@@ -68,6 +59,7 @@ namespace AibisDream
|
||||
// 数据类注册
|
||||
StorageSystem.Instance.RegisterData(_data);
|
||||
// 场景So事件注册
|
||||
_currentTalkSceneSo = new BindProperty<TalkSceneSO>();
|
||||
_currentTalkSceneSo.Register(item => _data.curSceneSoName = item.name);
|
||||
}
|
||||
|
||||
@@ -143,7 +135,7 @@ namespace AibisDream
|
||||
|
||||
public void StartDialog()
|
||||
{
|
||||
DialogController.Instance.StartDialog(_currentTalkSceneSo.Value.yarnProject);
|
||||
DialogController.Instance.LoadDialog(_currentTalkSceneSo.Value.yarnProject);
|
||||
}
|
||||
|
||||
#region 重新开始游戏功能
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace AibisDream
|
||||
{
|
||||
if (_shaftGraph.AllNewGear())
|
||||
{
|
||||
DialogController.Instance?.SetVariable("$allNewGear", true);
|
||||
StorageSystem.Instance?.SetValue("$allNewGear", true);
|
||||
}
|
||||
DialogController.Instance?.StartDialogNode("AllGearsRunning");
|
||||
}
|
||||
@@ -157,7 +157,7 @@ namespace AibisDream
|
||||
{
|
||||
if (!_isTargetReached)
|
||||
{
|
||||
DialogController.Instance?.SetVariable("$speedReached", true);
|
||||
StorageSystem.Instance?.SetValue("$speedReached", true);
|
||||
_isTargetReached = true;
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ namespace AibisDream
|
||||
{
|
||||
if (_isTargetReached)
|
||||
{
|
||||
DialogController.Instance?.SetVariable("$speedReached", false);
|
||||
StorageSystem.Instance?.SetValue("$speedReached", false);
|
||||
_isTargetReached = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,11 +109,11 @@ namespace AibisDream
|
||||
|
||||
if (IsDisc)
|
||||
{
|
||||
DialogController.Instance?.SetVariable("$discIdx", discIdx);
|
||||
StorageSystem.Instance?.SetValue("$discIdx", discIdx);
|
||||
}
|
||||
|
||||
// 传当前插入齿轮的Prop
|
||||
DialogController.Instance?.SetVariable("$curGearProp", childGear.gearProp);
|
||||
StorageSystem.Instance?.SetValue("$curGearProp", childGear.gearProp);
|
||||
}
|
||||
|
||||
public void PlugOutGear()
|
||||
|
||||
@@ -122,7 +122,7 @@ public class EyeSystem : MonoBehaviour
|
||||
yield break;
|
||||
}
|
||||
|
||||
DialogController.Instance.SetVariable("$currentEyeTarget", target.name);
|
||||
StorageSystem.Instance.SetValue("$currentEyeTarget", target.name);
|
||||
StartCoroutine(EyeEffectFadeOut());
|
||||
|
||||
cameraManager.MoveCameraTo(target.targetTransform ? target.targetTransform : target.transform, 1f);
|
||||
|
||||
Reference in New Issue
Block a user