Merge remote-tracking branch 'origin/12月版本优化' into feature/merge
This commit is contained in:
@@ -25,11 +25,14 @@ public class ClueInteraction : MonoBehaviour, IPointerEnterHandler, IPointerExit
|
||||
|
||||
private bool isLocked=false;
|
||||
|
||||
private MemoryClueSlot slot;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
canvas = GetComponentInParent<Canvas>();
|
||||
clueItem = GetComponent<ClueItem>();
|
||||
rectTransform = GetComponent<RectTransform>();
|
||||
slot=FindObjectOfType<MemoryClueSlot>();
|
||||
|
||||
// 存储初始尺寸属性
|
||||
StoreOriginalTransform();
|
||||
@@ -92,13 +95,17 @@ public class ClueInteraction : MonoBehaviour, IPointerEnterHandler, IPointerExit
|
||||
{
|
||||
if (!isFavorited||isLocked) return;
|
||||
|
||||
transform.position = Input.mousePosition;
|
||||
transform.position = Input.mousePosition+new Vector3(0,200,0);
|
||||
transform.rotation = Quaternion.Euler(0, 0, -90f);
|
||||
}
|
||||
|
||||
public void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
slot.OnDrop(eventData);
|
||||
|
||||
if (!isFavorited||isLocked) return;
|
||||
|
||||
|
||||
if (transform.parent == canvas.transform)
|
||||
{
|
||||
ReturnToOriginalPosition();
|
||||
@@ -109,6 +116,7 @@ public class ClueInteraction : MonoBehaviour, IPointerEnterHandler, IPointerExit
|
||||
public void ReturnToOriginalPosition()
|
||||
{
|
||||
isLocked=false;
|
||||
transform.rotation = Quaternion.Euler(0, 0, 0);
|
||||
transform.SetParent(originalParent);
|
||||
rectTransform.anchorMin = originalAnchorMin;
|
||||
rectTransform.anchorMax = originalAnchorMax;
|
||||
@@ -134,4 +142,8 @@ public class ClueInteraction : MonoBehaviour, IPointerEnterHandler, IPointerExit
|
||||
{
|
||||
this.isFavorited = isFavorited;
|
||||
}
|
||||
public void SetIsLock(bool isLocked)
|
||||
{
|
||||
this.isLocked = isLocked;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
using System.Numerics;
|
||||
|
||||
public class ClueSlotBase : MonoBehaviour, IDropHandler
|
||||
{
|
||||
@@ -11,6 +13,11 @@ public class ClueSlotBase : MonoBehaviour, IDropHandler
|
||||
protected RectTransform OriginalTransform; // Clue 的交互
|
||||
[HideInInspector]
|
||||
public ClueItem currentClueItem; // 当前插入的 ClueItem
|
||||
public Image punchTapeImage;
|
||||
public Image coverClose;
|
||||
public Image coverOpen;
|
||||
|
||||
private RectTransform punchtapeStartpos;
|
||||
|
||||
[HideInInspector]
|
||||
public bool isOccupied = false; // 插槽是否已占用
|
||||
@@ -18,27 +25,24 @@ public class ClueSlotBase : MonoBehaviour, IDropHandler
|
||||
[HideInInspector]
|
||||
public bool isLocked = false; // 插槽是否已占用
|
||||
|
||||
private Image slotFrame;
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
currentClueItem = null;
|
||||
slotFrame=transform.GetChild(0).GetComponent<Image>();
|
||||
coverClose.enabled=false;
|
||||
coverOpen.enabled=true;
|
||||
punchTapeImage.enabled=false;
|
||||
punchtapeStartpos=punchTapeImage.rectTransform;
|
||||
//slotFrame.color=Color.white;
|
||||
}
|
||||
public void SetSlotCorrect()
|
||||
{
|
||||
slotFrame.color=Color.green;
|
||||
|
||||
SetSlotLockState(true);
|
||||
}
|
||||
|
||||
public void OnDrop(PointerEventData eventData)
|
||||
{
|
||||
// if (isOccupied)
|
||||
// {
|
||||
// Debug.Log("ClueSlot locked");
|
||||
// return;
|
||||
// }
|
||||
ClueItem clueItem = eventData.pointerDrag.GetComponent<ClueItem>();
|
||||
if (clueItem != null)
|
||||
{
|
||||
@@ -47,16 +51,21 @@ public void OnDrop(PointerEventData eventData)
|
||||
|
||||
if (clue != null && interaction != null&&!isOccupied)
|
||||
{
|
||||
|
||||
interaction.SetIsLock(true);
|
||||
// 更新当前的 ClueItem
|
||||
currentClueItem = clueItem;
|
||||
isOccupied = true;
|
||||
// 调整位置和父对象
|
||||
RectTransform slotRectTransform = GetComponent<RectTransform>();
|
||||
interaction.SetClueParentAndPosition(slotRectTransform);
|
||||
|
||||
// 调用虚方法处理插入逻辑
|
||||
OnClueInserted(clue);
|
||||
Destroy(clueItem);
|
||||
punchTapeImage.enabled=true;
|
||||
punchTapeImage.rectTransform.DOAnchorPosY(-473f,2f)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
punchTapeImage.enabled=false;
|
||||
|
||||
punchTapeImage.rectTransform.DOAnchorPosY(-3f,0.1f);
|
||||
OnClueInserted(clue);
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -65,17 +74,12 @@ public void OnDrop(PointerEventData eventData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 释放插槽时调用
|
||||
public virtual void ReleaseSlot()
|
||||
{
|
||||
//FavoritesManager.Instance.RemoveClue(currentClueItem.GetClueData());
|
||||
if (currentClueItem != null)
|
||||
{
|
||||
currentClueItem.used=true;
|
||||
ReturnClueToCollection(currentClueItem);
|
||||
}
|
||||
Debug.Log("释放记忆插槽");
|
||||
coverClose.enabled=false;
|
||||
coverOpen.enabled=true;
|
||||
isOccupied = false;
|
||||
currentClueItem = null;
|
||||
interaction = null;
|
||||
|
||||
@@ -86,22 +86,22 @@ public class FavoritesManager : MonoBehaviour
|
||||
|
||||
public void RemoveClue(Clue clue)
|
||||
{
|
||||
if (clue.ClueType==ClueType.PunchTape)
|
||||
{
|
||||
if (punchTapeFavorites.Contains(clue))
|
||||
{
|
||||
// if (clue.ClueType==ClueType.PunchTape)
|
||||
// {
|
||||
// if (punchTapeFavorites.Contains(clue))
|
||||
// {
|
||||
punchTapeFavorites.Remove(clue);
|
||||
UpdateFavoritesUI();
|
||||
}
|
||||
}
|
||||
if (clue.ClueType==ClueType.ImageClue)
|
||||
{
|
||||
if (punchTapeFavorites.Contains(clue))
|
||||
{
|
||||
punchTapeFavorites.Remove(clue);
|
||||
UpdateFavoritesUI();
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// if (clue.ClueType==ClueType.ImageClue)
|
||||
// {
|
||||
// if (punchTapeFavorites.Contains(clue))
|
||||
// {
|
||||
// punchTapeFavorites.Remove(clue);
|
||||
// UpdateFavoritesUI();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
private void UpdateFavoritesUI()
|
||||
{
|
||||
@@ -158,6 +158,7 @@ public class FavoritesManager : MonoBehaviour
|
||||
|
||||
public void CloseFavorites()
|
||||
{
|
||||
UpdateFavoritesUI();
|
||||
isFavoritesOpen = false;
|
||||
|
||||
// 用DOTween移动回右侧屏幕外
|
||||
|
||||
@@ -10,21 +10,19 @@ public class MemoryClueSlot : ClueSlotBase
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start(); // 初始化基类中的内容
|
||||
memoryManager = FindObjectOfType<MemoryProcess>();
|
||||
memoryManager = FindObjectOfType<MemoryProcess>();
|
||||
expectedClueType=ClueType.PunchTape;
|
||||
}
|
||||
|
||||
// 重写基类的 OnClueInserted 方法,处理播放记忆的逻辑
|
||||
protected override void OnClueInserted(Clue clue)
|
||||
{
|
||||
|
||||
if (clue is PunchTape)
|
||||
{
|
||||
punchTape = clue as PunchTape;
|
||||
//punchTape.used=true;
|
||||
coverClose.enabled=true;
|
||||
coverOpen.enabled=false;
|
||||
PlayMemory(punchTape);
|
||||
FavoritesManager.Instance.RemoveClue(clue);
|
||||
}
|
||||
|
||||
}
|
||||
public override void ReleaseSlot()
|
||||
{
|
||||
|
||||
@@ -10,14 +10,6 @@ public class Socket : MonoBehaviour, ISocket
|
||||
public Plug plug=null;
|
||||
private YarnOption _option;
|
||||
private bool waitYarnCommand = false;
|
||||
|
||||
// private int heatNum=0;
|
||||
|
||||
// public int HeatNum()
|
||||
// {
|
||||
// return heatNum;
|
||||
// }
|
||||
|
||||
public bool WaitYarnCommand
|
||||
{
|
||||
get { return waitYarnCommand; }
|
||||
|
||||
@@ -23,25 +23,25 @@ public class MessageBox : MonoBehaviour
|
||||
}
|
||||
}
|
||||
// Yarn Command处理方法
|
||||
[YarnCommand("messagebox")]
|
||||
public void HandleMessageBoxCommand(string type, string message)
|
||||
{
|
||||
switch (type.ToLower())
|
||||
{
|
||||
case "warning":
|
||||
SetWarning(message);
|
||||
break;
|
||||
case "normal":
|
||||
SetNormal(message);
|
||||
break;
|
||||
case "null":
|
||||
SetNull();
|
||||
break;
|
||||
default:
|
||||
Debug.LogError("Invalid message type for messagebox command: " + type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// [YarnCommand("messagebox")]
|
||||
// public void HandleMessageBoxCommand(string type, string message)
|
||||
// {
|
||||
// switch (type.ToLower())
|
||||
// {
|
||||
// case "warning":
|
||||
// SetWarning(message);
|
||||
// break;
|
||||
// case "normal":
|
||||
// SetNormal(message);
|
||||
// break;
|
||||
// case "null":
|
||||
// SetNull();
|
||||
// break;
|
||||
// default:
|
||||
// Debug.LogError("Invalid message type for messagebox command: " + type);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
private void Start()
|
||||
{
|
||||
SetNull();
|
||||
@@ -54,7 +54,7 @@ public class MessageBox : MonoBehaviour
|
||||
state.color = Color.red; // 红色
|
||||
text.text = message;
|
||||
text.color = Color.white; // 默认文本颜色
|
||||
StartCoroutine(FlashWarning()); // 开始闪烁效果
|
||||
//StartCoroutine(FlashWarning()); // 开始闪烁效果
|
||||
}
|
||||
|
||||
// 设置为Normal状态
|
||||
@@ -64,7 +64,7 @@ public class MessageBox : MonoBehaviour
|
||||
state.color = new Color(1.0f, 0.55f, 0.0f); // 琥珀色
|
||||
text.text = message;
|
||||
text.color = Color.white; // 默认文本颜色
|
||||
StopCoroutine(FlashWarning()); // 停止闪烁效果(如果正在闪烁)
|
||||
//StopCoroutine(FlashWarning()); // 停止闪烁效果(如果正在闪烁)
|
||||
}
|
||||
|
||||
// 设置为Null状态
|
||||
@@ -74,7 +74,7 @@ public class MessageBox : MonoBehaviour
|
||||
state.color = Color.blue; // 蓝色
|
||||
text.text = string.Empty;
|
||||
text.color = Color.white; // 默认文本颜色
|
||||
StopCoroutine(FlashWarning()); // 停止闪烁效果(如果正在闪烁)
|
||||
//StopCoroutine(FlashWarning()); // 停止闪烁效果(如果正在闪烁)
|
||||
}
|
||||
|
||||
// 闪烁警告效果
|
||||
|
||||
@@ -11,9 +11,16 @@ 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;
|
||||
private BodyModuleSystem _bodyModuleSystem;
|
||||
|
||||
private Material highlightMaterial;
|
||||
private Material alarmMaterial;
|
||||
private Material originalMaterial; // 原材质
|
||||
|
||||
private SpriteRenderer targetSpriteRenderer; // 目标的 SpriteRenderer
|
||||
|
||||
#endregion
|
||||
|
||||
// 模块基本数据
|
||||
@@ -25,15 +32,18 @@ namespace AibisDream.FixSystem
|
||||
// 获取组件索引
|
||||
InitReference();
|
||||
}
|
||||
|
||||
private void InitReference()
|
||||
{
|
||||
_socketPos = transform.Find(SocketObjName);
|
||||
_bodyModuleSystem = transform.parent.parent.GetComponent<BodyModuleSystem>();
|
||||
|
||||
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;
|
||||
@@ -42,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);
|
||||
@@ -54,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);
|
||||
}
|
||||
@@ -130,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
|
||||
{
|
||||
@@ -140,13 +152,40 @@ namespace AibisDream.FixSystem
|
||||
waveformType = data.waveformType,
|
||||
waveHasError = data.waveHasError,
|
||||
ignoreWaveCheck = data.ignoreWaveCheck,
|
||||
cantStopRunning=data.cantStopRunning
|
||||
cantStopRunning=data.cantStopRunning,
|
||||
//IndicatorPos=indicatorPos.localPosition
|
||||
//indicatorPos= indicatorPos.position
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region 高亮提示和隐藏
|
||||
public void Highlight(bool enable)
|
||||
{
|
||||
if (targetSpriteRenderer != null && highlightMaterial != null&&targetSpriteRenderer.material!=alarmMaterial)
|
||||
{
|
||||
targetSpriteRenderer.material = enable ? highlightMaterial : originalMaterial;
|
||||
}
|
||||
}
|
||||
public void Alarm(bool enable)
|
||||
{
|
||||
if (targetSpriteRenderer != null && alarmMaterial != null)
|
||||
{
|
||||
targetSpriteRenderer.material = enable ? alarmMaterial : originalMaterial;
|
||||
}
|
||||
}
|
||||
// public void HideModule(bool enable)
|
||||
// {
|
||||
// if (targetSpriteRenderer != null && highlightMaterial != null)
|
||||
// {
|
||||
// targetSpriteRenderer.material = enable ? highlightMaterial : originalMaterial;
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct BodyModuleData
|
||||
{
|
||||
@@ -161,6 +200,8 @@ namespace AibisDream.FixSystem
|
||||
public SerializableVector3 modulePos;
|
||||
public SerializableVector3 socketPos;
|
||||
|
||||
public SerializableVector3 indicatorPos;
|
||||
|
||||
// 功能信息
|
||||
public WaveformType waveformType;
|
||||
|
||||
@@ -194,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,8 +7,9 @@ namespace AibisDream
|
||||
public static class BodyModuleYarnCommand
|
||||
{
|
||||
private static BodyModuleSystem BodyModuleSystem => FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
||||
private static OscilloscopeSystem OscilloscopeSystem => FixSystemCenter.SystemDic.Get<OscilloscopeSystem>();
|
||||
|
||||
|
||||
private static PunchTapeSystem PunchTapeSystem => FixSystemCenter.SystemDic.Get<PunchTapeSystem>();
|
||||
[YarnCommand("SetModuleState_CantStopRunning")]
|
||||
public static void SetModuleState_CantStopRunning(string ModuleName,bool state)
|
||||
{
|
||||
@@ -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);
|
||||
@@ -89,5 +90,62 @@ namespace AibisDream
|
||||
var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName);
|
||||
targetModule.SetSocketAvailable(isAvailable);
|
||||
}
|
||||
[YarnCommand("ModuleHightLight")]
|
||||
public static void ModuleHightLight(string moduleName,bool enable)
|
||||
{
|
||||
var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName);
|
||||
targetModule.Highlight(enable);
|
||||
}
|
||||
[YarnCommand("ModuleAlarm")]
|
||||
public static void ModuleAlarm(string moduleName,bool enable)
|
||||
{
|
||||
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());
|
||||
}
|
||||
[YarnCommand("PrintPunchTapes")]
|
||||
public static IEnumerator PrintPunchTapes(int count)
|
||||
{
|
||||
yield return PunchTapeSystem.StartCoroutine(PunchTapeSystem.PrintPunchTapes(count));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using AibisDream.FixSystem;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PunchTapeSystem : MonoBehaviour
|
||||
{
|
||||
public RectTransform punchTapeMachine;
|
||||
public RectTransform punchTape;
|
||||
public float stepInterval = 0.1f; // Interval between each printing step
|
||||
public float stepDistance = 0.5f; // Distance moved per step
|
||||
public float[] stepPatterns = { 0.3f, 0.5f, 0.2f, 0.4f, 0.6f }; // Pattern of intervals to simulate rhythmic printing
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.P))
|
||||
{
|
||||
StartPrinting(2);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartPrinting(int tapeCount)
|
||||
{
|
||||
StartCoroutine(PrintPunchTapes(tapeCount));
|
||||
}
|
||||
|
||||
public IEnumerator PrintPunchTapes(int tapeCount)
|
||||
{
|
||||
Vector3 machineStartPos = punchTapeMachine.anchoredPosition;
|
||||
Vector3 tapeStartPos = punchTape.anchoredPosition;
|
||||
Color tapeStartColor = punchTape.GetComponent<Image>().color;
|
||||
|
||||
while (tapeCount > 0)
|
||||
{
|
||||
// Move the printer to x = 2 over 1 second
|
||||
yield return punchTapeMachine.DOAnchorPos(new Vector2(-1252f, punchTapeMachine.anchoredPosition.y), 1f).WaitForCompletion();
|
||||
|
||||
// Gradually move the punch tape to x = -3.8 with rhythmic pattern
|
||||
Vector2 targetPosition = new Vector2(796f, punchTape.anchoredPosition.y);
|
||||
int patternIndex = 0;
|
||||
|
||||
while (Vector2.Distance(punchTape.anchoredPosition, targetPosition) > stepDistance)
|
||||
{
|
||||
punchTape.anchoredPosition = Vector3.MoveTowards(punchTape.anchoredPosition, targetPosition, stepDistance);
|
||||
yield return new WaitForSeconds(stepPatterns[patternIndex % stepPatterns.Length]);
|
||||
patternIndex++;
|
||||
}
|
||||
|
||||
// Ensure exact final position
|
||||
punchTape.anchoredPosition = targetPosition;
|
||||
|
||||
// Fade out the punch tape over 1 second
|
||||
yield return punchTape.GetComponent<Image>().DOFade(0f, 1f).WaitForCompletion();
|
||||
|
||||
// Reset the punch tape position and opacity
|
||||
punchTape.anchoredPosition = tapeStartPos;
|
||||
punchTape.GetComponent<Image>().color = tapeStartColor;
|
||||
|
||||
// Decrement the tape count
|
||||
tapeCount--;
|
||||
}
|
||||
|
||||
// Move the printer back to x = 0 over 1 second
|
||||
yield return punchTapeMachine.DOAnchorPos(new Vector2(-1428.186f, punchTapeMachine.anchoredPosition.y), 1f).WaitForCompletion();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4075ea95a82355544862690e0de983bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using AibisDream.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
// 黑屏淡出
|
||||
yield return MainUIController.Instance.FadeOutSync(FadeDuration);
|
||||
|
||||
}
|
||||
|
||||
public void SetArgs(string arg)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace AibisDream.FixSystem
|
||||
Engine,
|
||||
Gear
|
||||
}
|
||||
|
||||
|
||||
public interface ITransitionCommand
|
||||
{
|
||||
IEnumerator Execute();
|
||||
@@ -27,12 +27,12 @@ namespace AibisDream.FixSystem
|
||||
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);
|
||||
// 把线插回去
|
||||
@@ -144,8 +144,8 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
// 引擎相机设置
|
||||
private static readonly Vector3 CameraPos = new(0f, 0.5f, -10);
|
||||
private const float OrthographicSize = 2.5f;
|
||||
private const float Duration = 2f;
|
||||
private const float OrthographicSize = 2f;
|
||||
private const float Duration = 1f;
|
||||
|
||||
public IEnumerator Execute()
|
||||
{
|
||||
@@ -156,6 +156,8 @@ namespace AibisDream.FixSystem
|
||||
bodyModuleSystem.ResetPlug();
|
||||
// 相机聚焦到目标位
|
||||
var cameraSq = CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration);
|
||||
yield return new WaitForSeconds(Duration/2);
|
||||
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
||||
while (cameraSq.active && !cameraSq.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
@@ -163,6 +165,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
eyeSystem.OpenEyeView();
|
||||
eyeSystem.OnEnter();
|
||||
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
||||
}
|
||||
|
||||
public void SetArgs(string arg)
|
||||
@@ -173,15 +176,19 @@ namespace AibisDream.FixSystem
|
||||
|
||||
public struct EyeToBodyModuleCommand : ITransitionCommand
|
||||
{
|
||||
private const float Duration = 2f;
|
||||
private const float Duration = 1f;
|
||||
|
||||
public IEnumerator Execute()
|
||||
{
|
||||
var eyeSystem = FixSystemCenter.SystemDic.Get<EyeSystem>();
|
||||
//yield return new WaitForSeconds(Duration/2);
|
||||
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
||||
eyeSystem.CloseEyeView();
|
||||
|
||||
// 相机还原
|
||||
var cameraSq = CameraKit.Instance.ReturnInitCamera(Duration);
|
||||
yield return new WaitForSeconds(Duration/2);
|
||||
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
||||
while (cameraSq.active && !cameraSq.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
@@ -198,8 +205,8 @@ namespace AibisDream.FixSystem
|
||||
|
||||
public struct BodyModuleToMemoryCommand : ITransitionCommand
|
||||
{
|
||||
// 引擎相机设置
|
||||
private static readonly Vector3 CameraPos = new(0f, 0.5f, -10);
|
||||
// 引擎相机设置
|
||||
private static readonly Vector3 CameraPos = new(-2.5f, 5f, -10);
|
||||
private const float OrthographicSize = 2.5f;
|
||||
private const float Duration = 2f;
|
||||
|
||||
@@ -207,11 +214,13 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
||||
var memorySystem = FixSystemCenter.SystemDic.Get<MemoryProcess>();
|
||||
|
||||
yield return memorySystem.DropMemoryProjector();
|
||||
// 插头回到初始插孔
|
||||
bodyModuleSystem.ResetPlug();
|
||||
// 相机聚焦到目标位
|
||||
var cameraSq = CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration);
|
||||
yield return new WaitForSeconds(Duration/2);
|
||||
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
||||
while (cameraSq.active && !cameraSq.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
@@ -219,6 +228,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
memorySystem.OpenMemoryView();
|
||||
memorySystem.OnShow();
|
||||
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
||||
}
|
||||
|
||||
public void SetArgs(string arg)
|
||||
@@ -234,10 +244,20 @@ namespace AibisDream.FixSystem
|
||||
public IEnumerator Execute()
|
||||
{
|
||||
var memorySystem = FixSystemCenter.SystemDic.Get<MemoryProcess>();
|
||||
|
||||
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
||||
memorySystem.CloseMemoryView();
|
||||
|
||||
// 相机还原
|
||||
yield return CameraKit.Instance.ReturnInitCamera(Duration).WaitForCompletion();
|
||||
var cameraSq = CameraKit.Instance.ReturnInitCamera(Duration);
|
||||
yield return new WaitForSeconds(Duration/2);
|
||||
|
||||
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
||||
yield return memorySystem.PullMemoryProjector();
|
||||
while (cameraSq.active && !cameraSq.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
memorySystem.OnExit();
|
||||
}
|
||||
|
||||
@@ -249,8 +269,8 @@ namespace AibisDream.FixSystem
|
||||
|
||||
public struct BodyModuleToUFCommand : ITransitionCommand
|
||||
{
|
||||
// 引擎相机设置
|
||||
private static readonly Vector3 CameraPos = new(0f, 0.5f, -10);
|
||||
// 引擎相机设置
|
||||
private static readonly Vector3 CameraPos = new(-4.5f, 0.5f, -10);
|
||||
private const float OrthographicSize = 2.5f;
|
||||
private const float Duration = 2f;
|
||||
|
||||
@@ -261,8 +281,16 @@ namespace AibisDream.FixSystem
|
||||
// 插头回到初始插孔
|
||||
bodyModuleSystem.ResetPlug();
|
||||
// 相机聚焦到目标位
|
||||
yield return CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration).WaitForCompletion();
|
||||
var cameraSq = CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration);
|
||||
yield return new WaitForSeconds(Duration/2);
|
||||
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
||||
while (cameraSq.active && !cameraSq.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
UFSystem.OpenUFView();
|
||||
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
||||
|
||||
}
|
||||
|
||||
public void SetArgs(string arg)
|
||||
@@ -278,10 +306,14 @@ namespace AibisDream.FixSystem
|
||||
public IEnumerator Execute()
|
||||
{
|
||||
var UFSystem = FixSystemCenter.SystemDic.Get<UFSystem>();
|
||||
|
||||
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
||||
UFSystem.CloseUFView();
|
||||
|
||||
// 相机还原
|
||||
var cameraSq = CameraKit.Instance.ReturnInitCamera(Duration);
|
||||
yield return new WaitForSeconds(Duration/2);
|
||||
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
||||
while (cameraSq.active && !cameraSq.IsComplete())
|
||||
{
|
||||
yield return null;
|
||||
|
||||
@@ -49,19 +49,8 @@ namespace AibisDream.Framework
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.K))
|
||||
{
|
||||
MonoCenter.Mono.StartCoroutine(FixSystemYarnCommand.SwitchFixSystemTo("BodyModule"));
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.A))
|
||||
{
|
||||
var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
MonoCenter.Mono.StartCoroutine(cooling.LinkTube());
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.S))
|
||||
{
|
||||
var cooling = FixSystemCenter.SystemDic.Get<CoolingSystem>();
|
||||
MonoCenter.Mono.StartCoroutine(cooling.OpenBottleUI());
|
||||
MonoCenter.Mono.StartCoroutine(FixSystemYarnCommand.SwitchFixSystemTo("Eye"));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,8 @@ namespace AibisDream
|
||||
public IEnumerator StartTestGame()
|
||||
{
|
||||
// TODO 全部改好之后这里要直接进入FixScene
|
||||
yield return SceneLoader.Instance.LoadSceneAsync(clinicScene);
|
||||
yield return null;
|
||||
//yield return SceneLoader.Instance.LoadSceneAsync(clinicScene);
|
||||
var proj = Resources.Load<YarnProject>($"Yarn/{testYarnProject}/{testYarnProject}");
|
||||
DialogController.Instance.StartDialog(proj);
|
||||
}
|
||||
|
||||
@@ -61,5 +61,9 @@ namespace AibisDream
|
||||
{
|
||||
isButtonActive = isActive;
|
||||
}
|
||||
public Transform GetTransform()
|
||||
{
|
||||
return _self.transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user