fix show model in inventory

This commit is contained in:
CuongNV
2026-05-18 16:10:23 +07:00
parent b5b25c3b09
commit a26ec4acc3
6 changed files with 310 additions and 847 deletions
@@ -15,7 +15,6 @@ using System.Text;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using BrewMonster.Scripts.UI.Inventory;
using CSNetwork.Protocols.RPCData;
namespace BrewMonster.Scripts.Managers
@@ -168,9 +167,26 @@ namespace BrewMonster.Scripts.Managers
ShowDetailPanel(false);
ShowSplitPanel(false);
RefreshAll();
BeginInventoryCharacterPreview();
RefreshCharacterModelPreview();
}
private void OnDisable()
{
PlayerModelPreview.Instance?.EndInventoryPreview();
}
private void BeginInventoryCharacterPreview()
{
var preview = PlayerModelPreview.Instance;
if (preview == null)
return;
RoleInfo roleInfo = UnityGameSession.Instance != null ? UnityGameSession.Instance.GetRoleInfo() : null;
if (roleInfo != null)
preview.BeginInventoryPreview(roleInfo.roleid);
}
private void WireSplitUI()
{
if (splitOpenButton != null)
@@ -1626,20 +1642,12 @@ namespace BrewMonster.Scripts.Managers
public void RefreshCharacterModelPreview()
{
var preview = PlayerModelPreview.Instance;
if (preview != null)
{
RoleInfo roleInfo = BuildCurrentPreviewRoleInfo();
if (roleInfo != null)
{
preview.ReloadRoleModel(roleInfo);
}
}
if (preview == null)
return;
var inventoryPreview = FindFirstObjectByType<InventoryCharacterPreview>();
if (inventoryPreview != null)
{
inventoryPreview.QueueRefresh();
}
RoleInfo roleInfo = BuildCurrentPreviewRoleInfo();
if (roleInfo != null)
preview.ReloadRoleModel(roleInfo);
}
private RoleInfo BuildCurrentPreviewRoleInfo()