重构插线和深入的逻辑,加入剪线的timeline
This commit is contained in:
@@ -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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ namespace AibisDream
|
||||
public static class BodyModuleYarnCommand
|
||||
{
|
||||
private static BodyModuleSystem BodyModuleSystem => FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
||||
private static OscilloscopeSystem OscilloscopeSystem => FixSystemCenter.SystemDic.Get<OscilloscopeSystem>();
|
||||
|
||||
|
||||
[YarnCommand("SetModuleState_CantStopRunning")]
|
||||
@@ -68,7 +69,7 @@ namespace AibisDream
|
||||
[YarnCommand("Temp_InstallChip")]
|
||||
public static void Temp_InstallChip()
|
||||
{
|
||||
var _UFCover = BodyModuleSystem.FindBodyModuleByName("Color").transform.Find("Module Pic").gameObject;
|
||||
var _UFCover = BodyModuleSystem.FindBodyModuleByName("Color").transform.Find("Chip").gameObject;
|
||||
if(!_UFCover.activeInHierarchy)
|
||||
{
|
||||
_UFCover.SetActive(true);
|
||||
@@ -77,7 +78,7 @@ namespace AibisDream
|
||||
[YarnCommand("Temp_RemoveChip")]
|
||||
public static void Temp_RemoveChip()
|
||||
{
|
||||
var _UFCover = BodyModuleSystem.FindBodyModuleByName("Color").transform.Find("Module Pic").gameObject;
|
||||
var _UFCover = BodyModuleSystem.FindBodyModuleByName("Color").transform.Find("Chip").gameObject;
|
||||
if(_UFCover.activeInHierarchy)
|
||||
{
|
||||
_UFCover.SetActive(false);
|
||||
@@ -101,5 +102,45 @@ namespace AibisDream
|
||||
var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName);
|
||||
targetModule.Alarm(enable);
|
||||
}
|
||||
[YarnCommand("MessageBoxSetError")]
|
||||
public static void MessageBoxSetError()
|
||||
{
|
||||
OscilloscopeSystem.MessageBoxSetError();
|
||||
}
|
||||
[YarnCommand("MessageBoxSetWarning")]
|
||||
public static void MessageBoxSetWarning()
|
||||
{
|
||||
OscilloscopeSystem.MessageBoxSetWarning();
|
||||
}
|
||||
[YarnCommand("MessageBoxSetNormal")]
|
||||
public static void MessageBoxSetNormal()
|
||||
{
|
||||
OscilloscopeSystem.MessageBoxSetNormal();
|
||||
}
|
||||
[YarnCommand("MessageBoxSetChecking")]
|
||||
public static void MessageBoxSetChecking()
|
||||
{
|
||||
OscilloscopeSystem.MessageBoxSetChecking();
|
||||
}
|
||||
[YarnCommand("MessageBoxSetNull")]
|
||||
public static void MessageBoxSetNull()
|
||||
{
|
||||
OscilloscopeSystem.MessageBoxSetNull();
|
||||
}
|
||||
[YarnCommand("MessageBoxSetText")]
|
||||
public static void MessageBoxSetText(string text)
|
||||
{
|
||||
OscilloscopeSystem.MessageBoxSetText(text);
|
||||
}
|
||||
[YarnCommand("EnableDeepInButton")]
|
||||
public static void EnableDeepInButton()
|
||||
{
|
||||
OscilloscopeSystem.StartCoroutine(OscilloscopeSystem.EnableDeepInButton());
|
||||
}
|
||||
[YarnCommand("DisableDeepInButton")]
|
||||
public static void DisableDeepInButton()
|
||||
{
|
||||
OscilloscopeSystem.StartCoroutine(OscilloscopeSystem.DisableDeepInButton());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using AibisDream.Utility;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
using Febucci.UI;
|
||||
using Random = UnityEngine.Random;
|
||||
using System.Collections;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
@@ -10,8 +13,8 @@ namespace AibisDream.FixSystem
|
||||
#region 组件索引
|
||||
|
||||
private BodyModuleSystem _bodyModuleSystem;
|
||||
|
||||
private TMP_Text _screenText;
|
||||
public TMP_Text state; // 显示状态的TextMeshPro组件
|
||||
private TMP_Text _screenText;// 显示消息的TextMeshPro组件
|
||||
private WaveformLine _waveformLine;
|
||||
private ScanLine _scanLine;
|
||||
private SpriteRenderer _screen;
|
||||
@@ -44,10 +47,10 @@ namespace AibisDream.FixSystem
|
||||
_screen = transform.Find("Screen").GetComponent<SpriteRenderer>();
|
||||
_waveSlider = transform.Find("Wave Slider").GetComponent<WaveSlider>();
|
||||
_deepinButton = new SpriteButton(transform.Find("Deepin Button").gameObject, false);
|
||||
|
||||
_waveformLine.SetLineSize(_screen.bounds.size.x, _screen.bounds.size.y);
|
||||
_scanLine.SetScreenSize(_screen.bounds.size.x, _screen.bounds.size.y);
|
||||
_screenText.text = "";
|
||||
//_screenText.text = "";
|
||||
MessageBoxSetNull();
|
||||
|
||||
_deepinButton.OnButtonDown += HandleDeepInButtonClick;
|
||||
_scanLine.ScanErrorEvent += OnScanSuccess;
|
||||
@@ -119,14 +122,15 @@ namespace AibisDream.FixSystem
|
||||
}
|
||||
public void HandleDeepInButtonClick()
|
||||
{
|
||||
if(_bodyModuleSystem.CableSystem.curBodyModule.data.ignoreWaveCheck==true)
|
||||
{
|
||||
_bodyModuleSystem.HandleDeepIn();
|
||||
}
|
||||
else
|
||||
{
|
||||
StartScan();
|
||||
}
|
||||
// if(_bodyModuleSystem.CableSystem.curBodyModule.data.ignoreWaveCheck==true)
|
||||
// {
|
||||
// _bodyModuleSystem.HandleDeepIn();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// StartScan();
|
||||
// }
|
||||
_bodyModuleSystem.HandleDeepIn();
|
||||
}
|
||||
|
||||
|
||||
@@ -159,8 +163,62 @@ namespace AibisDream.FixSystem
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
public void MessageBoxSetError()
|
||||
{
|
||||
state.text = "错误";
|
||||
state.color = Color.red; // 红色
|
||||
// _screenText.text = message;
|
||||
// _screenText.color = Color.white; // 默认文本颜色
|
||||
}
|
||||
|
||||
public void MessageBoxSetWarning()
|
||||
{
|
||||
state.text = "警告";
|
||||
state.color = new Color(1.0f, 0.55f, 0.0f); // 琥珀色
|
||||
// _screenText.text = message;
|
||||
// _screenText.color = Color.white; // 默认文本颜色
|
||||
}
|
||||
public void MessageBoxSetNormal()
|
||||
{
|
||||
state.text = "正常";
|
||||
state.color = Color.blue; // 琥珀色
|
||||
// _screenText.text = message;
|
||||
// _screenText.color = Color.white; // 默认文本颜色
|
||||
}
|
||||
public void MessageBoxSetChecking()
|
||||
{
|
||||
state.text = "检查中";
|
||||
state.color = Color.white; // 琥珀色
|
||||
// _screenText.text = string.Empty;
|
||||
// _screenText.color = Color.white; // 默认文本颜色
|
||||
}
|
||||
public void MessageBoxSetText(string text)
|
||||
{
|
||||
_screenText.color = Color.white; // 默认文本颜色
|
||||
_screenText.text += text+"<br>";
|
||||
}
|
||||
public void MessageBoxSetNull()
|
||||
{
|
||||
state.text = "未检测到信号";
|
||||
state.color = Color.white; // 蓝色
|
||||
_screenText.text = string.Empty;
|
||||
_screenText.color = Color.white; // 默认文本颜色
|
||||
}
|
||||
public IEnumerator EnableDeepInButton()
|
||||
{
|
||||
yield return _deepinButton.GetTransform().DOLocalMoveX(0.5f, 0.5f).WaitForCompletion();
|
||||
_deepinButton.SetActive(true);
|
||||
|
||||
}
|
||||
public IEnumerator DisableDeepInButton()
|
||||
{
|
||||
yield return _deepinButton.GetTransform().DOLocalMoveX(-0.1f, 0.5f).WaitForCompletion();
|
||||
_deepinButton.SetActive(false);
|
||||
|
||||
}
|
||||
}
|
||||
public enum WaveformType
|
||||
{
|
||||
Default,
|
||||
|
||||
Reference in New Issue
Block a user