Add storage password logic, ui

This commit is contained in:
HungDK
2026-05-27 10:55:35 +07:00
parent a8d3994226
commit 80a3a48abe
16 changed files with 4724 additions and 13 deletions
+1
View File
@@ -262,6 +262,7 @@ namespace BrewMonster
invUi?.DismissItemDetail();
CECUIManager.Instance?.HideStorageDialogPair();
CECUIManager.Instance?.HideDialogFromStack("DialogNPC");
if (wasUsingTrash)
UnityGameSession.c2s_CmdCancelAction();
+55 -9
View File
@@ -278,6 +278,57 @@ public class CECUIManager : MonoSingleton<CECUIManager>
dlg.Show(false);
}
/// <summary>Hide a stacked dialog and remove it from <see cref="_uiStack"/>.</summary>
public void HideDialogFromStack(string componentName)
{
if (string.IsNullOrEmpty(componentName))
return;
_uiStack.Remove(componentName);
GetInGameUIMan()?.GetDialog(componentName)?.Show(false);
}
/// <summary>Warehouse password entry / change overlays (must not resurface when closing storage).</summary>
public void HideStoragePasswordDialogs()
{
HideDialogFromStack(DlgStoragePW.DialogId);
HideDialogFromStack(DlgStorageChangePW.DialogId);
}
/// <summary>End NPC service and close talk UI after storage password flows (C++ CloseDialog + EndNPCService).</summary>
public void EndNpcTalkAfterStorageService()
{
HideStoragePasswordDialogs();
var gameUi = GetInGameUIMan();
gameUi?.EndNPCService();
HideDialogFromStack("DialogNPC");
}
void ShowStackTopSkippingStoragePasswordDialogs()
{
var gui = GetInGameUIMan();
if (gui == null)
return;
while (_uiStack.Count > 0)
{
string topId = _uiStack[0];
if (topId == DlgStoragePW.DialogId || topId == DlgStorageChangePW.DialogId)
{
HideDialogFromStack(topId);
continue;
}
var newTop = gui.GetDialog(topId);
if (newTop != null)
{
newTop.Show(true);
newTop.transform.SetAsLastSibling();
}
return;
}
}
public void HideCurrentUIInStack()
{
Pop();
@@ -322,6 +373,8 @@ public class CECUIManager : MonoSingleton<CECUIManager>
if (gui == null)
return;
HideStoragePasswordDialogs();
var storageDlg = gui.GetDialog("EC_StorageUI");
var invDlg = gui.GetDialog("Win_Inventory");
if (storageDlg == null || invDlg == null)
@@ -350,15 +403,8 @@ public class CECUIManager : MonoSingleton<CECUIManager>
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();
}
}
HideStoragePasswordDialogs();
ShowStackTopSkippingStoragePasswordDialogs();
}
/// <summary>