20261017
This commit is contained in:
1 parent
caf19faf09
commit
c4b10383f9
18 files changed
+3295
-1524
No files matched your search
@@ -0,0 +1,38 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
// 掛在開始按鈕上 : 按鈕反灰時,滑鼠移上去會顯示提示
|
||||
public class StartButtonHint : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
[Header("UI 參照")]
|
||||
[Tooltip("開始 Button")]
|
||||
public Button targetButton;
|
||||
|
||||
[Tooltip("提示物件 (例如寫著「請閱讀資訊欄並勾選同意書」的 Text 或 Panel)")]
|
||||
public GameObject hintObject;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (hintObject != null)
|
||||
{
|
||||
hintObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (hintObject != null && targetButton != null && !targetButton.interactable)
|
||||
{
|
||||
hintObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
if (hintObject != null)
|
||||
{
|
||||
hintObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user