Merge branch '6.4.20全流程优化' into bugfix/merge
This commit is contained in:
@@ -83,8 +83,11 @@ namespace AibisDream
|
||||
[YarnCommand("Temp_RemoveChip")]
|
||||
public static void Temp_RemoveChip()
|
||||
{
|
||||
var _chipModule = BodyModuleSystem.FindBodyModuleByName("Color").transform.GetComponent<ChipModule>();
|
||||
_chipModule.RemoveChipModule();
|
||||
var _chipModule = BodyModuleSystem.FindBodyModuleByName("Color")?.transform.GetComponent<ChipModule>();
|
||||
if (_chipModule != null)
|
||||
{
|
||||
_chipModule.RemoveChipModule();
|
||||
}
|
||||
}
|
||||
|
||||
[YarnCommand("Temp_InstallUFColor")]
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using AibisDream;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public class CableSystem : MonoBehaviour
|
||||
{
|
||||
private const string CABLE_RETRACTED_KEY = "$global.cableRetracted";
|
||||
|
||||
#region 组件索引
|
||||
|
||||
public Plug PlugRef { get; private set; }
|
||||
@@ -43,6 +46,7 @@ namespace AibisDream.FixSystem
|
||||
private void Start()
|
||||
{
|
||||
InitSystem();
|
||||
LoadCableState();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -81,6 +85,33 @@ namespace AibisDream.FixSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadCableState()
|
||||
{
|
||||
if (StorageSystem.Instance.TryGetValue(CABLE_RETRACTED_KEY, out bool savedRetractedState))
|
||||
{
|
||||
if (isCableRetracted)
|
||||
{
|
||||
if (!savedRetractedState)
|
||||
{
|
||||
DropDownCable();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (savedRetractedState)
|
||||
{
|
||||
PullUpCable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveCableState()
|
||||
{
|
||||
Debug.Log("Save cableRetractedstate"+isCableRetracted);
|
||||
StorageSystem.Instance.SetValue(CABLE_RETRACTED_KEY, isCableRetracted);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// 获取线缆方向并更新转盘旋转
|
||||
@@ -166,17 +197,20 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
PhysicCableRef.GetComponent<LineRenderer>().enabled = false;
|
||||
isCableRetracted = true;
|
||||
SaveCableState();
|
||||
});
|
||||
}
|
||||
public void DropDownCable()
|
||||
{
|
||||
if (!isCableRetracted) return;
|
||||
Debug.Log("DorpDown");
|
||||
PlugRef.PullUpSocket();
|
||||
CableReelRef.ResetRotation();
|
||||
PlugRef.transform.DOMove(PlugRef.GetStartPos(), 0.1f).OnComplete(() =>
|
||||
{
|
||||
PlugRef.SwitchToPhysicCableState();
|
||||
isCableRetracted = false;
|
||||
SaveCableState();
|
||||
});
|
||||
// 只有在非收起状态时才切换到物理线缆状态
|
||||
}
|
||||
@@ -192,6 +226,8 @@ namespace AibisDream.FixSystem
|
||||
PlugRef.transform.rotation = retractedPos.rotation;
|
||||
PlugRef.GetComponent<SpriteRenderer>().sortingLayerName = CableReelRef.GetComponent<SpriteRenderer>().sortingLayerName;
|
||||
PlugRef.GetComponent<SpriteRenderer>().sortingOrder = 41;
|
||||
isCableRetracted = true;
|
||||
//SaveCableState();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,6 @@ using UnityEngine;
|
||||
using AibisDream.FixSystem;
|
||||
using Cinemachine;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using UnityEditor.Localization.Plugins.XLIFF.V12;
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@ public class PunchTapeSystem : MonoBehaviour
|
||||
public RectTransform punchTape;
|
||||
|
||||
public GameObject blackPanel;
|
||||
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()
|
||||
{
|
||||
@@ -34,37 +30,33 @@ public class PunchTapeSystem : MonoBehaviour
|
||||
|
||||
while (tapeCount > 0)
|
||||
{
|
||||
// Move the printer to x = 2 over 1 second
|
||||
yield return punchTapeMachine.DOAnchorPos(new Vector2(-1252f, punchTapeMachine.anchoredPosition.y), 1f)
|
||||
.WaitForCompletion();
|
||||
// 0-0.7秒:打印机移动到指定位置
|
||||
AudioManager.Instance.PlaySfx("event:/Scriptal/typing");
|
||||
// Gradually move the punch tape to x = -3.8 with rhythmic pattern
|
||||
yield return punchTapeMachine.DOAnchorPos(new Vector2(-1252f, punchTapeMachine.anchoredPosition.y), 0.7f)
|
||||
.WaitForCompletion();
|
||||
|
||||
|
||||
// 0.7-1秒:停顿
|
||||
yield return new WaitForSeconds(0.3f);
|
||||
|
||||
// 1-1.6秒:纸带匀速弹出
|
||||
Vector2 targetPosition = new Vector2(796f, punchTape.anchoredPosition.y);
|
||||
int patternIndex = 0;
|
||||
yield return punchTape.DOAnchorPos(targetPosition, 0.6f).WaitForCompletion();
|
||||
|
||||
while (Vector2.Distance(punchTape.anchoredPosition, targetPosition) > stepDistance)
|
||||
{
|
||||
punchTape.anchoredPosition =
|
||||
Vector3.MoveTowards(punchTape.anchoredPosition, targetPosition, stepDistance);
|
||||
yield return new WaitForSeconds(stepPatterns[patternIndex % stepPatterns.Length]);
|
||||
patternIndex++;
|
||||
}
|
||||
// 1.6-2.3秒:停顿
|
||||
yield return new WaitForSeconds(0.7f);
|
||||
|
||||
// Ensure exact final position
|
||||
punchTape.anchoredPosition = targetPosition;
|
||||
// 2.3-2.7秒:纸带淡出
|
||||
yield return punchTape.GetComponent<Image>().DOFade(0f, 0.4f).WaitForCompletion();
|
||||
|
||||
// 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();
|
||||
blackPanel.SetActive(false);
|
||||
|
||||
Reference in New Issue
Block a user