removed old stuff

This commit is contained in:
2025-10-01 20:03:52 +02:00
parent d9cf8507d0
commit c51c07d19b
448 changed files with 111 additions and 30620 deletions

View File

@@ -1,5 +1,4 @@
using System;
using R3;
using RebootKit.Engine.Extensions;
using UnityEngine;
using UnityEngine.UIElements;
using Logger = RebootKit.Engine.Foundation.Logger;
@@ -14,32 +13,41 @@ namespace RebootReality.jelycho.Player.HUD {
[field: SerializeField] public PlayerInventoryUI InventoryUI { get; private set; }
PlayerActor m_PlayerActor;
DisposableBag m_ActorBag;
void OnEnable() {
}
void OnDisable() {
InventoryUI.CleanUp();
m_ActorBag.Dispose();
}
public void SetPlayerActor(PlayerActor actor) {
m_ActorBag.Dispose();
if (actor == null) {
m_PlayerActor = null;
InventoryUI.CleanUp();
UnsetPlayerActor();
if (actor.OrNull() == null) {
return;
}
m_ActorBag = new DisposableBag();
m_PlayerActor = actor;
InventoryUI.Configure(m_MainDocument.rootVisualElement.Q("player-hud__inventory-slots"), actor.Inventory);
actor.SelectedInventorySlot.Subscribe(x => {
InventoryUI.SetSelectedSlot(x);
}).AddTo(ref m_ActorBag);
actor.OnSelectedInventorySlotChanged += OnInventorySelectedSlotChanged;
InventoryUI.SetSelectedSlot(actor.SelectedInventorySlot);
}
void UnsetPlayerActor() {
if (m_PlayerActor.OrNull() == null) {
return;
}
m_PlayerActor.OnSelectedInventorySlotChanged -= OnInventorySelectedSlotChanged;
m_PlayerActor = null;
InventoryUI.CleanUp();
}
void OnInventorySelectedSlotChanged(int newIndex) {
InventoryUI.SetSelectedSlot(newIndex);
}
}
}