From a4559f5d5f96bafe45031fe00bfe237f0d9da2db Mon Sep 17 00:00:00 2001 From: HungDK <> Date: Thu, 21 May 2026 17:45:03 +0700 Subject: [PATCH] Add ui to uimanager, scriptable object --- .../UI/DialogScriptTableObject.asset | 4 + .../Scripts/Common/DialogScriptTableObject.cs | 5 +- Assets/Prefabs/UI/InventoryUI.prefab | 5 +- Assets/Scripts/CECHostPlayer.World.cs | 8 +- Assets/Scripts/CECUIManager.cs | 83 ++++++++++++++++++- 5 files changed, 100 insertions(+), 5 deletions(-) diff --git a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset index 74e9014887..3abddba683 100644 --- a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset +++ b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset @@ -63,3 +63,7 @@ MonoBehaviour: prefab: {fileID: 6225996695219405878, guid: 2ed5e05eaa1d87341bf25c3cf111cc01, type: 3} - id: Win_Settings prefab: {fileID: 5193882765232824931, guid: 12e3fbc87fab9044abb62aba808775c8, type: 3} + - id: EC_StorageUI + prefab: {fileID: 3837460183159982207, guid: 0986049a141406946b0ed97344b84f78, type: 3} + - id: DlgQuantity + prefab: {fileID: 8147986291757959694, guid: 11d09ee52b0c5f24fb3ef21e177ebe2d, type: 3} diff --git a/Assets/PerfectWorld/Scripts/Common/DialogScriptTableObject.cs b/Assets/PerfectWorld/Scripts/Common/DialogScriptTableObject.cs index a44265bc23..63c5b91ceb 100644 --- a/Assets/PerfectWorld/Scripts/Common/DialogScriptTableObject.cs +++ b/Assets/PerfectWorld/Scripts/Common/DialogScriptTableObject.cs @@ -12,7 +12,10 @@ namespace BrewMonster.UI public GameObject GetPrefabDialog(string id) { - return lstPrefabDialog.Find(x => x.id.Equals(id)).prefab; + if (string.IsNullOrEmpty(id) || lstPrefabDialog == null) + return null; + var entry = lstPrefabDialog.Find(x => !string.IsNullOrEmpty(x.id) && x.id.Equals(id)); + return entry.prefab; } } diff --git a/Assets/Prefabs/UI/InventoryUI.prefab b/Assets/Prefabs/UI/InventoryUI.prefab index 13f4fcf9a2..bf70b17087 100644 --- a/Assets/Prefabs/UI/InventoryUI.prefab +++ b/Assets/Prefabs/UI/InventoryUI.prefab @@ -12786,6 +12786,7 @@ MonoBehaviour: tmp: {fileID: 6020258894941961325} equipButton: {fileID: 472698755110594484} dropButton: {fileID: 540159372834342487} + storageTransferButton: {fileID: 0} splitPanelRoot: {fileID: 3772330938303001319} splitAmountText: {fileID: 3418403519615399396} splitConfirmButton: {fileID: 7942200720793983179} @@ -20626,7 +20627,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7209086543831860202, guid: c56ed80641ff74ce49f91401e3eb8367, type: 3} propertyPath: m_AnchoredPosition.y - value: -836.15 + value: -42 objectReference: {fileID: 0} - target: {fileID: 8894405194986632892, guid: c56ed80641ff74ce49f91401e3eb8367, type: 3} propertyPath: m_AnchorMax.y @@ -20646,7 +20647,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8894405194986632892, guid: c56ed80641ff74ce49f91401e3eb8367, type: 3} propertyPath: m_AnchoredPosition.y - value: -418.075 + value: -21 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] diff --git a/Assets/Scripts/CECHostPlayer.World.cs b/Assets/Scripts/CECHostPlayer.World.cs index ac98b65b39..88cf8f4e00 100644 --- a/Assets/Scripts/CECHostPlayer.World.cs +++ b/Assets/Scripts/CECHostPlayer.World.cs @@ -141,7 +141,13 @@ namespace BrewMonster // } // } - if (m_bUsingTrashBox || DoingSessionPose()) + if (m_bUsingTrashBox) + { + CECHostPlayer.PopupStorageDialog(true); + return; + } + + if (DoingSessionPose()) { UnityGameSession.c2s_CmdCancelAction(); return; diff --git a/Assets/Scripts/CECUIManager.cs b/Assets/Scripts/CECUIManager.cs index 36394aee6f..e90d5c7b8d 100644 --- a/Assets/Scripts/CECUIManager.cs +++ b/Assets/Scripts/CECUIManager.cs @@ -38,6 +38,8 @@ public class CECUIManager : MonoSingleton [SerializeField] private DialogScriptTableObject dialogResouce; [SerializeField] private Canvas canvasDlg; + public Transform DialogCanvasTransform => canvasDlg != null ? canvasDlg.transform : null; + [SerializeField] [Tooltip("Chat TMP: EmotionLibrarySpriteMap (SO). CECGameUIMan is not a MonoBehaviour — assign here on CECUIManager.")] private EmotionLibrarySpriteMap _emotionLibrarySpriteMap; @@ -248,6 +250,34 @@ public class CECUIManager : MonoSingleton return Push(componentName); } + /// + /// Show a modal on top without hiding stack dialogs (e.g. DlgQuantity over storage + inventory). + /// + public AUIDialog ShowDialogOverlay(string componentName) + { + if (string.IsNullOrEmpty(componentName) || canvasDlg == null) + return null; + + var dlg = GetInGameUIMan()?.GetDialog(componentName); + if (dlg == null) + return null; + + dlg.Show(true); + dlg.transform.SetAsLastSibling(); + EC_UIUtility.BringPanelToFront(dlg.gameObject); + return dlg; + } + + public void HideDialogOverlay(string componentName) + { + if (string.IsNullOrEmpty(componentName)) + return; + + var dlg = GetInGameUIMan()?.GetDialog(componentName); + if (dlg != null) + dlg.Show(false); + } + public void HideCurrentUIInStack() { Pop(); @@ -280,6 +310,57 @@ public class CECUIManager : MonoSingleton return dlg; } + /// + /// Show warehouse + inventory together without hiding the first dialog (C++ PopupStorageDialog). + /// + public void ShowStorageDialogPair() + { + if (canvasDlg == null) + return; + + var gui = GetInGameUIMan(); + if (gui == null) + return; + + var storageDlg = gui.GetDialog("EC_StorageUI"); + var invDlg = gui.GetDialog("Win_Inventory"); + if (storageDlg == null || invDlg == null) + return; + _uiStack.Remove("Win_Inventory"); + _uiStack.Remove("EC_StorageUI"); + + invDlg.Show(true); + storageDlg.Show(true); + + _uiStack.Insert(0, "Win_Inventory"); + _uiStack.Insert(0, "EC_StorageUI"); + + // Inventory below, storage on top (detail panel uses EC_UIUtility overlay sort). + invDlg.transform.SetAsLastSibling(); + storageDlg.transform.SetAsLastSibling(); + } + + /// Hide warehouse pair and restore previous stack top if any. + public void HideStorageDialogPair() + { + _uiStack.Remove("EC_StorageUI"); + _uiStack.Remove("Win_Inventory"); + + var gui = GetInGameUIMan(); + gui?.GetDialog("Win_Inventory")?.Show(false); + gui?.GetDialog("EC_StorageUI")?.Show(false); + + if (_uiStack.Count > 0) + { + var newTop = gui?.GetDialog(_uiStack[0]); + if (newTop != null) + { + newTop.Show(true); + newTop.transform.SetAsLastSibling(); + } + } + } + /// /// Pop the top dialog off the stack: hide it and bring the new top (if any) to front. Returns true if something was popped. /// @@ -795,7 +876,7 @@ public class CECUIManager : MonoSingleton } public void GetIconStateMgr() { - + } /// Shows the player options menu for the given character. Requires a prefab with id "DlgPlayerOptions" in DialogScriptTableObject.