From 312edda4aa7dfe12a23f8932d44ecc4c63e88c8b Mon Sep 17 00:00:00 2001 From: HungDK <> Date: Tue, 27 Jan 2026 17:41:33 +0700 Subject: [PATCH] Fix get character name logic --- Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs | 13 ++++++++++++- .../Scripts/UI/GamePlay/CdlgQuickBar.cs | 12 +++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs index e2aca6996c..f5e0b49440 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs @@ -26,11 +26,14 @@ namespace BrewMonster.UI } public bool SetName(string pszName) { + m_szName = pszName; + if (m_pAUIManager == null) + return false; // Will be registered when SetAUIManager is called + if (m_pAUIManager.m_DlgName.ContainsKey(pszName)) return false; //m_pAUIManager.m_DlgName.Remove(m_szName); - m_szName = pszName; m_pAUIManager.m_DlgName[m_szName] = this; return true; @@ -94,6 +97,11 @@ namespace BrewMonster.UI public void SetAUIManager(AUIManager pAUIManager) { m_pAUIManager = pAUIManager; + // Register dialog name if it was set before manager was assigned + if (m_pAUIManager != null && !string.IsNullOrEmpty(m_szName) && !m_pAUIManager.m_DlgName.ContainsKey(m_szName)) + { + m_pAUIManager.m_DlgName[m_szName] = this; + } } public virtual void OnEnable() @@ -129,5 +137,8 @@ namespace BrewMonster.UI { return false; } + + /// Override in dialogs that support attribute-point reset (e.g. DlgCharacter). No-op by default. + public virtual void ResetPoints() { } } } diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs index 72b49c472a..4ac3678e0f 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs @@ -1,4 +1,4 @@ -using BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay; +using BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay; using BrewMonster.Network; using BrewMonster.Scripts; using BrewMonster.Scripts.Skills; @@ -43,6 +43,9 @@ namespace BrewMonster var a_pszPanel = new List(); GetQuickBarNameAndSC(pHost, a_pszPanel, a_pSCS, nCurPanel9, nCurPanel8); + if (a_pSCS == null || a_pSCS.Count < 2) + return false; + for (int i = 0; i <= 1/*(int)a_pSCS.Count*/; i++) { if (a_pSCS[i] == null) @@ -50,10 +53,10 @@ namespace BrewMonster /*CDlgQuickBar* pQuickBar = dynamic_cast(GetGameUIMan()->GetDialog(a_pszPanel[i])); if (!pQuickBar || !pQuickBar->IsShow()) continue;*/ - int slotIndex = 0; - for (int j = 0; j < a_pSCS.Count; j++) + int nSlots = Mathf.Min(a_pSCS[i].GetShortcutNum(), AUIImagePictureList.Count); + for (int j = 0; j < nSlots; j++) { - pCell = AUIImagePictureList[slotIndex]; + pCell = AUIImagePictureList[j]; pSC = a_pSCS[i].GetShortcut(j); pClock = pCell.GetClockIcon(); pClock.SetProgressRange(0, 1); @@ -207,7 +210,6 @@ namespace BrewMonster { if (pSkill != null) { - slotIndex++; //BMLogger.Log("HoangDev: QuickBar Set Skill Icon: " + (uint)pSkill.GetSkillID() + " : " + ElementSkill.GetIcon((uint)pSkill.GetSkillID())); var nameskill = ElementSkill.GetIcon((uint)pSkill.GetSkillID()); GetGameUIMan().SetCover(pCell, nameskill, EC_GAMEUI_ICONS.ICONS_SKILL);