startUI告一段落
This commit is contained in:
1 parent
f8154f92b3
commit
da28b62f7f
34 files changed
+17562
-8231
No files matched your search
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
// 模擬視覺模型從擷取畫面到輸出的延遲 (ms)
|
||||
public class AssistDelay : MonoBehaviour
|
||||
{
|
||||
[Header("UI 參照")]
|
||||
[Tooltip("Slider")]
|
||||
public Slider targetSlider;
|
||||
|
||||
[Tooltip("Text (TMP)")]
|
||||
public TextMeshProUGUI valueDisplayText;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (targetSlider != null)
|
||||
{
|
||||
targetSlider.wholeNumbers = true; // 每 1ms 一個階梯
|
||||
|
||||
UpdateDisplayText(targetSlider.value);
|
||||
|
||||
targetSlider.onValueChanged.AddListener(UpdateDisplayText);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateDisplayText(float val)
|
||||
{
|
||||
if (valueDisplayText != null)
|
||||
{
|
||||
valueDisplayText.text = $"模型辨識延遲 : {Mathf.RoundToInt(val)}ms";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user