1
This commit is contained in:
@@ -8,6 +8,7 @@ using BITKit.UX;
|
||||
using BITKit.UX.Hotkey;
|
||||
using BITKit.WorldNode;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Net.Project.B.Emoji;
|
||||
using Net.Project.B.Interaction;
|
||||
using Net.Project.B.Quest;
|
||||
@@ -23,23 +24,23 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
{
|
||||
public class UXHud : UIToolKitPanel
|
||||
{
|
||||
private readonly IEntitiesService _entitiesService;
|
||||
private readonly IPlayerFactory _playerFactory;
|
||||
private readonly IGameMapService _gameMapService;
|
||||
private readonly IWorldInteractionService _interactionService;
|
||||
private readonly WorldInfoNodeService _worldInfoNodeService;
|
||||
private readonly IQuestService _questService;
|
||||
private readonly UXRadialMenu _radialMenu;
|
||||
|
||||
[Inject]
|
||||
private IEmojiService<AnimationClip> _emojiService;
|
||||
public UXHud(IUXService uxService, IGameMapService gameMapService, IWorldInteractionService interactionService, WorldInfoNodeService worldInfoNodeService, IQuestService questService, UXRadialMenu radialMenu, IPlayerFactory playerFactory) : base(uxService)
|
||||
public UXHud(IUXService uxService, IGameMapService gameMapService, IWorldInteractionService interactionService, IQuestService questService, UXRadialMenu radialMenu, IPlayerFactory playerFactory, IEntitiesService entitiesService) : base(uxService)
|
||||
{
|
||||
_gameMapService = gameMapService;
|
||||
_interactionService = interactionService;
|
||||
_worldInfoNodeService = worldInfoNodeService;
|
||||
_questService = questService;
|
||||
_radialMenu = radialMenu;
|
||||
_playerFactory = playerFactory;
|
||||
_entitiesService = entitiesService;
|
||||
|
||||
_gameMapService.OnMapChanged += OnMapChanged;
|
||||
|
||||
@@ -72,7 +73,16 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
{
|
||||
case WorldInteractionProcess.Hover:
|
||||
_interactionTips.SetActive(true);
|
||||
_interactionTips.text = _worldInfoNodeService.WorldInfoNodes.TryGetValue(arg2.Id, out var node) ? node.Name : "互动";
|
||||
if (_entitiesService.Entities.TryGetValue(arg2.Id, out var entity) &&
|
||||
entity.ServiceProvider.GetService<WorldInfoNode>() is { } infoNode && string.IsNullOrEmpty(infoNode.Name) is false)
|
||||
{
|
||||
_interactionTips.text = infoNode.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
_interactionTips.text = "互动";
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
_interactionTips.SetActive(false);
|
||||
@@ -88,11 +98,7 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
protected override string DocumentPath => "ux_hud";
|
||||
public override bool AllowInput => true;
|
||||
public override bool AllowCursor => false;
|
||||
|
||||
[UXBindPath("minimap-container")]
|
||||
private VisualElement _minimapContainer;
|
||||
[UXBindPath("minimap-player")]
|
||||
private VisualElement _miniPlayer;
|
||||
|
||||
[UXBindPath("interaction-tips")]
|
||||
private Label _interactionTips;
|
||||
[UXBindPath("time-slider")]
|
||||
@@ -117,10 +123,6 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
|
||||
_interactionTips.SetActive(false);
|
||||
|
||||
_minimapContainer.RegisterCallback<MouseDownEvent>(x =>
|
||||
{
|
||||
UXService.Entry<UXMap>();
|
||||
});
|
||||
|
||||
_timeSlider.RegisterValueChangedCallback(x => { Data.Set("Time", x.newValue); });
|
||||
_questContainer.Clear();
|
||||
@@ -138,7 +140,7 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
|
||||
if (Keyboard.current is { capsLockKey: { wasPressedThisFrame: true } } or {mKey:{wasPressedThisFrame:true}})
|
||||
{
|
||||
UXService.Entry<UXMap>();
|
||||
UXService.Entry<IUXMap>();
|
||||
}else if (Keyboard.current is { f1Key: { wasPressedThisFrame: true } })
|
||||
{
|
||||
var collection = new HotkeyCollection();
|
||||
|
Reference in New Issue
Block a user