feat(UIReminder): 优化了提示键位的UI

This commit is contained in:
2025-10-21 14:23:54 +08:00
parent f71ef8cae9
commit 6ff684a71e
6 changed files with 5839 additions and 5480 deletions

View File

@@ -107,12 +107,6 @@ namespace Script.Gameplay.Player
CurrentTarget = hitConnectable;
}
public IConnectable GetCurrentTarget()
{
return CurrentTarget;
}
public void SetPointA(IConnectable target)
{
if (target == null) return;

View File

@@ -2,21 +2,21 @@ using Core;
using UnityEngine;
using Script.Gameplay.Player;
using TMPro;
using System.Collections.Generic;
namespace UI
{
public class PlayerGazeReminder : UIBase
{
[SerializeField] private TMP_Text reminderFirstText;
[SerializeField] private TMP_Text reminderSecondText;
[SerializeField] private GameObject reminderInteractPrefab;
[SerializeField] private GameObject reminderConnectPrefab;
[SerializeField] private GameObject reminderSetPointPrefab;
private PlayerInteractorController playerInteractorController;
private PlayerConnectController playerConnectController;
protected override void Awake()
{
base.Awake();
reminderFirstText.text = "";
reminderSecondText.text = "";
ControllerLocator.Instance.TryGetWait<PlayerInteractorController>(OnGetInteractorController);
ControllerLocator.Instance.TryGetWait<PlayerConnectController>(OnGetConnectController);
}
@@ -27,17 +27,17 @@ namespace UI
playerInteractorController.OnGazeEnter += HandleInteractGazeEnter;
playerInteractorController.OnGazeExit += HandleInteractGazeExit;
}
private void HandleInteractGazeEnter(GameObject obj)
{
reminderFirstText.text = "Press [F] to interact";
reminderInteractPrefab.SetActive(true);
}
private void HandleInteractGazeExit(GameObject obj)
{
reminderFirstText.text = "";
reminderInteractPrefab.SetActive(false);
}
private void OnGetConnectController(PlayerConnectController controller)
{
playerConnectController = controller;
@@ -47,12 +47,14 @@ namespace UI
private void HandleConnectGazeEnter(GameObject obj)
{
reminderFirstText.text = "Connectable";
reminderConnectPrefab.SetActive(true);
reminderSetPointPrefab.SetActive(true);
}
private void HandleConnectGazeExit(GameObject obj)
{
reminderFirstText.text = "";
reminderConnectPrefab.SetActive(false);
reminderSetPointPrefab.SetActive(false);
}
}
}