From 1e17b4108cce0d005634ea323a962eedb533a46d Mon Sep 17 00:00:00 2001 From: NguyenVanDat Date: Sat, 7 Mar 2026 13:47:29 +0700 Subject: [PATCH] update UI logic embed stone and clear stone --- .../Scripts/UI/Dialogs/DlgInstall.cs | 5 - .../PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs | 178 +++++++++--------- .../Scripts/UI/Dialogs/DlgProduce.cs | 4 +- .../Scripts/UI/GamePlay/EC_GameUIMan.cs | 28 ++- .../Scripts/UI/NPCShopUIManager.cs | 25 ++- Assets/Prefabs/UI/DlgInstall.prefab | 14 +- Assets/Prefabs/UI/DlgUninstall.prefab | 14 +- Assets/Scripts/CECUIManager.cs | 27 +-- 8 files changed, 149 insertions(+), 146 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgInstall.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgInstall.cs index 10457be6b0..64879f884f 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgInstall.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgInstall.cs @@ -654,10 +654,5 @@ namespace BrewMonster } } } - - public void ShowTest(bool isStack) - { - CECUIManager.Instance.ShowUI("Win_Disenchase"); - } } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs index 27567d166d..c1f2a58ccf 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs @@ -2005,7 +2005,7 @@ namespace BrewMonster.UI pShow2.Show(true); } } - Show(false); + //CloseDialogue(); return true; } @@ -2076,13 +2076,13 @@ namespace BrewMonster.UI if (GetData() == NPC_DIALOG.NPC_DIALOG_TASK_LIST) { // �����ǰNPCֻ��������ط����򷵻ص�ͬ���˳�NPC���� - Show(false); + //CloseDialogue(); GetGameUIMan().EndNPCService(); } } else if (GetData() == NPC_DIALOG.NPC_DIALOG_ESSENCE) { - Show(false); + //CloseDialogue(); GetGameUIMan().EndNPCService(); } } @@ -2116,7 +2116,7 @@ namespace BrewMonster.UI //GetGameUIMan().MessageBox("", pTask.FormatTaskTalk(pTalk.windows[i].talk_text), // MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); GetGameUIMan().EndNPCService(); - Show(false); + //CloseDialogue(); break; } @@ -2195,7 +2195,7 @@ namespace BrewMonster.UI if (nCurSel == m_pLst_Main.GetCount() - 1) { GetGameUIMan().EndNPCService(); - Show(false); + //CloseDialogue(); } else { @@ -2219,7 +2219,7 @@ namespace BrewMonster.UI if (nCurSel == m_pLst_Main.GetCount() - 1) { GetGameUIMan().EndNPCService(); - Show(false); + //CloseDialogue(); return; } @@ -2236,12 +2236,12 @@ namespace BrewMonster.UI // MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox); //pMsgBox.SetDataPtr(m_pLst_Main.GetItemDataPtr(nCurSel)); GetGameUIMan().EndNPCService(); - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CDLGNPC_EQUIPSLOT && (pEssence?.combined_services & 0x02) != 0) { - Show(false); + //CloseDialogue(); // TO DO: fix later //GetGameUIMan().m_pDlgInventory.Show(true); //GetGameUIMan().m_pDlgEquipSlot.Show(true); @@ -2316,7 +2316,7 @@ namespace BrewMonster.UI // MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160)); //} //GetGameUIMan().EndNPCService(); - //Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CDLGNPC_FACE && (pEssence?.combined_services & 0x20) != 0) @@ -2334,20 +2334,20 @@ namespace BrewMonster.UI // GetGameUIMan().m_pDlgInventory.Show(true); // GetGameUIMan().m_pDlgFaceLift.Show(true); // GetGameUIMan().EndNPCService(); - // Show(false); + // CloseDialogue(); //} return; } else if (iService == CDLGNPC.CDLGNPC_MAIL && (pEssence?.combined_services & 0x40) != 0) { // TO DO: fix later - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgMailList.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_AUCTION && (pEssence?.combined_services & 0x80) != 0) { - Show(false); + //CloseDialogue(); // TO DO: fix later //if (CECCrossServer::Instance().IsOnSpecialServer()) //{ @@ -2370,14 +2370,14 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_DOUBLEEXP && (pEssence?.combined_services & 0x100) != 0) { - Show(false); + //CloseDialogue(); // TO DO: fix later //GetGameUIMan().m_pDlgDoubleExp.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_PETHATCH && (pEssence?.combined_services & 0x200) != 0) { - //Show(false); + //CloseDialogue(); // TO DO: fix later //GetGameUIMan().m_pDlgInventory.Show(true); //GetGameUIMan().m_pDlgPetHatch.Show(true); @@ -2387,7 +2387,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_PETREC && (pEssence?.combined_services & 0x400) != 0) { - //Show(false); + //CloseDialogue(); // TO DO: fix later //GetGameUIMan().m_pDlgPetList.Show(true); //GetGameUIMan().m_pDlgPetRec.Show(true); @@ -2397,7 +2397,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_BATTLECHALLENGE && (pEssence?.combined_services & 0x800) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgGuildMap.SetType(CDlgGuildMap::FACTIONMAP_TYPE_CHALLENGE); //GetGameUIMan().m_pDlgGuildMap.Show(true); //GetGameUIMan().m_pDlgGMapStatus2.Show(true); @@ -2406,7 +2406,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_BATTLEENTER && (pEssence?.combined_services & 0x800) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgGuildMap.SetType(CDlgGuildMap::FACTIONMAP_TYPE_ENTER); //GetGameUIMan().m_pDlgGuildMap.Show(true); //GetGameUIMan().m_pDlgGMapStatus1.Show(true); @@ -2415,27 +2415,27 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_BATTLELEAVE && (pEssence?.combined_services & 0x1000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().MessageBox("Game_BattleLeave", GetStringFromTable(725), // MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160)); return; } else if (iService == CDLGNPC.CDLGNPC_GOLDTRADE && (pEssence?.combined_services & 0x2000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgGoldTrade.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_EQUIPREFINE && (pEssence?.combined_services & 0x4000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgEquipRefine.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_EQUIPDYE && (pEssence?.combined_services & 0x8000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgEquipDye.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); //GetGameUIMan().m_pDlgFittingRoom.Show(true); @@ -2443,7 +2443,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_PETDYE && (pEssence?.combined_services & 0x8000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgPetDye.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); //GetGameUIMan().m_pDlgPetList.Show(true); @@ -2451,14 +2451,14 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_REFINETRANS && (pEssence?.combined_services & 0x10000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgRefineTrans.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_ELFPRORESET && (pEssence?.combined_services & 0x20000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgELFXiDian.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; @@ -2466,56 +2466,56 @@ namespace BrewMonster.UI else if (iService == CDLGNPC.CDLGNPC_ELFGENIUSRESET && (pEssence?.combined_services & 0x40000) != 0) { //еĶԻ°¿ò - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgELFGeniusReset.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_ELFFORGET && (pEssence?.combined_services & 0x80000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgELFRetrain.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_ELFREFINE && (pEssence?.combined_services & 0x100000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgELFRefine.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_ELFREFINETRANS && (pEssence?.combined_services & 0x100000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgELFRefineTrans.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_ELFTOPILL && (pEssence?.combined_services & 0x200000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgELFToPill.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_ELFEQUIPOFF && (pEssence?.combined_services & 0x400000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgELFEquipRemove.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_EQUIPREPAIR && (pEssence?.combined_services & 0x800000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgDamageRep.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_WEBTRADE && (pEssence?.combined_services & 0x1000000) != 0) { - Show(false); + //CloseDialogue(); //if (GetGameUIMan().m_pDlgAutoLock.IsLocked()) //{ // GetGameUIMan().AddChatMessage(GetStringFromTable(5520), GP_CHAT_MISC); @@ -2534,19 +2534,19 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_GODEVILCONVERT && (pEssence?.combined_services & 0x2000000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgGodEvilConvert.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_WEDDING_BOOK && (pEssence?.combined_services & 0x4000000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgWedding.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_WEDDING_INVITE && (pEssence?.combined_services & 0x4000000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgWeddingInvite.Show(true); return; } @@ -2625,7 +2625,7 @@ namespace BrewMonster.UI // GetGameUIMan().EndNPCService(); //} - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_WAR && (pEssence?.combined_services & 0x8000000) != 0) @@ -2640,7 +2640,7 @@ namespace BrewMonster.UI //{ // GetGameUIMan().EndNPCService(); //} - //Show(false); + ////CloseDialogue(); return; } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_ENTER && (pEssence?.combined_services & 0x8000000) != 0) @@ -2648,7 +2648,7 @@ namespace BrewMonster.UI // ½øÈë»ùµØ //GetGameSession().factionFortress_Enter(GetHostPlayer().GetFactionID()); //GetGameUIMan().EndNPCService(); - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_WARLIST && (pEssence?.combined_services & 0x8000000) != 0) @@ -2663,7 +2663,7 @@ namespace BrewMonster.UI //{ // GetGameUIMan().EndNPCService(); //} - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_UPGRADE && (pEssence?.combined_services & 0x10000000) != 0) @@ -2680,7 +2680,7 @@ namespace BrewMonster.UI //{ // GetGameUIMan().EndNPCService(); //} - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_HANDIN_MATERIAL && (pEssence?.combined_services & 0x10000000) != 0) @@ -2697,7 +2697,7 @@ namespace BrewMonster.UI //{ // GetGameUIMan().EndNPCService(); //} - //Show(false); + ////CloseDialogue(); return; } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_HANDIN_CONTRIB && (pEssence?.combined_services & 0x10000000) != 0) @@ -2714,7 +2714,7 @@ namespace BrewMonster.UI //{ // GetGameUIMan().EndNPCService(); //} - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_LEAVE && (pEssence?.combined_services & 0x10000000) != 0) @@ -2722,7 +2722,7 @@ namespace BrewMonster.UI // À뿪»ùµØ //GetGameSession().c2s_CmdNPCSevFactionFortressLeave(); GetGameUIMan().EndNPCService(); - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_EXCHANGE_MATERIAL && (pEssence?.combined_services & 0x200000000) != 0) @@ -2739,19 +2739,19 @@ namespace BrewMonster.UI //{ // GetGameUIMan().EndNPCService(); //} - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CDLGNPC_VIEW_TRASHBOX && (pEssence?.combined_services & 0x40000000) != 0) { //GetGameSession().c2s_CmdNPCSevViewTrash(); - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CDLGNPC_VIEW_DPS_DPH_RANK && (pEssence?.combined_services & 0x80000000) != 0) { //GetGameUIMan().m_pDlgEarthBagRank.Show(true); - Show(false); + //CloseDialogue(); return; } else if ((iService == CDLGNPC.CDLGNPC_FORCE_QUIT || iService == CDLGNPC.CDLGNPC_FORCE_JOIN) && pEssence?.id_force_service > 0) @@ -2774,7 +2774,7 @@ namespace BrewMonster.UI // pDlg.Show(true); //} - Show(false); + //CloseDialogue(); return; } else if ((iService == CDLGNPC.CDLGNPC_JOIN_COUNTRY || iService == CDLGNPC.CDLGNPC_QUIT_COUNTRY) @@ -2867,7 +2867,7 @@ namespace BrewMonster.UI // GetGameUIMan().MessageBox("Country_JoinLeave", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160), &pDlgMsgBox); // pDlgMsgBox.SetData(2); //} - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CDLGNPC_LEAVE_COUNTRY_WAR && (pEssence?.combined_services2 & 0x00000002) != 0) @@ -2875,12 +2875,12 @@ namespace BrewMonster.UI // À뿪ȷ¶¨ string strMsg = GetStringFromTable(9915); //GetGameUIMan().MessageBox("Country_LeaveWar", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160)); - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CDLGNPC_EQUIP_MARK && (pEssence?.combined_services2 & 0x00000004) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgEquipMark.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; @@ -2947,7 +2947,7 @@ namespace BrewMonster.UI // GetGameUIMan().MessageBox("CrossServer_GetIn", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160)); // } //} - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CDLGNPC_GOTO_ORIGINALSERVER && (pEssence?.combined_services2 & 0x00000010) != 0) @@ -2957,7 +2957,7 @@ namespace BrewMonster.UI // string strMsg = GetStringFromTable(10138); // GetGameUIMan().MessageBox("CrossServer_GetOut", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160)); //} - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CDLGNPC_PLAYER_RENAME && (pEssence?.combined_services2 & 0x00000020) != 0) @@ -2982,12 +2982,12 @@ namespace BrewMonster.UI // pDlgModifyName.Show(true); // } //} - Show(false); + //CloseDialogue(); return; } else if (iService == CDLGNPC.CDLGNPC_STONE_CHANGE && (pEssence?.combined_services2 & 0x00000040) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgStoneChange.SetType(CDlgStoneChange::EM_ALL); //GetGameUIMan().m_pDlgStoneChange.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); @@ -2995,14 +2995,14 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_KING_SERVICE && (pEssence?.combined_services2 & 0x00000080) != 0) { - Show(false); + //CloseDialogue(); //GetGameSession().king_GetCandidateStatus(); //GetHostPlayer().SetInKingService(true); return; } else if (iService == CDLGNPC.CDLGNPC_OFFLINESHOP_SETTING && (pEssence?.combined_services2 & 0x00000100) != 0) { - Show(false); + //CloseDialogue(); //if (g_pGame.GetConfigs().IsMiniClient() || glb_IsInMapForMiniClient()) //{ // GetGameUIMan().MessageBox("", GetStringFromTable(10713), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); @@ -3016,7 +3016,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_OFFLINESHOP_SELLBUY && (pEssence?.combined_services2 & 0x00000100) != 0) { - Show(false); + //CloseDialogue(); GetGameUIMan().EndNPCService(); //if (g_pGame.GetConfigs().IsMiniClient() || glb_IsInMapForMiniClient()) //{ @@ -3039,39 +3039,39 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_SPLIT_FASHION && (pEssence?.combined_services2 & 0x00000200) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgFashionSplit.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_REINCARNATION && (pEssence?.combined_services2 & 0x00000400) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgReincarnation.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_GIFTCARD && (pEssence?.combined_services2 & 0x00000800) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgGiftCard.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_TRICKBATTLE && (pEssence?.combined_services2 & 0x00001000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgChariotWarApply.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_CARDRESPAWN && (pEssence?.combined_services2 & 0x00002000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgGenCardRespawn.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_QUERYCHARIOTAMOUNT && (pEssence?.combined_services2 & 0x00001000) != 0) { - Show(false); + //CloseDialogue(); //GetGameSession().tankBattle_GetRank(); //GetGameUIMan().m_pDlgChariotRankList.SetNPCSevFlag(true); //if (!GetGameUIMan().m_pDlgChariotRankList.IsShow()) @@ -3080,14 +3080,14 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_FLYSWORDIMPROVE && (pEssence?.combined_services2 & 0x00004000) != 0) { - Show(false); + //CloseDialogue(); //GetGameUIMan().m_pDlgFlySwordImprove.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_OPEN_FACTION_PVP && (pEssence?.combined_services2 & 0x00008000) != 0) { - Show(false); + //CloseDialogue(); string strMsg = GetStringFromTable(11271); //GetGameUIMan().MessageBox("Faction_PVP_Open", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160)); return; @@ -3095,7 +3095,7 @@ namespace BrewMonster.UI else if (iService == CDLGNPC.CDLGNPC_GOLD_SHOP && ((pEssence?.combined_services2 & 0x00010000) != 0 || (pEssence?.combined_services2 & 0x00020000) != 0)) { - Show(false); + //CloseDialogue(); //bool bEnableQShop = (pEssence.combined_services2 & 0x00010000); //bool bEnableBackShop = (pEssence.combined_services2 & 0x00020000); //if (bEnableQShop) @@ -3135,7 +3135,7 @@ namespace BrewMonster.UI // pDlgSimpleCostItemService.Show(true); // } //} - Show(false); + //CloseDialogue(); return; } } @@ -3378,6 +3378,7 @@ namespace BrewMonster.UI //pButton = (PAUISTILLIMAGEBUTTON)pShow2.GetDlgItem("Btn_QuestItem"); //pButton.SetPushed(false); //GetGameUIMan().m_pDlgInventory.SetShowItem(CDlgInventory::INVENTORY_ITEM_NORMAL); + //CloseDialogue(); if (pCurNPCEssence.HasValue) { uint npcID = pCurNPCEssence.Value.id; @@ -3423,8 +3424,9 @@ namespace BrewMonster.UI if (pCurNPCEssence.HasValue) { uint npcID = pCurNPCEssence.Value.id; - var dlgInstall = GetGameUIMan().GetDialog("Win_Disenchase"); - dlgInstall.Show(true); + CECUIManager.Instance.ShowUI("Win_Disenchase"); + // var dlgInstall = GetGameUIMan().GetDialog("Win_Disenchase"); + // dlgInstall.Show(true); } //pShow1 = m_pAUIManager.GetDialog("Win_Disenchase"); //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); @@ -3538,23 +3540,23 @@ namespace BrewMonster.UI uint npcID = pCurNPCEssence.HasValue ? pCurNPCEssence.Value.id : 0; - AUIDialog dlg = m_pAUIManager.GetDialog("Win_Produce"); + AUIDialog dlg = CECUIManager.Instance.ShowUI("Win_Produce"); DlgProduce dlgProduce = dlg as DlgProduce; - if (dlgProduce == null) - { - CECGameUIMan gameUIMan = GetGameUIMan(); - DialogScriptTableObject dialogResource = gameUIMan.GetDialogResource(); - Canvas canvas = gameUIMan.GetCanvas(); - - if(dlgProduce != null && canvas != null) - { - GameObject ob = dialogResource.GetPrefabDialog("Win_Produce"); - if (ob != null) - { - dlgProduce = GameObject.Instantiate(ob, canvas.transform).GetComponent(); - } - } - } + // if (dlgProduce == null) + // { + // CECGameUIMan gameUIMan = GetGameUIMan(); + // DialogScriptTableObject dialogResource = gameUIMan.GetDialogResource(); + // Canvas canvas = gameUIMan.GetCanvas(); + // + // if(dlgProduce != null && canvas != null) + // { + // GameObject ob = dialogResource.GetPrefabDialog("Win_Produce"); + // if (ob != null) + // { + // dlgProduce = GameObject.Instantiate(ob, canvas.transform).GetComponent(); + // } + // } + // } if(dlgProduce != null) { @@ -3803,14 +3805,14 @@ namespace BrewMonster.UI pShow2.Show(true); } } - Show(false); + //CloseDialogue(); return true; } public void OnCommand_CANCEL(string szCommand) { - Show(false); + CloseDialogue(); GetGameUIMan().EndNPCService(); int idCurFinishTask = GetGameUIMan().m_idCurFinishTask; @@ -3834,7 +3836,7 @@ namespace BrewMonster.UI if (GetHostPlayer().GetPack().GetItemTotalNum((int)pService.storage_open_item) > 0) { - Show(false); + //CloseDialogue(); var pDlg = GetGameUIMan().GetDialog("Win_QuestList"); if (pDlg) diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs index 7f1b78e6df..aea4b1e89c 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs @@ -567,8 +567,8 @@ namespace BrewMonster { isProducing = false; produceRemainCount = 0; - - gameObject.SetActive(false); + + CloseDialogue(); ClearContainer(tabBtnContainer); ClearContainer(itemContainer); ClearMaterialSlots(); diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs index d040e6e43c..93d92f70ed 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs @@ -39,10 +39,15 @@ namespace BrewMonster.UI public void PopupNPCDialog(NPC_ESSENCE pEssence) { + var dialogueNpc = CECUIManager.Instance.ShowUI("DialogNPC"); if (m_pDlgNPC == null) { - GameObject ob = m_dialogResouce.GetPrefabDialog("DialogNPC"); - m_pDlgNPC = GameObject.Instantiate(ob, m_canvas.transform).GetComponent(); + if (dialogueNpc == null) + { + BMLogger.LogError("can not get dialogue npc"); + return; + } + m_pDlgNPC = dialogueNpc.GetComponent(); m_pDlgNPC.SetAUIManager(this); } m_pDlgNPC.PopupDialog(pEssence); @@ -50,10 +55,15 @@ namespace BrewMonster.UI public void PopupNPCDialog(talk_proc pTalk) { + var dialogueNpc = CECUIManager.Instance.ShowUI("DialogNPC"); if (m_pDlgNPC == null) { - GameObject ob = m_dialogResouce.GetPrefabDialog("DialogNPC"); - m_pDlgNPC = GameObject.Instantiate(ob, m_canvas.transform).GetComponent(); + if (dialogueNpc == null) + { + BMLogger.LogError("can not get dialogue npc"); + return; + } + m_pDlgNPC = dialogueNpc.GetComponent(); m_pDlgNPC.SetAUIManager(this); } m_pDlgNPC.PopupNPCDialog(pTalk); @@ -81,11 +91,15 @@ namespace BrewMonster.UI public bool PopupTaskFinishDialog(uint taskId, talk_proc pTalk) { if (pTalk.num_window == 0) return false; - + var dialogueNpc = CECUIManager.Instance.ShowUI("DialogNPC"); if (m_pDlgNPC == null) { - GameObject ob = m_dialogResouce.GetPrefabDialog("DialogNPC"); - m_pDlgNPC = GameObject.Instantiate(ob, m_canvas.transform).GetComponent(); + if (dialogueNpc == null) + { + BMLogger.LogError("can not get dialogue npc"); + return false; + } + m_pDlgNPC = dialogueNpc.GetComponent(); m_pDlgNPC.SetAUIManager(this); } diff --git a/Assets/PerfectWorld/Scripts/UI/NPCShopUIManager.cs b/Assets/PerfectWorld/Scripts/UI/NPCShopUIManager.cs index d12ff02f9b..79f7d4b49b 100644 --- a/Assets/PerfectWorld/Scripts/UI/NPCShopUIManager.cs +++ b/Assets/PerfectWorld/Scripts/UI/NPCShopUIManager.cs @@ -8,10 +8,11 @@ using UnityEngine.UI; using TMPro; using PerfectWorld.Scripts.Shop; using BrewMonster; +using BrewMonster.UI; using static CSNetwork.Common.ExpTypes; using ModelRenderer.Scripts.Common; -public class NPCShopUIManager : MonoBehaviour +public class NPCShopUIManager : AUIDialog { [Header("UI Panels")] public GameObject npcShopMainPanel; @@ -39,12 +40,21 @@ public class NPCShopUIManager : MonoBehaviour /// Current NPC id for this shop session. Send SEVNPC_HELLO with this before buy. public uint CurrentNPCID => currentNPCID; private NPCShopDetailPanel detailPanelScript; - + + public override void OnEnable() + { + base.OnEnable(); + closeShopButton.onClick.AddListener(CloseShop); + } + + public override void OnDisable() + { + base.OnDisable(); + closeShopButton.onClick.RemoveListener(CloseShop); + } + void Start() { - if (closeShopButton != null) - closeShopButton.onClick.AddListener(CloseShop); - // Initialize detail panel reference if (npcShopDetailPanel != null) { @@ -87,8 +97,8 @@ public class NPCShopUIManager : MonoBehaviour return; } - // Show panel - npcShopMainPanel.SetActive(true); + // // Show panel + // npcShopMainPanel.SetActive(true); // Create tabs CreateTabs(); @@ -448,6 +458,7 @@ public class NPCShopUIManager : MonoBehaviour public void CloseShop() { + CloseDialogue(); if (npcShopMainPanel != null) npcShopMainPanel.SetActive(false); diff --git a/Assets/Prefabs/UI/DlgInstall.prefab b/Assets/Prefabs/UI/DlgInstall.prefab index 00889b06d0..b5765859c0 100644 --- a/Assets/Prefabs/UI/DlgInstall.prefab +++ b/Assets/Prefabs/UI/DlgInstall.prefab @@ -14412,19 +14412,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 5369000151225963552} m_OnClick: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2206910701173095729} - m_TargetAssemblyTypeName: BrewMonster.DlgInstall, Assembly-CSharp - m_MethodName: ResetInstallUI - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] --- !u!1 &8630310120599759549 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/UI/DlgUninstall.prefab b/Assets/Prefabs/UI/DlgUninstall.prefab index 35533b247e..a64554539c 100644 --- a/Assets/Prefabs/UI/DlgUninstall.prefab +++ b/Assets/Prefabs/UI/DlgUninstall.prefab @@ -14455,19 +14455,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 8610436949540127176} m_OnClick: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 8875456710871994775} - m_TargetAssemblyTypeName: BrewMonster.DlgInstall, Assembly-CSharp - m_MethodName: ResetInstallUI - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] --- !u!1 &8792750976503081546 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/CECUIManager.cs b/Assets/Scripts/CECUIManager.cs index aad27367fe..accb4b9a77 100644 --- a/Assets/Scripts/CECUIManager.cs +++ b/Assets/Scripts/CECUIManager.cs @@ -15,7 +15,7 @@ public class CECUIManager : MonoSingleton private readonly Dictionary _spawnedUIs = new(); /// Stack of dialog names (front = index 0 = top / currently on top). - private readonly List _uiStack = new(); + [SerializeField]private List _uiStack = new(); /// Max number of dialogs in stack; when exceeded on Push, the top is popped once. 0 = unlimited. [SerializeField] private int _maxStack = 1; @@ -151,21 +151,25 @@ public class CECUIManager : MonoSingleton /// Name of component ("DlgTask", "EC_InventoryUI") /// If true, push onto stack (show + SetAsLastSibling + track); if false, just show. /// just hide current ui- not pop - public void ShowUI(string componentName) + public AUIDialog ShowUI(string componentName) { if (string.IsNullOrEmpty(componentName) || canvasDlg == null) { - if (canvasDlg == null) Debug.LogError("canvasDlg chưa được gán"); - return; + if (canvasDlg == null) Debug.LogError("canvasDlg is null"); + return null; } var currentDialogue = GetCurrentDialog(); if (currentDialogue != null) { + if (_uiStack.Count > 0 && string.Compare(_uiStack[0], componentName, StringComparison.Ordinal) == 0) + { + return currentDialogue; + } currentDialogue.Show(false); } - Push(componentName); + return Push(componentName); } public void HideCurrentUIInStack() @@ -182,9 +186,9 @@ public class CECUIManager : MonoSingleton /// /// Push a dialog onto the UI stack: show it, add to front of stack, and SetAsLastSibling so it draws on top. If already in stack, moves it to front. /// - private void Push(string componentName) + private AUIDialog Push(string componentName) { - if (string.IsNullOrEmpty(componentName) || canvasDlg == null) return; + if (string.IsNullOrEmpty(componentName) || canvasDlg == null) return null; _uiStack.Remove(componentName); @@ -192,11 +196,12 @@ public class CECUIManager : MonoSingleton Pop(); var dlg = GetInGameUIMan().GetDialog(componentName); - if (dlg == null) return; + if (dlg == null) return null; dlg.Show(true); _uiStack.Insert(0, componentName); dlg.transform.SetAsLastSibling(); + return dlg; } /// @@ -233,9 +238,9 @@ public class CECUIManager : MonoSingleton /// Returns the dialog instance currently on top of the stack, or null if stack is empty. public AUIDialog GetCurrentDialog() { - var name = GetCurrentUI(); - if (name == null) return null; - return GetInGameUIMan().GetDialog(name); + var currentUI = GetCurrentUI(); + if (currentUI == null) return null; + return GetInGameUIMan().GetDialog(currentUI); } /// Returns the number of dialogs in the stack (0 when empty).