Merge branch 'develop' into feature/Addessable_CDN

This commit is contained in:
Le Duc Anh
2026-05-27 10:09:58 +07:00
13 changed files with 1391 additions and 4 deletions
+63 -3
View File
@@ -23,10 +23,15 @@ namespace BrewMonster
private bool m_bTrashPsw;
private bool m_bFirstTBOpen = true;
private bool m_bUsingAccountBox;
private bool m_bFirstAccountBoxOpen = true;
private int m_iTrashBoxMoneyCnt;
private int m_iAccountBoxMoneyCnt;
public bool TrashBoxHasPsw() => m_bTrashPsw;
public int GetTrashBoxMoneyCnt() => m_iTrashBoxMoneyCnt;
public bool IsUsingAccountBox() => m_bUsingAccountBox;
public int GetAccountBoxMoneyCnt() => m_iAccountBoxMoneyCnt;
public EC_Inventory GetTrashBox() => m_pTrashBoxPack;
public EC_Inventory GetTrashBox2() => m_pTrashBoxPack2;
public EC_Inventory GetTrashBox3() => m_pTrashBoxPack3;
@@ -54,9 +59,22 @@ namespace BrewMonster
{
var pCmd = GPDataTypeHelper.FromBytes<cmd_trashbox_open>(data);
if (pCmd.is_accountbox != 0)
break; // PW_TODO: account box UI
{
m_bUsingAccountBox = true;
m_bUsingTrashBox = false;
if (m_bFirstAccountBoxOpen)
{
m_bFirstAccountBoxOpen = false;
UnityGameSession.c2s_CmdGetTrashBoxData(true, true);
}
PopupAccountBoxDialog();
break;
}
m_bUsingTrashBox = true;
m_bUsingAccountBox = false;
InitTrashBoxPacks();
if (m_bFirstTBOpen)
@@ -80,7 +98,11 @@ namespace BrewMonster
{
var pCmd = GPDataTypeHelper.FromBytes<cmd_trashbox_close>(data);
if (pCmd.is_accountbox != 0)
{
m_bUsingAccountBox = false;
PopupAccountBoxDialog(true);
break;
}
m_bUsingTrashBox = false;
PopupStorageDialog(true);
break;
@@ -89,19 +111,31 @@ namespace BrewMonster
{
var pCmd = GPDataTypeHelper.FromBytes<cmd_trashbox_wealth>(data);
if (pCmd.is_accountbox == 0)
{
m_iTrashBoxMoneyCnt = (int)pCmd.money;
EC_StorageUI.RefreshMoneyStatic();
EC_StorageUI.RefreshMoneyStatic();
}
else
{
m_iAccountBoxMoneyCnt = (int)pCmd.money;
EC_AccountStorageUI.RefreshMoneyStatic();
}
break;
}
case CommandID.EXG_TRASH_MONEY:
{
var pCmd = GPDataTypeHelper.FromBytes<cmd_exg_trash_money>(data);
AddMoneyAmount(pCmd.inv_delta);
if (pCmd.is_accountbox == 0)
{
AddMoneyAmount(pCmd.inv_delta);
m_iTrashBoxMoneyCnt += pCmd.tra_delta;
}
else
{
m_iAccountBoxMoneyCnt += pCmd.tra_delta;
}
EC_StorageUI.RefreshMoneyStatic();
EC_AccountStorageUI.RefreshMoneyStatic();
var invUi = UnityEngine.Object.FindFirstObjectByType<EC_InventoryUI>();
invUi?.RefreshAll();
break;
@@ -243,6 +277,32 @@ namespace BrewMonster
invDlg?.RefreshAll();
}
/// <summary>C++ CECGameUIMan::PopupAccountBoxDialog — money-only account warehouse.</summary>
public static void PopupAccountBoxDialog(bool close = false)
{
if (close)
{
var host = EC_Game.GetGameRun()?.GetHostPlayer();
if (host != null)
host.m_bUsingAccountBox = false;
EC_StorageUI.ClearSelectionStatic();
var invUi = UnityEngine.Object.FindFirstObjectByType<EC_InventoryUI>(FindObjectsInactive.Include);
invUi?.DismissItemDetail();
CECUIManager.Instance?.HideAccountStorageDialogPair();
EC_Game.GetGameRun()?.GetUIManager()?.GetInGameUIMan()?.EndNPCService();
return;
}
CECUIManager.Instance?.ShowAccountStorageDialogPair();
var accountDlg = EC_Game.GetGameRun()?.GetUIManager()?.GetInGameUIMan()?.GetDialog("EC_AccountStorageUI") as EC_AccountStorageUI;
accountDlg?.RefreshAll();
var invDlg = UnityEngine.Object.FindFirstObjectByType<EC_InventoryUI>(FindObjectsInactive.Include);
invDlg?.RefreshAll();
}
/// <summary>Transfer between main pack and trash box (C++ CDlgStorage::OnItemDragDrop).</summary>
public bool TransferPackAndTrash(byte trashWhere, int trashSlot, int invSlot, int amount = -1)
{
+52
View File
@@ -361,6 +361,58 @@ public class CECUIManager : MonoSingleton<CECUIManager>
}
}
/// <summary>
/// Show money-only account warehouse + inventory together. This intentionally uses a
/// separate dialog from EC_StorageUI to avoid enabling warehouse item slots.
/// </summary>
public void ShowAccountStorageDialogPair()
{
if (canvasDlg == null)
return;
var gui = GetInGameUIMan();
if (gui == null)
return;
var accountDlg = gui.GetDialog("EC_AccountStorageUI");
var invDlg = gui.GetDialog("Win_Inventory");
if (accountDlg == null || invDlg == null)
return;
_uiStack.Remove("Win_Inventory");
_uiStack.Remove("EC_AccountStorageUI");
invDlg.Show(true);
accountDlg.Show(true);
_uiStack.Insert(0, "Win_Inventory");
_uiStack.Insert(0, "EC_AccountStorageUI");
invDlg.transform.SetAsLastSibling();
accountDlg.transform.SetAsLastSibling();
}
/// <summary>Hide account warehouse pair and restore previous stack top if any.</summary>
public void HideAccountStorageDialogPair()
{
_uiStack.Remove("EC_AccountStorageUI");
_uiStack.Remove("Win_Inventory");
var gui = GetInGameUIMan();
gui?.GetDialog("Win_Inventory")?.Show(false);
gui?.GetDialog("EC_AccountStorageUI")?.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>