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
+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;
+82 -1
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>
@@ -795,7 +876,7 @@ public class CECUIManager : MonoSingleton<CECUIManager>
}
public void GetIconStateMgr()
{
}
/// <summary>Shows the player options menu for the given character. Requires a prefab with id "DlgPlayerOptions" in DialogScriptTableObject.</summary>