This commit is contained in:
CortexCore
2025-04-18 18:47:30 +08:00
parent 98f554e57c
commit 5324d73239
18 changed files with 870 additions and 1195 deletions

View File

@@ -10,6 +10,7 @@ using BITKit.WorldNode;
using Cysharp.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Net.Project.B.Emoji;
using Net.Project.B.Health;
using Net.Project.B.Interaction;
using Net.Project.B.Quest;
using Net.Project.B.UX;
@@ -35,6 +36,10 @@ namespace Net.Like.Xue.Tokyo.UX
[Inject]
private IEmojiService<AnimationClip> _emojiService;
[UXBindPath("health-bar")]
private ProgressBar _healthBar;
public UXHud(IUXService uxService, IGameMapService gameMapService, IWorldInteractionService interactionService, IQuestService questService, UXRadialMenu radialMenu, IPlayerFactory playerFactory, IEntitiesService entitiesService, IUXKeyMap<InputAction> uxKeyMap) : base(uxService)
{
_gameMapService = gameMapService;
@@ -79,9 +84,20 @@ namespace Net.Like.Xue.Tokyo.UX
private UniTask OnEntityCreated(string arg1, IEntity arg2)
{
arg2.Inject(this);
arg2.ServiceProvider.QueryComponents(out IHealthComponent healthComponent);
healthComponent.OnHealthChanged += OnHealthChanged;
OnHealthChanged(healthComponent.HealthPoint,healthComponent.HealthPoint);
return UniTask.CompletedTask;
}
private void OnHealthChanged(int arg1, int arg2)
{
_healthBar.value = arg2;
}
private void OnInteraction(object arg1, IWorldInteractable arg2, WorldInteractionProcess arg3, object arg4)
{
switch (arg3)