重构插线和深入的逻辑,加入剪线的timeline

This commit is contained in:
2024-12-25 03:48:06 +08:00
parent c3876895d6
commit cc4d3a5a05
26 changed files with 4478 additions and 214 deletions
@@ -11,12 +11,12 @@ namespace AibisDream.FixSystem
private const string SocketObjName = "Socket";
private const string ModulePicName = "Module Pic";
private const string IndicatorName = "Indicator";
public Transform _socketPos;
public Transform _indicatorPos;
// public Transform _indicatorPos;
private BodyModuleSystem _bodyModuleSystem;
private Material highlightMaterial;
private Material alarmMaterial;
private Material alarmMaterial;
private Material originalMaterial; // 原材质
private SpriteRenderer targetSpriteRenderer; // 目标的 SpriteRenderer
@@ -32,20 +32,18 @@ namespace AibisDream.FixSystem
// 获取组件索引
InitReference();
}
private void InitReference()
{
_socketPos = transform.Find(SocketObjName);
_bodyModuleSystem = transform.parent.parent.GetComponent<BodyModuleSystem>();
targetSpriteRenderer=transform.Find("Socket").GetComponent<SpriteRenderer>();
targetSpriteRenderer=transform.Find("Module Pic").GetComponent<SpriteRenderer>();
originalMaterial = targetSpriteRenderer.GetComponent<SpriteRenderer>().material;
highlightMaterial = Resources.Load<Material>("Materials/HighlightMaterial");
alarmMaterial=Resources.Load<Material>("Materials/AlarmMaterial");
}
#region
public bool IsAvailable()
{
return available;
@@ -54,11 +52,10 @@ namespace AibisDream.FixSystem
{
available=isAvailable;
}
public void PlugIn()
{
// 插入后先播放wave
ShowWave();
//ShowWave();
if(DialogController.Instance!=null)
// 然后触发Yarn节点
DialogController.Instance.StartDialogNode(_bodyModuleSystem.inHotErr ? "系统过热" : data.PlugInNodeName);
@@ -66,16 +63,18 @@ namespace AibisDream.FixSystem
public void PlugOut()
{
_bodyModuleSystem.oscilloscopeSystem.MessageBoxSetNull();
StartCoroutine(_bodyModuleSystem.oscilloscopeSystem.DisableDeepInButton());
// 先关闭wave
_bodyModuleSystem.oscilloscopeSystem.ShowScreenMessage("未插入任何模块", Color.white);
CloseWave();
//_bodyModuleSystem.oscilloscopeSystem.ShowScreenMessage("未插入任何模块", Color.white);
//CloseWave();
// TODO 触发Yarn节点(似乎目前没有拔出对话?)
}
public void DeepIn()
{
if (!data.waveHasError&&!data.ignoreWaveCheck) return;
// 如果有错误并且已经深入了
// if (!data.waveHasError&&!data.ignoreWaveCheck) return;
// // 如果有错误并且已经深入了
if(DialogController.Instance!=null)
DialogController.Instance.StartDialogNode(data.DeepInNodeName);
}
@@ -142,6 +141,7 @@ namespace AibisDream.FixSystem
{
var modulePic = transform.Find(ModulePicName).GetComponent<SpriteRenderer>();
var socketPos = transform.Find(SocketObjName);
//var indicatorPos = transform.Find(IndicatorName);
return new BodyModuleData
{
@@ -152,7 +152,9 @@ namespace AibisDream.FixSystem
waveformType = data.waveformType,
waveHasError = data.waveHasError,
ignoreWaveCheck = data.ignoreWaveCheck,
cantStopRunning=data.cantStopRunning
cantStopRunning=data.cantStopRunning,
//IndicatorPos=indicatorPos.localPosition
//indicatorPos= indicatorPos.position
};
}
@@ -198,6 +200,8 @@ namespace AibisDream.FixSystem
public SerializableVector3 modulePos;
public SerializableVector3 socketPos;
public SerializableVector3 indicatorPos;
// 功能信息
public WaveformType waveformType;
@@ -231,5 +235,11 @@ namespace AibisDream.FixSystem
get => socketPos.ToVector3();
set => socketPos = new SerializableVector3(value);
}
// [JsonIgnore]
// public Vector3 IndicatorPos
// {
// get => indicatorPos.ToVector3();
// set => indicatorPos = new SerializableVector3(value);
// }
}
}