可配置模块

This commit is contained in:
2024-11-30 08:04:03 +08:00
parent d95d117c08
commit 71ec5da49a
45 changed files with 3249 additions and 1262 deletions
@@ -1,5 +1,7 @@
using TMPro;
using AibisDream.Utility;
using TMPro;
using UnityEngine;
using Random = UnityEngine.Random;
namespace AibisDream.FixSystem
{
@@ -12,6 +14,7 @@ namespace AibisDream.FixSystem
private ScanLine _scanLine;
private SpriteRenderer _screen;
private WaveSlider _waveSlider;
private SpriteButton _deepinButton;
#endregion
@@ -19,6 +22,7 @@ namespace AibisDream.FixSystem
public bool isScanning;
public bool isPlaying;
public bool canScan;
#endregion
@@ -35,10 +39,19 @@ namespace AibisDream.FixSystem
_scanLine = transform.Find("Scan Line").GetComponent<ScanLine>();
_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 = "";
_deepinButton.OnButtonDown += StartScan;
_scanLine.ScanErrorEvent += OnScanSuccess;
}
private void Update()
{
_deepinButton.CheckButtonClick();
}
#region
@@ -52,6 +65,8 @@ namespace AibisDream.FixSystem
{
_waveSlider.InitSlider();
isPlaying = true;
canScan = hasError;
_deepinButton.SetActive(canScan);
var initialRandomPhase = Mathf.PI * Random.Range(7, 13) * 0.1f;
_waveformLine.PlayWave(waveformType, initialRandomPhase, hasError);
@@ -63,6 +78,9 @@ namespace AibisDream.FixSystem
public void StopWave()
{
isPlaying = false;
canScan = false;
isScanning = false;
_deepinButton.SetActive(false);
_waveSlider.InitSlider();
_waveformLine.StopWave();
@@ -85,9 +103,20 @@ namespace AibisDream.FixSystem
/// </summary>
public void StartScan()
{
if (!canScan) return;
float spikeX = _waveformLine.GetSpikeX();
StartCoroutine(_scanLine.ScanForError(spikeX));
}
/// <summary>
/// 扫描成功后
/// </summary>
public void OnScanSuccess()
{
FixSystemCenter.SystemDic.Get<BodyModuleSystem>().HandleDeepIn();
_ = CommonUtil.Delay(2000, StopWave);
}
/// <summary>
/// 显示消息