多轮审查和修复

This commit is contained in:
2026-05-12 15:34:08 +08:00
parent f55d2a57c3
commit ebbbb7332e
805 changed files with 838724 additions and 1905 deletions

View File

@@ -0,0 +1,45 @@
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
namespace BaseGames.Dialogue
{
/// <summary>
/// 交互提示 UI 控制器(架构 14_NarrativeModule §2
/// 挂载在每个 IInteractable GameObject 的子节点Prefab 实例),默认隐藏。
/// 根据当前活跃输入设备自动切换图标(键盘/手柄)。
/// </summary>
public class InteractionPromptController : MonoBehaviour
{
[SerializeField] private GameObject _promptRoot;
[SerializeField] private Image _icon;
[SerializeField] private Sprite _keyboardIcon;
[SerializeField] private Sprite _gamepadIcon;
private void Awake()
{
if (_promptRoot != null) _promptRoot.SetActive(false);
}
/// <summary>显示交互提示,根据输入设备选择图标。</summary>
public void Show()
{
if (_promptRoot == null) return;
_promptRoot.SetActive(true);
UpdateIcon();
}
/// <summary>隐藏交互提示。</summary>
public void Hide()
{
if (_promptRoot != null) _promptRoot.SetActive(false);
}
private void UpdateIcon()
{
if (_icon == null) return;
bool isGamepad = Gamepad.current != null && Gamepad.current.enabled;
_icon.sprite = isGamepad ? _gamepadIcon : _keyboardIcon;
}
}
}