This commit is contained in:
CortexCore
2025-04-23 14:48:45 +08:00
parent 1226b6f0c5
commit 043e56ef7e
2695 changed files with 2552733 additions and 115961 deletions

View File

@@ -21,7 +21,8 @@
"GUID:6efaa16b661faf94188fd63eda46f87c",
"GUID:ecc5a2501a2c44d4cb8366674714f3d9",
"GUID:68e8cf1a3c026044da8fe2f07f7de963",
"GUID:8f79dfa3edfa9514b8f6d7d2f0102ccc"
"GUID:8f79dfa3edfa9514b8f6d7d2f0102ccc",
"GUID:46b59e80b22f9f04dbd080f812276bc4"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -9,6 +9,7 @@ using BITKit.UX.Hotkey;
using BITKit.WorldNode;
using Cysharp.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Net.Project.B.Buff;
using Net.Project.B.Emoji;
using Net.Project.B.Health;
using Net.Project.B.Interaction;
@@ -39,6 +40,10 @@ namespace Net.Like.Xue.Tokyo.UX
[UXBindPath("health-bar")]
private ProgressBar _healthBar;
[UXBindPath("hunger-bar")]
private ProgressBar _hungerBar;
[UXBindPath("thirsty-bar")]
private ProgressBar _thirstyBar;
public UXHud(IUXService uxService, IGameMapService gameMapService, IWorldInteractionService interactionService, IQuestService questService, UXRadialMenu radialMenu, IPlayerFactory playerFactory, IEntitiesService entitiesService, IUXKeyMap<InputAction> uxKeyMap) : base(uxService)
{
@@ -95,7 +100,10 @@ namespace Net.Like.Xue.Tokyo.UX
private void OnHealthChanged(int arg1, int arg2)
{
_healthBar.value = arg2;
if (_healthBar is not null)
{
_healthBar.value = arg2;
}
}
private void OnInteraction(object arg1, IWorldInteractable arg2, WorldInteractionProcess arg3, object arg4)
@@ -155,12 +163,28 @@ namespace Net.Like.Xue.Tokyo.UX
}
public override async void OnTick(float deltaTime)
public override void OnTick(float deltaTime)
{
base.OnTick(deltaTime);
if(RootVisualElement is null)return;
foreach (var (_,buffComponent) in _entitiesService.QueryComponents<LocalPlayerComponent,IBuffComponent>())
{
foreach (var buff in buffComponent.Buffs.Span)
{
switch (buff)
{
case Hunger:
_hungerBar.value = buff.Value;
break;
case Thirsty:
_thirstyBar.value = buff.Value;
break;
}
}
}
if (BITInputSystem.AllowInput.Allow)
{
if (Keyboard.current is { capsLockKey: { wasPressedThisFrame: true } } or {mKey:{wasPressedThisFrame:true}})
@@ -168,20 +192,7 @@ namespace Net.Like.Xue.Tokyo.UX
UXService.Entry<IUXMap>();
}else if (Keyboard.current is { f1Key: { wasPressedThisFrame: true } })
{
var collection = new HotkeyCollection();
_radialMenu.HotkeyCollection = collection;
foreach (var emojiData in await _emojiService.GetAllEmojis())
{
collection.Register(new HotkeyProvider()
{
Name = emojiData.Name,
Description = emojiData.Description,
Enabled = true,
OnPerform = () => _emojiService.Play(emojiData),
});
}
UXService.Entry(_radialMenu);
CreateEmojis();
}
}
@@ -211,6 +222,24 @@ namespace Net.Like.Xue.Tokyo.UX
}
private async void CreateEmojis()
{
var collection = new HotkeyCollection();
_radialMenu.HotkeyCollection = collection;
foreach (var emojiData in await _emojiService.GetAllEmojis())
{
collection.Register(new HotkeyProvider()
{
Name = emojiData.Name,
Description = emojiData.Description,
Enabled = true,
OnPerform = () => _emojiService.Play(emojiData),
});
}
UXService.Entry(_radialMenu);
}
protected override void OnPanelEntry()
{
base.OnPanelEntry();