Add ui to uimanager, scriptable object

This commit is contained in:
HungDK
2026-05-21 17:45:03 +07:00
parent 8896d26b50
commit a4559f5d5f
5 changed files with 100 additions and 5 deletions
@@ -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}
@@ -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;
}
}
+3 -2
View File
@@ -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: []
+7 -1
View File
@@ -141,7 +141,13 @@ namespace BrewMonster
// }
// }
if (m_bUsingTrashBox || DoingSessionPose())
if (m_bUsingTrashBox)
{
CECHostPlayer.PopupStorageDialog(true);
return;
}
if (DoingSessionPose())
{
UnityGameSession.c2s_CmdCancelAction();
return;
+81
View File
@@ -38,6 +38,8 @@ public class CECUIManager : MonoSingleton<CECUIManager>
[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<CECUIManager>
return Push(componentName);
}
/// <summary>
/// Show a modal on top without hiding stack dialogs (e.g. DlgQuantity over storage + inventory).
/// </summary>
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<CECUIManager>
return dlg;
}
/// <summary>
/// Show warehouse + inventory together without hiding the first dialog (C++ PopupStorageDialog).
/// </summary>
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();
}
/// <summary>Hide warehouse pair and restore previous stack top if any.</summary>
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();
}
}
}
/// <summary>
/// Pop the top dialog off the stack: hide it and bring the new top (if any) to front. Returns true if something was popped.
/// </summary>